From 9ef5915d399e42de8e40be939a2ec181cb67c307 Mon Sep 17 00:00:00 2001 From: Xiangfu Liu Date: Wed, 2 Mar 2011 11:46:28 +0800 Subject: [PATCH] reflash_ben.sh, new option b k r, reboot device after reflash --- data/qi_lb60/scripts/reflash_ben.sh | 37 ++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/data/qi_lb60/scripts/reflash_ben.sh b/data/qi_lb60/scripts/reflash_ben.sh index fd44ef7f8..6796a66f6 100755 --- a/data/qi_lb60/scripts/reflash_ben.sh +++ b/data/qi_lb60/scripts/reflash_ben.sh @@ -1,6 +1,6 @@ #!/bin/bash # version of me -__VERSION__="2011-11-20" +__VERSION__="2011-03-02" # use 'http' to download and flash images, use 'file' to flash images present in the PROTOCOL="http" @@ -20,11 +20,12 @@ KERNEL="openwrt-xburst-qi_lb60-uImage.bin" ROOTFS="openwrt-xburst-qi_lb60-root.ubi" # options for reflash bootloader, kernel, rootfs -B="TRUE" -K="TRUE" -R="TRUE" +B="FALSE" +K="FALSE" +R="FALSE" +ALL="TRUE" -while getopts d:l:h OPTIONS +while getopts d:l:hbkr OPTIONS do case $OPTIONS in d) @@ -35,6 +36,18 @@ do PROTOCOL="file" VERSION="Local" ;; + b) + ALL="FALSE" + B="TRUE" + ;; + k) + ALL="FALSE" + K="TRUE" + ;; + r) + ALL="FALSE" + R="TRUE" + ;; *) echo "\ @@ -60,6 +73,12 @@ Please report bugs to developer@lists.qi-hardware.com" esac done +if [ "$ALL" == "TRUE" ]; then + B="TRUE" + K="TRUE" + R="TRUE" +fi + # where the verbose output goes to LOG_FILE="${WORKING_DIR}/log.txt" @@ -198,7 +217,7 @@ if [ "$K" == "TRUE" ]; then fi if [ "$R" == "TRUE" ]; then log "erase nand rootfs partition..." - usbboot -c "boot;nerase 16 1024 0 0" >> "${LOG_FILE}" 2>&1 + usbboot -c "nerase 16 1024 0 0" >> "${LOG_FILE}" 2>&1 log "flashing rootfs..." progress_prepare while read ILINE @@ -207,4 +226,10 @@ if [ "$R" == "TRUE" ]; then progress_finish test "${tmp}" && abort "error while flashing rootfs:\n${tmp}" fi + +if [ "$ALL" == "TRUE" ]; then + log "reboot device..." + usbboot -c "reset" >> "${LOG_FILE}" 2>&1 +fi + log "done"