Re: *new version* A little zenity-gui for flashing images to the neo

2008-09-15 Thread Ilja O.
On Mon, Sep 15, 2008 at 4:13 AM, fredrik normann 
[EMAIL PROTECTED] wrote:

 On Sun, Sep 14, 2008 at 8:34 AM, Dale Maggee [EMAIL PROTECTED]wrote:

  I have been developing small python wx-based gui that currently can be
 used
  for flashing, log data obtaining and is able to do some backup (last two
 via
  ssh).
 
  I'd be glad to share if you want. (Just will need to do some
 docstrings).
 
 yeah, I'd be really interested in seeing it! I don't really know any
 python yet, but I've looked into it a little bit lately, and I've
 decided I want to learn it, so if you share what you have it will
 probably help my learning and I can probably contribute to it.


 I thought about doing this in Python aswell. I got enought time, so if you
 want to share what you've done so fare, that would be great.


Okay. I didn't really expected  that somebody would be interested.
Than, what project hosting is preferably used by OM community?

Is it http://projects.openmoko.org/ ? Or something else?
___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: *new version* A little zenity-gui for flashing images to the neo

2008-09-14 Thread Dale Maggee
Ilja O. wrote:
 On Fri, Sep 12, 2008 at 5:13 AM, Charles Pax [EMAIL PROTECTED] wrote:

   
 So at some point here I'm guessing Zenity will have to be dropped in favor
 of maybe a Python + Glade combination. Is anyone out there capable and
 willing to do such a thing? It should probably happen sooner rather than
 later.

 

 I have been developing small python wx-based gui that currently can be used
 for flashing, log data obtaining and is able to do some backup (last two via
 ssh).

 I'd be glad to share if you want. (Just will need to do some docstrings).
   
yeah, I'd be really interested in seeing it! I don't really know any 
python yet, but I've looked into it a little bit lately, and I've 
decided I want to learn it, so if you share what you have it will 
probably help my learning and I can probably contribute to it.

Cheers,
-Dale

___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: *new version* A little zenity-gui for flashing images to the neo

2008-09-13 Thread Ilja O.
On Fri, Sep 12, 2008 at 5:13 AM, Charles Pax [EMAIL PROTECTED] wrote:

 So at some point here I'm guessing Zenity will have to be dropped in favor
 of maybe a Python + Glade combination. Is anyone out there capable and
 willing to do such a thing? It should probably happen sooner rather than
 later.


I have been developing small python wx-based gui that currently can be used
for flashing, log data obtaining and is able to do some backup (last two via
ssh).

I'd be glad to share if you want. (Just will need to do some docstrings).
___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: *new version* A little zenity-gui for flashing images to the neo

2008-09-11 Thread Dale Maggee
http://www.dict.org/bin/Dict?Form=Dict2Database=*Query=transmogrificationOk, 
so I've been slaving away over my (not so) little script, and it's about 
time for another release.


Changes

- Utility now has the ability to flash the splash image as per request

- Utility can now also backup your device to flashable rootfs / kernel 
images (david might like this for building FDOM images)


- Configurification is loaded on startup and saved in /etc/frutil (you 
can only modify settings if you run it as root)


- more idiot proofing - uses 'which' to find dfu-util, checks to ensure 
it's being run as root, checks that zenity is installed on the host, 
checks that you have mkfs.jffs2 installed before backing up, checks that 
you have pv installed and acts accordingly (by either using it or not 
during the backup [this is not properly tested because I don't have pv, 
please report]), and possibly other stuff I've forgotten about.


- new name to reflect the new abilities

Notes:

- I mentioned using dialog instead of zenity for a faster and more 
consistent text-only interface. I investigated this, but dialog's file 
selection dialog is so awful that I reconsidered and stuck with zenity. 
if anybody knows of a decent text-based alternative like dialog but with 
a better file selection dialog, I'd be interested to hear about it


- I recommend setting up an ssh authorized key before doing the backup, 
otherwise you'll be prompted multiple times to enter the device's root 
password. To do this, run 'ssh-keygen' on your host machine and then 
copy the contents of ~/.ssh/id_rsa.pub on your host into 
/home/root/authorized keys on your device. This also means you don't 
have to enter your password to ssh anymore.


- I'm taking suggestions for names. I've gone with 'frutil', but 
'neotool' also appeals to me. I was calling it 'uberscript' there for a 
while, but I'm not a big fan of that...


- I'll get around to making a wiki page for this and linking to it from 
the flash and backup pages, but I won't complain if somebody beats me to 
it. A copy is available for download at http://users.on.net/~antisol/frutil


Thoughts for future versions / when I have time:

- ability to specify the names of the backup images (currently hardcoded 
to ./FreeRunner_rootfs_Backup_`date +%Y%m%d%H%M`.jffs2 and 
./FreeRunner_Kernel_Backup_`date +%Y%m%d%H%M`.bin)


- ability to bypass the zenity menus via command-line parameters, i.e: 
frutil --flash kernel ./kernelfile.bin rootfs ./rootfs.jffs


- another method of bypassing menus - you create symbolic links called 
'neoflash' and 'neobackup', and the utility checks $0 on start and goes 
straight to the applicable function, the same way busybox works


- maybe ability to auto-download more things from 
downloads.openmoko.org, like the latest kernel / image?


- maybe addressbook management? ability to import contacts into the 
device? to do this I'd have to find a way to determine which distro is 
installed and act accordingly.


- things people suggest!
*
*As always, suggestions, comments, reports of catastrophic failure, 
beer, job offers, sportscars, and millions of dollars are all 
appreciated. ;)


enjoy!

-Dale
#!/bin/bash

#
# FreeRunner UberSkript 1.0
# By AntiSol, antisol (at) internode (dot) on (dot) net
# GNU GPL licensed
# loosely based on a script by 'rorschach'
# Thanks to:
#   Charles Pax (suggestion to fetch dfu-util)
#   David Samblas (info on 'which' command)
#

settings_file='/etc/frutil'
tmp_error_log_path='/tmp/flash-error-log'

if [ -z `which zenity 2/dev/null` ]; then
echo it looks like zenity isn't installed, and this tool requires it!
exit
fi  

#function detect_FR {
#   tmp=`ping -c 1 192.168.0.202`
#   if [ $? != 0 ]; then 
#   echo no freerunner found!
#   else 
#   echo Freerunner found at 192.168.0.1
#   fi
#}

function find_dfu {
#use 'which'...
dfutils_path=`which dfu-util 2/dev/null`

if [ -z $dfutils_path ]; then
#look in current directory...
if [ -x './dfu-util' ]; then
dfutils_path='./dfu-util'
fi
fi

}

function check_dfu {

if [ ! -x $dfutils_path ]; then

find_dfu

if [ -z $dfutils_path ]; then
#not found. 
zenity --title dfu-util not found --question --text 
The dfu utility could not be found, or is not executable. Do you want to 
automagically download it from downloads.openmoko.org?

if [ $? = 0 ]; then
clear
echo 'Downloading dfu-util...'
rm ./dfu-util  /dev/null 21

Re: *new version* A little zenity-gui for flashing images to the neo

2008-09-11 Thread Dale Maggee
I'm an idiot, ignore the dict.org link. I pasted it into the email 
accidentally, and I thought I'd deleted it, but apparently not. damn 
HTML-format emails... :(

Dale Maggee wrote:
 http://www.dict.org/bin/Dict?Form=Dict2Database=*Query=transmogrificationOk,
  
 so I've been slaving away over my (not so) little script, and it's 
 about time for another release.

 Changes

 - Utility now has the ability to flash the splash image as per request

 - Utility can now also backup your device to flashable rootfs / kernel 
 images (david might like this for building FDOM images)

 - Configurification is loaded on startup and saved in /etc/frutil (you 
 can only modify settings if you run it as root)

 - more idiot proofing - uses 'which' to find dfu-util, checks to 
 ensure it's being run as root, checks that zenity is installed on the 
 host, checks that you have mkfs.jffs2 installed before backing up, 
 checks that you have pv installed and acts accordingly (by either 
 using it or not during the backup [this is not properly tested because 
 I don't have pv, please report]), and possibly other stuff I've 
 forgotten about.

 - new name to reflect the new abilities

 Notes:

 - I mentioned using dialog instead of zenity for a faster and more 
 consistent text-only interface. I investigated this, but dialog's file 
 selection dialog is so awful that I reconsidered and stuck with 
 zenity. if anybody knows of a decent text-based alternative like 
 dialog but with a better file selection dialog, I'd be interested to 
 hear about it

 - I recommend setting up an ssh authorized key before doing the 
 backup, otherwise you'll be prompted multiple times to enter the 
 device's root password. To do this, run 'ssh-keygen' on your host 
 machine and then copy the contents of ~/.ssh/id_rsa.pub on your host 
 into /home/root/authorized keys on your device. This also means you 
 don't have to enter your password to ssh anymore.

 - I'm taking suggestions for names. I've gone with 'frutil', but 
 'neotool' also appeals to me. I was calling it 'uberscript' there for 
 a while, but I'm not a big fan of that...

 - I'll get around to making a wiki page for this and linking to it 
 from the flash and backup pages, but I won't complain if somebody 
 beats me to it. A copy is available for download at 
 http://users.on.net/~antisol/frutil

 Thoughts for future versions / when I have time:

 - ability to specify the names of the backup images (currently 
 hardcoded to ./FreeRunner_rootfs_Backup_`date +%Y%m%d%H%M`.jffs2 and 
 ./FreeRunner_Kernel_Backup_`date +%Y%m%d%H%M`.bin)

 - ability to bypass the zenity menus via command-line parameters, i.e: 
 frutil --flash kernel ./kernelfile.bin rootfs ./rootfs.jffs

 - another method of bypassing menus - you create symbolic links called 
 'neoflash' and 'neobackup', and the utility checks $0 on start and 
 goes straight to the applicable function, the same way busybox works

 - maybe ability to auto-download more things from 
 downloads.openmoko.org, like the latest kernel / image?

 - maybe addressbook management? ability to import contacts into the 
 device? to do this I'd have to find a way to determine which distro is 
 installed and act accordingly.

 - things people suggest!
 *
 *As always, suggestions, comments, reports of catastrophic failure, 
 beer, job offers, sportscars, and millions of dollars are all 
 appreciated. ;)

 enjoy!

 -Dale


___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: *new version* A little zenity-gui for flashing images to the neo

2008-09-11 Thread Charles Pax
So at some point here I'm guessing Zenity will have to be dropped in favor
of maybe a Python + Glade combination. Is anyone out there capable and
willing to do such a thing? It should probably happen sooner rather than
later.

-Charles
___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: A little zenity-gui for flashing images to the neo

2008-09-08 Thread Dale Maggee

Charles Pax wrote:

On Sun, Sep 7, 2008 at 6:34 PM, Joel Newkirk [EMAIL PROTECTED] wrote:

  

Sounds like you did a cut'n'paste from email.  The problem is that long
lines are wrapped, which breaks programs/scripts.  There's at least three
places in the script that suffer from word-wrap, including several lines
that start at line 66.




Yup, did a cut n' paste. I tried the attachment and it worked just fine.
Maybe a future version can offer to fetch dfu-util. Thanks for the help.

-Charles
  

Nice suggestion! Done!

-Dale
#!/bin/bash
# dfu-util Image-Flashing Gui 0.2

function check_dfu {

if [ ! -x $dfutils_path ]; then
#look in current folder...
if [ -x './dfu-util' ]; then
dfutils_path='./dfu-util'
else
zenity --question --text The dfu utility could not be 
found at $dfutils_path, or is not exceutable. Do you want to automagically 
download it from downloads.openmoko.org?
if [ $? = 0 ]; then
rm ./dfu-util  /dev/null
wget 
http://downloads.openmoko.org/daily/dfu-util
chmod a+x ./dfu-util /dev/null
dfutils_path='./dfu-util'
else
dfutils_path=$(zenity --file-selection 
--title=Locate the dfu-util executable: --filename=$dfutils_path)
fi

if [ -z $dfutils_path ]; then
echo Cancelled!
exit
fi
#check selection...
check_dfu
fi
fi
}

function perform_flash {
# $1 - what we're flashing (for display)
# $2 - dfu-params
# $3 - file to flash

echo
echo *** Flashing $1 with $3 ...
echo

$dfutils_path $2 $3 2 $tmp_error_log_path
# add the following line to the previous line to get back the zenity 
progress dialog:
# | zenity --progress --pulsate --percentage=0 --title Flashing in 
progress.. --auto-close

if [ ${PIPESTATUS[0]} != 0 ];then
zenity --error --text Some error occured while flashing 
$1.\n\nError message:\n`cat $tmp_error_log_path`
exit
else
#sleep to allow dfu to reset...
sleep 2
fi
}

dfutils_path='/usr/local/bin/dfu-util'

check_dfu

tmp_error_log_path='/tmp/flash-error-log'

ans=$(zenity  --list --text What do you wanna flash? --title dfu-util gui 
--checklist --column Pick --column Option TRUE Root-Filesystem TRUE Kernel 
FALSE Bootloader)

if [ -z $ans ]; then
#handle cancel / no selection...
echo Nothing to do!
exit
fi

txt=The flashing will now start.\n\nMake sure your Neo is connected to the 
USB-Device and booted into the Nor (for kernel and rootfs) or Nand (for u-boot) 
screen before proceeding.\nRemember that flashing a large image like a rootfs 
will take some time so don't abort it.\n\n

if [ -n `echo $ans | grep Root-Filesystem` ];then
du_param_r='-a rootfs -R -D'
rootfs=True
img_file_r=$(zenity --file-selection --title=Select an image-file for 
the ROOTFS:)
if [ $img_file_r =  ]; then
echo Cancelled!
exit
fi
txt=$txt - Flashing rootfs with $img_file_r \n\n
fi

if [ -n `echo $ans | grep Kernel` ];then
du_param_k='-a kernel -R -D'
kernel=True
img_file_k=$(zenity --file-selection --title=Select an image-file for 
the KERNEL:)
if [ $img_file_k =  ]; then
echo Cancelled!
exit
fi
txt=$txt - Flashing kernel with $img_file_k \n\n
fi

if [ -n ` echo $ans | grep Bootloader` ];then
du_param_u='-a u-boot -R -D'
uboot=True
img_file_u=$(zenity --file-selection --title=Select an image-file for 
UBOOT:)
if [ $img_file_u =  ]; then
echo Cancelled!
exit
fi
txt=$txt - Flashing uboot with $img_file_u \n\n
fi

touch $tmp_error_log_path

zenity --info --text $txt

if [ $rootfs = True ]; then
perform_flash rootfs $du_param_r $img_file_r
fi

if [ $kernel = True ]; then
perform_flash kernel $du_param_k $img_file_k
fi

if [ $uboot = True ]; then
perform_flash uboot $du_param_u $img_file_u
fi

rm $tmp_error_log_path
exit 0

___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: A little zenity-gui for flashing images to the neo

2008-09-08 Thread Daniel Hedblom
Nice work,

I used the dfu-util from debian Lenny that gets installed in /usr/bin
instead of /usr/local/bin. Anyone that has a nice way of checking the
users paths for a specific app?

//danielh

2008/9/8 Dale Maggee [EMAIL PROTECTED]:
 Charles Pax wrote:

 On Sun, Sep 7, 2008 at 6:34 PM, Joel Newkirk [EMAIL PROTECTED]
 wrote:



 Sounds like you did a cut'n'paste from email.  The problem is that long
 lines are wrapped, which breaks programs/scripts.  There's at least three
 places in the script that suffer from word-wrap, including several lines
 that start at line 66.



 Yup, did a cut n' paste. I tried the attachment and it worked just fine.
 Maybe a future version can offer to fetch dfu-util. Thanks for the help.

 -Charles


 Nice suggestion! Done!

 -Dale

 #!/bin/bash
 # dfu-util Image-Flashing Gui 0.2

 function check_dfu {

if [ ! -x $dfutils_path ]; then
#look in current folder...
if [ -x './dfu-util' ]; then
dfutils_path='./dfu-util'
else
zenity --question --text The dfu utility could not
 be found at $dfutils_path, or is not exceutable. Do you want to
 automagically download it from downloads.openmoko.org?
if [ $? = 0 ]; then
rm ./dfu-util  /dev/null
wget
 http://downloads.openmoko.org/daily/dfu-util
chmod a+x ./dfu-util /dev/null
dfutils_path='./dfu-util'
else
dfutils_path=$(zenity --file-selection
 --title=Locate the dfu-util executable: --filename=$dfutils_path)
fi

if [ -z $dfutils_path ]; then
echo Cancelled!
exit
fi
#check selection...
check_dfu
fi
fi
 }

 function perform_flash {
# $1 - what we're flashing (for display)
# $2 - dfu-params
# $3 - file to flash

echo
echo *** Flashing $1 with $3 ...
echo

$dfutils_path $2 $3 2 $tmp_error_log_path
# add the following line to the previous line to get back the zenity
 progress dialog:
# | zenity --progress --pulsate --percentage=0 --title Flashing in
 progress.. --auto-close

if [ ${PIPESTATUS[0]} != 0 ];then
zenity --error --text Some error occured while flashing
 $1.\n\nError message:\n`cat $tmp_error_log_path`
exit
else
#sleep to allow dfu to reset...
sleep 2
fi
 }

 dfutils_path='/usr/local/bin/dfu-util'

 check_dfu

 tmp_error_log_path='/tmp/flash-error-log'

 ans=$(zenity  --list --text What do you wanna flash? --title dfu-util
 gui --checklist --column Pick --column Option TRUE Root-Filesystem TRUE
 Kernel FALSE Bootloader)

 if [ -z $ans ]; then
#handle cancel / no selection...
echo Nothing to do!
exit
 fi

 txt=The flashing will now start.\n\nMake sure your Neo is connected to the
 USB-Device and booted into the Nor (for kernel and rootfs) or Nand (for
 u-boot) screen before proceeding.\nRemember that flashing a large image like
 a rootfs will take some time so don't abort it.\n\n

 if [ -n `echo $ans | grep Root-Filesystem` ];then
du_param_r='-a rootfs -R -D'
rootfs=True
img_file_r=$(zenity --file-selection --title=Select an image-file
 for the ROOTFS:)
if [ $img_file_r =  ]; then
echo Cancelled!
exit
fi
txt=$txt - Flashing rootfs with $img_file_r \n\n
 fi

 if [ -n `echo $ans | grep Kernel` ];then
du_param_k='-a kernel -R -D'
kernel=True
img_file_k=$(zenity --file-selection --title=Select an image-file
 for the KERNEL:)
if [ $img_file_k =  ]; then
echo Cancelled!
exit
fi
txt=$txt - Flashing kernel with $img_file_k \n\n
 fi

 if [ -n ` echo $ans | grep Bootloader` ];then
du_param_u='-a u-boot -R -D'
uboot=True
img_file_u=$(zenity --file-selection --title=Select an image-file
 for UBOOT:)
if [ $img_file_u =  ]; then
echo Cancelled!
exit
fi
txt=$txt - Flashing uboot with $img_file_u \n\n
 fi

 touch $tmp_error_log_path

 zenity --info --text $txt

 if [ $rootfs = True ]; then
perform_flash rootfs $du_param_r $img_file_r
 fi

 if [ $kernel = True ]; then
perform_flash kernel $du_param_k $img_file_k
 fi

 if [ $uboot = True ]; then
perform_flash uboot $du_param_u $img_file_u
 fi

 rm $tmp_error_log_path
 exit 0


 ___
 Openmoko community mailing list
 community@lists.openmoko.org
 http://lists.openmoko.org/mailman/listinfo/community




Re: A little zenity-gui for flashing images to the neo

2008-09-08 Thread David Samblas
#which command_here 
will return the full path of the command.
example: 
#which which
/usr/bin/which  
El lun, 08-09-2008 a las 08:59 +0200, Daniel Hedblom escribió:
 Nice work,
 
 I used the dfu-util from debian Lenny that gets installed in /usr/bin
 instead of /usr/local/bin. Anyone that has a nice way of checking the
 users paths for a specific app?
 
 //danielh
 
 2008/9/8 Dale Maggee [EMAIL PROTECTED]:
  Charles Pax wrote:
 
  On Sun, Sep 7, 2008 at 6:34 PM, Joel Newkirk [EMAIL PROTECTED]
  wrote:
 
 
 
  Sounds like you did a cut'n'paste from email.  The problem is that long
  lines are wrapped, which breaks programs/scripts.  There's at least three
  places in the script that suffer from word-wrap, including several lines
  that start at line 66.
 
 
 
  Yup, did a cut n' paste. I tried the attachment and it worked just fine.
  Maybe a future version can offer to fetch dfu-util. Thanks for the help.
 
  -Charles
 
 
  Nice suggestion! Done!
 
  -Dale
 
  #!/bin/bash
  # dfu-util Image-Flashing Gui 0.2
 
  function check_dfu {
 
 if [ ! -x $dfutils_path ]; then
 #look in current folder...
 if [ -x './dfu-util' ]; then
 dfutils_path='./dfu-util'
 else
 zenity --question --text The dfu utility could not
  be found at $dfutils_path, or is not exceutable. Do you want to
  automagically download it from downloads.openmoko.org?
 if [ $? = 0 ]; then
 rm ./dfu-util  /dev/null
 wget
  http://downloads.openmoko.org/daily/dfu-util
 chmod a+x ./dfu-util /dev/null
 dfutils_path='./dfu-util'
 else
 dfutils_path=$(zenity --file-selection
  --title=Locate the dfu-util executable: --filename=$dfutils_path)
 fi
 
 if [ -z $dfutils_path ]; then
 echo Cancelled!
 exit
 fi
 #check selection...
 check_dfu
 fi
 fi
  }
 
  function perform_flash {
 # $1 - what we're flashing (for display)
 # $2 - dfu-params
 # $3 - file to flash
 
 echo
 echo *** Flashing $1 with $3 ...
 echo
 
 $dfutils_path $2 $3 2 $tmp_error_log_path
 # add the following line to the previous line to get back the zenity
  progress dialog:
 # | zenity --progress --pulsate --percentage=0 --title Flashing in
  progress.. --auto-close
 
 if [ ${PIPESTATUS[0]} != 0 ];then
 zenity --error --text Some error occured while flashing
  $1.\n\nError message:\n`cat $tmp_error_log_path`
 exit
 else
 #sleep to allow dfu to reset...
 sleep 2
 fi
  }
 
  dfutils_path='/usr/local/bin/dfu-util'
 
  check_dfu
 
  tmp_error_log_path='/tmp/flash-error-log'
 
  ans=$(zenity  --list --text What do you wanna flash? --title dfu-util
  gui --checklist --column Pick --column Option TRUE Root-Filesystem TRUE
  Kernel FALSE Bootloader)
 
  if [ -z $ans ]; then
 #handle cancel / no selection...
 echo Nothing to do!
 exit
  fi
 
  txt=The flashing will now start.\n\nMake sure your Neo is connected to the
  USB-Device and booted into the Nor (for kernel and rootfs) or Nand (for
  u-boot) screen before proceeding.\nRemember that flashing a large image like
  a rootfs will take some time so don't abort it.\n\n
 
  if [ -n `echo $ans | grep Root-Filesystem` ];then
 du_param_r='-a rootfs -R -D'
 rootfs=True
 img_file_r=$(zenity --file-selection --title=Select an image-file
  for the ROOTFS:)
 if [ $img_file_r =  ]; then
 echo Cancelled!
 exit
 fi
 txt=$txt - Flashing rootfs with $img_file_r \n\n
  fi
 
  if [ -n `echo $ans | grep Kernel` ];then
 du_param_k='-a kernel -R -D'
 kernel=True
 img_file_k=$(zenity --file-selection --title=Select an image-file
  for the KERNEL:)
 if [ $img_file_k =  ]; then
 echo Cancelled!
 exit
 fi
 txt=$txt - Flashing kernel with $img_file_k \n\n
  fi
 
  if [ -n ` echo $ans | grep Bootloader` ];then
 du_param_u='-a u-boot -R -D'
 uboot=True
 img_file_u=$(zenity --file-selection --title=Select an image-file
  for UBOOT:)
 if [ $img_file_u =  ]; then
 echo Cancelled!
 exit
 fi
 txt=$txt - Flashing uboot with $img_file_u \n\n
  fi
 
  touch $tmp_error_log_path
 
  zenity --info --text $txt
 
  if [ $rootfs = True ]; then
 perform_flash rootfs $du_param_r $img_file_r
  fi
 
  if [ $kernel = True ]; then
 perform_flash 

A little zenity-gui for flashing images to the neo

2008-09-08 Thread Minh Ha Duong
Hi,

According to this mail:
  http://lists.openmoko.org/pipermail/devel/2008-September/001726.html
the boot image is flasheable too, and the next upgrade will upgrade it.
Does this look like something that zenity-gui could do ?

I can't find a  zenity  page on the wiki, do you want me to start one ?

Minh

___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: A little zenity-gui for flashing images to the neo

2008-09-08 Thread Dale Maggee
Minh Ha Duong wrote:
 Hi,

 According to this mail:
   http://lists.openmoko.org/pipermail/devel/2008-September/001726.html
 the boot image is flasheable too, and the next upgrade will upgrade it.
 Does this look like something that zenity-gui could do ?
   
Yes, it is. I'll update the script sometime soon and re-post it.
 I can't find a  zenity  page on the wiki, do you want me to start one ?
   
I don't really think this is appropriate - zenity is the tool which 
allows me to use gtk dialog boxes from within a shell script, it doesn't 
really have anything to do with openmoko or the FreeRunner. More info at 
[1].

if you're talking about adding this script to the wiki, then yes, it 
should be in the wiki, but it would more properly belong in [2]

The reason I haven't wikified it yet is that I'm not finished playing 
with it. here are my plans:
- making use of the 'which' command to locate dfu-util as suggested by 
david samblas
- checking that it's being run as root
- add support for flashing 'splash'

slightly longer-term:
- use dialog instead of zenity (all text output for more consistent 
look, faster, more flexible)
- use a settings file to save the location of dfu-util
- I've also written a script to backup the freerunner using this method 
[3]. I'm planning on integrating these two scripts into a nice 
menu-driven uberscript for both backup and flashing

[1] http://www.linuxmanpages.com/man1/zenity.1.php
[2] http://wiki.openmoko.org/wiki/Flashing_the_Neo_FreeRunner
[3] 
http://wiki.openmoko.org/wiki/Pre-Flash_Backup#Backing-up_flash_images_.28alternative.29

-Dale

___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: A little zenity-gui for flashing images to the neo

2008-09-07 Thread Dale Maggee
Rorschach wrote:
 Hi,
 I was bored and just wrote a little zenity-gui for flashing images to the 
 neo: http://paste.ubuntuusers.de/391300/ .

 For the zenity-gui you need of course zenity and a bash-shell. To make the 
 progress-bar work you need to patch dfu-util:
   
Hi,

I was more bored and wanted to exercise my scripting skillz, so I made 
some changes to this script.

new stuff:

- ability to flash more than one image at once - the 'what do you wanna 
flash' now has checkboxes instead of radio buttons, and all your 
selections are flashed one after the other. (which i find very handy, 
stops the FR powering down while you're typing the next dfu-util 
command, or locating the next image - works great for flashing a new 
distro  kernel). if an error occurs, subsequent files will not be flashed.

- more confirmation / idiot-proofing - it now tells you what you're 
doing much more clearly (i.e: about to flash Kernel with /foo/bar.bin, 
rootfs with /foo/bar.jffs. allows you to confirm that you chose the 
right images). also the 'choose file' dialogs tell you what you're 
browsing for

- ability for users to press 'cancel' at the various dialogs and exit 
gracefully.

- checks that dfu-util exists and is executable. I moved my dfu-util to 
/usr/local/bin, so it looks there first, but it will also check the 
current directory and prompt if it can't find it

- I wasn't a fan of patching dfu-util, and the pulsating zenity progress 
dialog drags my (prehistoric) PC to a crawl, so I disabled the progress 
bar and use the text output of dfu-util instead.

hope somebody finds it usefull, enjoy!

-Dale

---BEGIN---

#!/bin/bash
# dfu-util Image-Flashing Gui 0.2

function check_dfu {

if [ ! -x $dfutils_path ]; then
#look in current folder...
if [ -x './dfu-util' ]; then
dfutils_path='./dfu-util'
else
zenity --info --text The dfu utility could not 
be found at $dfutils_path, or is not exceutable. Please point me to the 
dfu-util...
dfutils_path=$(zenity --file-selection 
--title=Select the dfu-util executable: --filename=$dfutils_path)
if [ -z $dfutils_path ]; then
echo Cancelled!
exit
fi
#check selection...
check_dfu
fi
fi
}

function perform_flash {
# $1 - what we're flashing (for display)
# $2 - dfu-params
# $3 - file to flash

echo
echo *** Flashing $1 with $3 ...
echo

$dfutils_path $2 $3 2 $tmp_error_log_path
# add the following line to the previous line to get back the 
zenity progress dialog:
# | zenity --progress --pulsate --percentage=0 --title Flashing 
$1 in progress.. --auto-close
if [ ${PIPESTATUS[0]} != 0 ];then
zenity --error --text Some error occured while flashing 
$1.\n\nError message:\n`cat $tmp_error_log_path`
exit
else
#sleep to allow dfu to reset...
sleep 2
fi
}

dfutils_path='/usr/local/bin/dfu-util'

check_dfu

tmp_error_log_path='/tmp/flash-error-log'

ans=$(zenity  --list --text What do you wanna flash? --title dfu-util 
gui --checklist --column Pick --column Option TRUE Root-Filesystem 
TRUE Kernel FALSE Bootloader)

if [ -z $ans ]; then
#handle cancel / no selection...
echo Nothing to do!
exit
fi

txt=The flashing will now start.\n\nMake sure your Neo is connected to 
the USB-Device and booted into the Nor (for kernel and rootfs) or Nand 
(for u-boot) screen before proceeding.\nRemember that flashing a large 
image like a rootfs will take some time so don't abort it.\n\n

if [ -n `echo $ans | grep Root-Filesystem` ];then
du_param_r='-a rootfs -R -D'
rootfs=True
img_file_r=$(zenity --file-selection --title=Select an 
image-file for the ROOTFS:)
if [ $img_file_r =  ]; then
echo Cancelled!
exit
fi
txt=$txt - Flashing rootfs with $img_file_r \n\n
fi

if [ -n `echo $ans | grep Kernel` ];then
du_param_k='-a kernel -R -D'
kernel=True
img_file_k=$(zenity --file-selection --title=Select an 
image-file for the KERNEL:)
if [ $img_file_k =  ]; then
echo Cancelled!
exit
fi
txt=$txt - Flashing kernel with $img_file_k \n\n
fi

if [ -n ` echo $ans | grep Bootloader` ];then
du_param_u='-a u-boot -R -D'
uboot=True
img_file_u=$(zenity --file-selection --title=Select an 
image-file for UBOOT:)
if [ $img_file_u =  ]; then
echo Cancelled!
exit
fi
txt=$txt - Flashing uboot with $img_file_u \n\n
fi

touch $tmp_error_log_path

zenity --info --text $txt

if [ $rootfs = True

Re: A little zenity-gui for flashing images to the neo

2008-09-07 Thread Charles Pax
On Sun, Sep 7, 2008 at 1:19 PM, Dale Maggee [EMAIL PROTECTED]wrote:

 I was more bored and wanted to exercise my scripting skillz, so I made
 some changes to this script.

 I saved your code into a file called flasher and make it executable. I
get the following error.

./flasher: line 67: syntax error near unexpected token `('
./flasher: line 67: `the USB-Device and booted into the Nor (for kernel and
rootfs) or Nand'

-Charles
___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: A little zenity-gui for flashing images to the neo

2008-09-07 Thread Joel Newkirk
On Sun, 7 Sep 2008 14:50:20 -0400, Charles Pax [EMAIL PROTECTED]
wrote:
 On Sun, Sep 7, 2008 at 1:19 PM, Dale Maggee
 [EMAIL PROTECTED]wrote:
 
 I was more bored and wanted to exercise my scripting skillz, so I made
 some changes to this script.

 I saved your code into a file called flasher and make it executable. I
 get the following error.
 
 ./flasher: line 67: syntax error near unexpected token `('
 ./flasher: line 67: `the USB-Device and booted into the Nor (for kernel
 and
 rootfs) or Nand'
 
 -Charles

Sounds like you did a cut'n'paste from email.  The problem is that long
lines are wrapped, which breaks programs/scripts.  There's at least three
places in the script that suffer from word-wrap, including several lines
that start at line 66.

Something like a bash script really MUST be sent as an attachment, to
ensure this breakage doesn't happen.  Meanwhile you can go through the
script and removed the extra newlines, so that echo statements and comments
(the things I noted glancing at the script) are not wrapped.

j



___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: A little zenity-gui for flashing images to the neo

2008-09-07 Thread Joel Newkirk
On Sun, 7 Sep 2008 14:50:20 -0400, Charles Pax [EMAIL PROTECTED]
wrote:
 On Sun, Sep 7, 2008 at 1:19 PM, Dale Maggee
 [EMAIL PROTECTED]wrote:
 
 I was more bored and wanted to exercise my scripting skillz, so I made
 some changes to this script.

 I saved your code into a file called flasher and make it executable. I
 get the following error.
 
 ./flasher: line 67: syntax error near unexpected token `('
 ./flasher: line 67: `the USB-Device and booted into the Nor (for kernel
 and
 rootfs) or Nand'
 
 -Charles

Woops, please replace 'echo' with 'zenity' in my previous post - I was
thinking 'output' and just type 'echo' without thinking further.

j



___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: A little zenity-gui for flashing images to the neo

2008-09-07 Thread Dale Maggee

Joel Newkirk wrote:

On Sun, 7 Sep 2008 14:50:20 -0400, Charles Pax [EMAIL PROTECTED]
wrote:
  

On Sun, Sep 7, 2008 at 1:19 PM, Dale Maggee
[EMAIL PROTECTED]wrote:



I was more bored and wanted to exercise my scripting skillz, so I made
some changes to this script.

I saved your code into a file called flasher and make it executable. I
  

get the following error.

./flasher: line 67: syntax error near unexpected token `('
./flasher: line 67: `the USB-Device and booted into the Nor (for kernel
and
rootfs) or Nand'

-Charles


Something like a bash script really MUST be sent as an attachment, to
ensure this breakage doesn't happen.  Meanwhile you can go through the
script and removed the extra newlines, so that echo statements and comments
(the things I noted glancing at the script) are not wrapped.

j


  

aah, damn word wrap!

here it is as an attachment, hope they're allowed.

-Dale

#!/bin/bash
# dfu-util Image-Flashing Gui 0.2

function check_dfu {

if [ ! -x $dfutils_path ]; then
#look in current folder...
if [ -x './dfu-util' ]; then
dfutils_path='./dfu-util'
else
zenity --info --text The dfu utility could not be 
found at $dfutils_path, or is not exceutable. Please point me to the 
dfu-util...
dfutils_path=$(zenity --file-selection --title=Select 
the dfu-util executable: --filename=$dfutils_path)
if [ -z $dfutils_path ]; then
echo Cancelled!
exit
fi
#check selection...
check_dfu
fi
fi
}

function perform_flash {
# $1 - what we're flashing (for display)
# $2 - dfu-params
# $3 - file to flash

echo
echo *** Flashing $1 with $3 ...
echo

$dfutils_path $2 $3 2 $tmp_error_log_path
# add the following line to the previous line to get back the zenity 
progress dialog:
# | zenity --progress --pulsate --percentage=0 --title Flashing in 
progress.. --auto-close

if [ ${PIPESTATUS[0]} != 0 ];then
zenity --error --text Some error occured while flashing 
$1.\n\nError message:\n`cat $tmp_error_log_path`
exit
else
#sleep to allow dfu to reset...
sleep 2
fi
}

dfutils_path='/usr/local/bin/dfu-util'

check_dfu

tmp_error_log_path='/tmp/flash-error-log'

ans=$(zenity  --list --text What do you wanna flash? --title dfu-util gui 
--checklist --column Pick --column Option TRUE Root-Filesystem TRUE Kernel 
FALSE Bootloader)

if [ -z $ans ]; then
#handle cancel / no selection...
echo Nothing to do!
exit
fi

txt=The flashing will now start.\n\nMake sure your Neo is connected to the 
USB-Device and booted into the Nor (for kernel and rootfs) or Nand (for u-boot) 
screen before proceeding.\nRemember that flashing a large image like a rootfs 
will take some time so don't abort it.\n\n

if [ -n `echo $ans | grep Root-Filesystem` ];then
du_param_r='-a rootfs -R -D'
rootfs=True
img_file_r=$(zenity --file-selection --title=Select an image-file for 
the ROOTFS:)
if [ $img_file_r =  ]; then
echo Cancelled!
exit
fi
txt=$txt - Flashing rootfs with $img_file_r \n\n
fi

if [ -n `echo $ans | grep Kernel` ];then
du_param_k='-a kernel -R -D'
kernel=True
img_file_k=$(zenity --file-selection --title=Select an image-file for 
the KERNEL:)
if [ $img_file_k =  ]; then
echo Cancelled!
exit
fi
txt=$txt - Flashing kernel with $img_file_k \n\n
fi

if [ -n ` echo $ans | grep Bootloader` ];then
du_param_u='-a u-boot -R -D'
uboot=True
img_file_u=$(zenity --file-selection --title=Select an image-file for 
UBOOT:)
if [ $img_file_u =  ]; then
echo Cancelled!
exit
fi
txt=$txt - Flashing uboot with $img_file_u \n\n
fi

touch $tmp_error_log_path

zenity --info --text $txt

if [ $rootfs = True ]; then
perform_flash rootfs $du_param_r $img_file_r
fi

if [ $kernel = True ]; then
perform_flash kernel $du_param_k $img_file_k
fi

if [ $uboot = True ]; then
perform_flash uboot $du_param_u $img_file_u
fi

rm $tmp_error_log_path
exit 0

___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


Re: A little zenity-gui for flashing images to the neo

2008-09-07 Thread Charles Pax
On Sun, Sep 7, 2008 at 6:34 PM, Joel Newkirk [EMAIL PROTECTED] wrote:

 Sounds like you did a cut'n'paste from email.  The problem is that long
 lines are wrapped, which breaks programs/scripts.  There's at least three
 places in the script that suffer from word-wrap, including several lines
 that start at line 66.


Yup, did a cut n' paste. I tried the attachment and it worked just fine.
Maybe a future version can offer to fetch dfu-util. Thanks for the help.

-Charles
___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community


A little zenity-gui for flashing images to the neo

2008-08-11 Thread Rorschach
Hi,
I was bored and just wrote a little zenity-gui for flashing images to the neo: 
http://paste.ubuntuusers.de/391300/ .

For the zenity-gui you need of course zenity and a bash-shell. To make the 
progress-bar work you need to patch dfu-util:

$ diff dfu-util/src/sam7dfu-old.c dfu-util/src/sam7dfu.c
111c111
   printf(Starting download:\n);
---
   printf(Starting download: [);
148c148
   printf(#\n);
---
   putchar('#');
157c157
   printf(finished!\n);
---
   printf(] finished!\n);


signature.asc
Description: PGP signature
___
Openmoko community mailing list
community@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/community