From 7344816517e646fdaac97acb5bcb2065e6bde9ed Mon Sep 17 00:00:00 2001 From: Yongqin Liu Date: Thu, 24 Jan 2013 17:51:45 +0800 Subject: All: add check for mount and boot partition 1. add check for the mount result 2. add check for the existence of boot partition 3. add remount for update modules Change-Id: I0e6260e5fdec16309b92dd57f161b15eb8de0648 Signed-off-by: Yongqin Liu --- update-android.sh | 33 +++++++++++++++++++++++++++------ update-uInitrd.sh | 11 +++++++++++ 2 files changed, 38 insertions(+), 6 deletions(-) diff --git a/update-android.sh b/update-android.sh index 858dea6..f6cef0e 100755 --- a/update-android.sh +++ b/update-android.sh @@ -92,21 +92,21 @@ function check_device_status(){ function get_boot_partition(){ product_device=`adb shell getprop ro.product.device|sed 's/\r//g'` - case "X${product_device}" in - "X" ) + case "X${product_device}Y" in + "XY" ) echo "Failed to get the value of ro.build.product property" exit 1 ;; - "Xpandaboard" ) + "XpandaboardY" ) boot_partition="mmcblk0p1" ;; - "Xorigen" ) + "XorigenY" ) boot_partition="mmcblk0p2" ;; - "Xvexpress_a9" ) + "Xvexpress_a9Y" ) boot_partition="mmcblk0p1" ;; - "Xvexpress" ) + "XvexpressY" ) boot_partition="mmcblk0p1" ;; * ) @@ -114,6 +114,12 @@ function get_boot_partition(){ exit 1 ;; esac + adb shell ls "/dev/block/${boot_partition}"|grep "/dev/block/${boot_partition}" >&/dev/null + if [ $? -ne 0 ]; then + echo "Failed to get the boot partition of your device." + echo "Please specify the boot partition with the -p option." + exit 1 + fi } function verify_kernel(){ @@ -156,6 +162,16 @@ function update_modules(){ modules_org=`mktemp -u -d /tmp/modules.XXX` echo "Pull the original module files for backup in ${modules_org}" adb pull ${tgt_dir} ${modules_org} &>/dev/null + if [ $? -ne 0 ]; then + echo "Failed to pull the original module file from /system/modules of device($ANDROID_SERIAL)" + exit 1 + fi + + adb remount + if [ $? -ne 0 ]; then + echo "Faile to run [adb remount] for the device($ANDROID_SERIAL)." + exit 1 + fi all_modules=`find ${file_path}/ -type f -name '*.ko'` OLD_LFS="${LFS}" @@ -183,6 +199,11 @@ function update_kernel(){ get_boot_partition fi adb shell mount -t vfat /dev/block/${boot_partition} ${mountpoint} + adb shell mount|grep "/dev/block/${boot_partition}" >&/dev/null + if [ $? -ne 0 ]; then + echo "Failed to mount the boot partion /dev/block/${boot_partition}" + exit 1 + fi kernel_org=`mktemp -u -d /tmp/boot.XXX` echo "Pull the original kernel files for backup in ${kernel_org}" diff --git a/update-uInitrd.sh b/update-uInitrd.sh index 9abe236..a9abf02 100755 --- a/update-uInitrd.sh +++ b/update-uInitrd.sh @@ -120,6 +120,12 @@ function get_boot_partition(){ exit 1 ;; esac + adb shell ls "/dev/block/${boot_partition}"|grep "/dev/block/${boot_partition}" >&/dev/null + if [ $? -ne 0 ]; then + echo "Failed to get the boot partition of your device." + echo "Please specify the boot partition with the -p option." + exit 1 + fi } function recreate_uinitrd(){ @@ -155,6 +161,11 @@ function update_uinitrd(){ get_boot_partition fi adb shell mount -t vfat /dev/block/${boot_partition} ${mountpoint} + adb shell mount|grep "/dev/block/${boot_partition}" >&/dev/null + if [ $? -ne 0 ]; then + echo "Failed to mount the boot partion /dev/block/${boot_partition}" + exit 1 + fi org_uinitrd=`mktemp -d /tmp/uinitrd.XXX` echo "Pull the original uInitrd file for backup in ${org_uinitrd}" -- cgit v1.2.3