flasher: revise autoboot handling
authorGrazvydas Ignotas <notasas@gmail.com>
Tue, 9 Oct 2012 17:08:58 +0000 (20:08 +0300)
committerGrazvydas Ignotas <notasas@gmail.com>
Tue, 9 Oct 2012 19:11:23 +0000 (22:11 +0300)
flasher/doit.sh
flasher/rootfs/etc/updater.sh
flasher/rootfs/etc/updater_funcs.sh

index 0fd8c89..14c1024 100755 (executable)
@@ -20,7 +20,7 @@ mkimage="tmp/mkimage"
 zipfile="pandora_flasher_v.zip"
 
 if test '!' '(' -d $rd_input -a -f ${sysf_in}x-load.bin.ift -a -f ${sysf_in}u-boot.bin \
-       -a -f ${sysf_in}uImage -a -f ${sysf_in}uImage_updater ')'
+       -a -f ${sysf_in}uImage -a -f ${sysf_in}uImage_updater -a -f ${sysf_in}bootmenu.txt ')'
 then
        echo "missing input files"
        exit 1
@@ -37,7 +37,9 @@ cp ${sysf_in}u-boot.bin_updater ${out_opt_dir}u-boot.bin
 
 # bootf.tgz
 cd $sysf_in
-tar czvf $bootf u-boot.bin uImage
+bootf_files=`echo u-boot.bin uImage uImage-* bootmenu.txt`
+test -e autoboot.txt && bootf_files="$bootf_files autoboot.txt"
+tar czvf $bootf $bootf_files
 cd ..
 mv -f ${sysf_in}${bootf} ${out_dir}
 
index 202f045..124c283 100755 (executable)
@@ -25,19 +25,6 @@ cleanup()
        fi
 }
 
-wait_for_file()
-{
-       for a in `seq 10`
-       do
-               if test -e "$1"
-               then
-                       return 0
-               fi
-               sleep .5
-       done
-       return 1
-}
-
 
 mkdir /mnt/ubifs 2> /dev/null || true
 
@@ -155,10 +142,6 @@ handle_kernels()
                return 0
        fi
 
-       # presence of uImage* is a sign that we can wipe whole boot partition,
-       # but first get rid of potentially bad autoboot.txt
-       rm -f /mnt/ubifs/autoboot.txt
-
        for kernel in $kernels
        do
                if ! cmp $kernel /mnt/ubifs/$kernel  2> /dev/null
@@ -180,6 +163,17 @@ handle_kernels()
                        cp -a bootmenu.txt /mnt/ubifs/bootmenu.txt || return 1
                fi
        fi
+       if [ -e autoboot.txt ]
+       then
+               if ! cmp autoboot.txt /mnt/ubifs/autoboot.txt  2> /dev/null
+               then
+                       log "updating autoboot.txt"
+                       cp -a autoboot.txt /mnt/ubifs/autoboot.txt || return 1
+               fi
+       else
+               # get rid of potentially bad autoboot.txt
+               rm -f /mnt/ubifs/autoboot.txt
+       fi
 }
 
 ubiattach /dev/ubi_ctrl -m 3 || true
index ab2c3a3..551b8bf 100644 (file)
@@ -18,3 +18,16 @@ log_err()
        echo -en "\033[0m" > $LOG_DEVICE
 }
 
+wait_for_file()
+{
+       for a in `seq 10`
+       do
+               if test -e "$1"
+               then
+                       return 0
+               fi
+               sleep .5
+       done
+       return 1
+}
+