Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(317)

Unified Diff: factory_install.sh

Issue 6708106: Fix factory installer for ARM platforms (Closed) Base URL: ssh://gitrw.chromium.org:9222/factory_installer.git@master
Patch Set: Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | factory_reset.sh » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: factory_install.sh
diff --git a/factory_install.sh b/factory_install.sh
index 9d88e6caa6db4ab855cf369e8a305d2120f6a6a0..ac6fc21d90efbd6013991521498f933fcf93f2bc 100644
--- a/factory_install.sh
+++ b/factory_install.sh
@@ -89,7 +89,8 @@ fi
log "Waiting for ethernet connectivity to install"
log "Or disable developer mode to factory reset."
-while ! ifconfig eth0 | grep -q "inet addr"; do
+while ! ifconfig eth0 | grep -q "inet addr" && \
Hung-Te 2011/03/29 12:57:34 Why do we want two inet devices? And, you don't ne
Nick Sanders 2011/03/30 00:10:44 This indicates, "loop until either eth0 or eth1 is
Che-Liang Chiou 2011/03/30 08:57:44 I changed this part, and hope that it would be mor
+ ! ifconfig eth1 | grep -q "inet addr"; do
# If developer switch is flipped, go to "reset mode" instead of
# network install mode. Make sure gpio can be read (gpio_setup may
# fail if the device is not ready).
@@ -105,13 +106,28 @@ while ! ifconfig eth0 | grep -q "inet addr"; do
fi
sleep 1
done
-log "$(ifconfig eth0 | grep 'inet addr')"
+log "eth0: $(ifconfig eth0 | grep 'inet addr')"
+log "eth1: $(ifconfig eth1 | grep 'inet addr')"
set_time || exit 1
-# TODO(adlr): pick an install device in a matter that works on x86 and ARM.
-# This works on x86 only, afaik.
-DST_DRIVE=/dev/sda
+# Is there a better x86 test?
+if uname -m | grep -q "^i.86\$"; then
+ ARCH="INTEL"
+elif [ $(uname -m ) = "x86_64" ]; then
+ ARCH="INTEL"
+elif [ $(uname -m ) = "armv7l" ]; then
Hung-Te 2011/03/29 12:57:34 So we only support v71?
+ ARCH="ARM"
+else
Nick Sanders 2011/03/30 00:10:44 This has been an annoying problem in general: http
+ log "Error: Failed to auto detect architecture"
+ exit 1
+fi
+
+if [ "$ARCH" = "INTEL" ]; then
+ DST_DRIVE=/dev/sda
+else
+ DST_DRIVE=/dev/mmcblk0
+fi
DST_FACTORY_PART=3
DST_RELEASE_PART=5
DST_OEM_PART=8
@@ -121,7 +137,7 @@ DST_FIRMWARE=/tmp/firmware.sh
# Light up screen in case you can't see our splash image.
LIGHTUP_SCREEN="/usr/sbin/lightup_screen"
-if [ -x /usr/sbin/lightup_screen ]; then
+if [ -x "${LIGHTUP_SCREEN}" ]; then
${LIGHTUP_SCREEN}
else
log "${LIGHTUP_SCREEN} does not exist or not executable"
@@ -155,6 +171,7 @@ fi
sync
echo 3 > /proc/sys/vm/drop_caches
/sbin/sfdisk -R "$DST_DRIVE"
+partprobe # inform the OS of partition table changes
log "Done preparing disk"
@@ -171,7 +188,7 @@ for i in EFI OEM STATE RELEASE FACTORY FIRMWARE; do
DST="${DST_FIRMWARE}"
else
PART=$(eval "echo \$DST_${i}_PART")
- DST="${DST_DRIVE}${PART}"
+ DST="$(make_partition_dev ${DST_DRIVE} ${PART})"
fi
log "Factory Install: Installing $i image to $DST"
@@ -216,8 +233,10 @@ done
if ! cgpt add -i $((${DST_RELEASE_PART} - 1)) -P 0 -T 0 -S 0 ${DST_DRIVE}; then
log "Factory Install: failed to lock release image. Destroy all kernels."
# Destroy kernels otherwise the system is still bootable.
- dd if=/dev/zero of=${DST_DRIVE}$((${DST_RELEASE_PART} - 1))
- dd if=/dev/zero of=${DST_DRIVE}$((${DST_FACTORY_PART} - 1))
+ DST_RELEASE=$(make_partition_dev ${DST_DRIVE} $((${DST_RELEASE_PART} - 1)))
+ DST_FACTORY=$(make_partition_dev ${DST_DRIVE} $((${DST_FACTORY_PART} - 1)))
+ dd if=/dev/zero of=$DST_RELEASE
+ dd if=/dev/zero of=$DST_FACTORY
exit 1
fi
« no previous file with comments | « no previous file | factory_reset.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698