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

Unified Diff: src/platform/installer/chromeos-install

Issue 1618013: add install to arm platform (Closed)
Patch Set: unfork the make pmbr code Created 10 years, 8 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 | « src/platform/installer/chromeos-common.sh ('k') | src/scripts/build_gpt.sh » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/platform/installer/chromeos-install
diff --git a/src/platform/installer/chromeos-install b/src/platform/installer/chromeos-install
index 005f73c74b231b942845443f63409500046a12ff..fc5f5c25f1d0e702b73093416d3f57abfea94ce6 100755
--- a/src/platform/installer/chromeos-install
+++ b/src/platform/installer/chromeos-install
@@ -9,7 +9,13 @@
. "$(dirname "$0")/chromeos-common.sh" || exit 1
. /usr/lib/shflags || exit 1
-DEFINE_string dst "/dev/sda" "Destination device"
+if [ $(uname -m) = "armv7l" ]; then
+ DEFAULT_DST=/dev/mmcblk0
+else
+ DEFAULT_DST=/dev/sda
+fi
+
+DEFINE_string dst "${DEFAULT_DST}" "Destination device"
DEFINE_boolean skip_src_removable ${FLAGS_FALSE} \
"Skip check to ensure source is removable"
DEFINE_boolean skip_rootfs ${FLAGS_FALSE} \
@@ -38,8 +44,8 @@ fi
# First find the root partition that we are installing from and verify it.
ROOTDEV=$(rootdev)
-# Remove numbers at end of rootfs device.
-SRC=${ROOTDEV%%[0-9]*}
+# From root partition to root block device.
+SRC=$(get_block_dev_from_partition_dev ${ROOTDEV})
REMOVABLE=$(cat /sys/block/${SRC#/dev/}/removable)
if [ "$FLAGS_skip_src_removable" -eq "${FLAGS_FALSE}" -a "$REMOVABLE" != "1" ]
then
@@ -180,18 +186,29 @@ install_rootfs() {
##############################################################################
# What do we expect & require to have on the source device?
-STATEFUL_IMG=${SRC}1
-KERNEL_IMG=${SRC}2
-ROOTFS_IMG=${SRC}3
-ESP_IMG=${SRC}4
-
-# Steal the PMBR code from the source MBR to put on the dest MBR, for booting
-# on legacy-BIOS devices.
-sudo dd if=$SRC of=$PMBRCODE bs=512 count=1
+STATEFUL_IMG=$(make_partition_dev ${SRC} 1)
+KERNEL_IMG=$(make_partition_dev ${SRC} 2)
+ROOTFS_IMG=$(make_partition_dev ${SRC} 3)
+ESP_IMG=$(make_partition_dev ${SRC} 4)
+
+if [ $(uname -m) = "armv7l" ]; then
+ PMBRCODE=/dev/zero
+else
+ # Steal the PMBR code from the source MBR to put on the dest MBR, for booting
+ # on legacy-BIOS devices.
+ sudo dd if=$SRC of=$PMBRCODE bs=512 count=1
+fi
# Create the GPT.
install_gpt $FLAGS_dst $ROOTFS_IMG $KERNEL_IMG $STATEFUL_IMG $PMBRCODE $ESP_IMG
+if [ $(uname -m) = "armv7l" ]; then
+ DEVICE=$(echo $FLAGS_dst | sed -e 's/^.*\([0-9]\)$/\1/')
+ MBR_SCRIPT_UIMG=$(make_arm_mbr ${START_KERN_A} ${NUM_KERN_SECTORS} ${DEVICE})
+ sudo dd bs=1 count=`stat --printf="%s" ${MBR_SCRIPT_UIMG}` \
+ if="$MBR_SCRIPT_UIMG" of=${FLAGS_dst} conv=notrunc
+fi
+
if [ "$FLAGS_skip_rootfs" -eq "$FLAGS_TRUE" ]; then
echo Done installing partitons.
exit 0
@@ -211,35 +228,39 @@ install_rootfs ${ROOTFS_IMG} ${FLAGS_dst} ${START_ROOTFS_B} "H-ROOT-B"
echo "Copying ESP..."
sudo dd if=${ESP_IMG} of=${FLAGS_dst} conv=notrunc bs=512 seek=${START_ESP}
-# We can't guarantee that the kernel will see the new partition table, so we
-# can't use it directly. We could force the kernel to reload it with an ioctl,
-# but then we might have the UI mounting and displaying any old filesystems
-# left over from the last install, and we don't want that either. So any access
-# that we need to do to the destination partitions will have to go through loop
-# devices.
-
-# Now run the postinstall script in each new rootfs. Note that even though
-# we're passing the new destination partition number as an arg, the postinst
-# script had better not try to access it, for the reasons we just gave.
-loop_offset_setup ${FLAGS_dst} ${START_ROOTFS_A}
-trap loop_offset_cleanup EXIT
-mount_on_loop_dev
-trap my_cleanup EXIT
-sudo ${TMPMNT}/postinst ${FLAGS_dst}3
-umount_from_loop_dev
-trap loop_offset_cleanup EXIT
-loop_offset_cleanup
-trap - EXIT
+if [ $(uname -m) != "armv7l" ]; then
-loop_offset_setup ${FLAGS_dst} ${START_ROOTFS_B}
-trap loop_offset_cleanup EXIT
-mount_on_loop_dev
-trap my_cleanup EXIT
-sudo ${TMPMNT}/postinst ${FLAGS_dst}5
-umount_from_loop_dev
-trap loop_offset_cleanup EXIT
-loop_offset_cleanup
-trap - EXIT
+ # We can't guarantee that the kernel will see the new partition table, so we
+ # can't use it directly. We could force the kernel to reload it with an ioctl,
+ # but then we might have the UI mounting and displaying any old filesystems
+ # left over from the last install, and we don't want that either. So any access
piman 2010/04/12 21:59:02 80 chars
+ # that we need to do to the destination partitions will have to go through loop
piman 2010/04/12 21:59:02 80 chars
+ # devices.
+
+ # Now run the postinstall script in each new rootfs. Note that even though
+ # we're passing the new destination partition number as an arg, the postinst
+ # script had better not try to access it, for the reasons we just gave.
+ loop_offset_setup ${FLAGS_dst} ${START_ROOTFS_A}
+ trap loop_offset_cleanup EXIT
+ mount_on_loop_dev
+ trap my_cleanup EXIT
+ sudo ${TMPMNT}/postinst $(make_partition_dev ${FLAGS_dst} 3)
+ umount_from_loop_dev
+ trap loop_offset_cleanup EXIT
+ loop_offset_cleanup
+ trap - EXIT
+
+ loop_offset_setup ${FLAGS_dst} ${START_ROOTFS_B}
+ trap loop_offset_cleanup EXIT
+ mount_on_loop_dev
+ trap my_cleanup EXIT
+ sudo ${TMPMNT}/postinst $(make_partition_dev ${FLAGS_dst} 5)
+ umount_from_loop_dev
+ trap loop_offset_cleanup EXIT
+ loop_offset_cleanup
+ trap - EXIT
+
+fi
echo "Installing the stateful partition..."
loop_offset_setup $FLAGS_dst $START_STATEFUL
@@ -261,6 +282,11 @@ fi
loop_offset_cleanup
trap - EXIT
+if grep "vogue" /etc/lsb-release > /dev/null; then
+ sudo uboot-env.py -f /dev/mtdblock0 -o 0x7c000 -s 0x4000 \
+ --set bootcmd="mmc read 0 C0008000 0 1; autoscr C0008000"
+fi
+
# Force data to disk before we declare done.
sync
« no previous file with comments | « src/platform/installer/chromeos-common.sh ('k') | src/scripts/build_gpt.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698