From 0d5f948934580855f2e5cce3b529b888013be8b4 Mon Sep 17 00:00:00 2001 From: Tan Gao Date: Fri, 6 Aug 2010 08:28:20 -0700 Subject: [PATCH] clean up install_gpt args to use number of sectors Change-Id: I7d17db3cb522a52ec2dac688f4bf83fb5ae6a2d1 related CL: http://codereview.chromium.org/3031049/show TEST=(1)Manually built an image using build_image script, which exercised "build_gpt.sh"; (2) manually built a Qemu VM image using "image_to_vm.sh" and verified the VM is bootable (up to login screen); (3) manually built a dev recovery image using "mod_image_for_dev_recovery.sh" and verified image functions properly for dev recovery purpose Review URL: http://codereview.chromium.org/3050039 --- build_gpt.sh | 4 ++-- image_to_vm.sh | 5 +++-- mod_image_for_dev_recovery.sh | 5 +++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/build_gpt.sh b/build_gpt.sh index 8247f65c68..84888a902c 100755 --- a/build_gpt.sh +++ b/build_gpt.sh @@ -119,8 +119,8 @@ fi # Create the GPT. This has the side-effect of setting some global vars # describing the partition table entries (see the comments in the source). -install_gpt $OUTDEV $ROOTFS_IMG $STATEFUL_IMG $PMBRCODE $ESP_IMG \ - false $FLAGS_rootfs_partition_size +install_gpt $OUTDEV $(numsectors $ROOTFS_IMG) $(numsectors $STATEFUL_IMG) \ + $PMBRCODE $(numsectors $ESP_IMG) false $FLAGS_rootfs_partition_size if [[ "$ARCH" = "arm" ]]; then # assume /dev/mmcblk1. we could not get this from ${OUTDEV} diff --git a/image_to_vm.sh b/image_to_vm.sh index ac8f648c99..f1b977705b 100755 --- a/image_to_vm.sh +++ b/image_to_vm.sh @@ -229,8 +229,9 @@ sudo dd if=/dev/zero of="${TEMP_IMG}" bs=1 count=1 \ seek=$((${FLAGS_vdisk_size} * 1024 * 1024 - 1)) # Set up the partition table -install_gpt "${TEMP_IMG}" "${TEMP_ROOTFS}" "${TEMP_STATE}" \ - "${TEMP_PMBR}" "${TEMP_ESP}" false ${FLAGS_rootfs_partition_size} +install_gpt "${TEMP_IMG}" "$(numsectors $TEMP_ROOTFS)" \ + "$(numsectors $TEMP_STATE)" "${TEMP_PMBR}" "$(numsectors $TEMP_ESP)" \ + false ${FLAGS_rootfs_partition_size} # Copy into the partition parts of the file dd if="${TEMP_ROOTFS}" of="${TEMP_IMG}" conv=notrunc bs=512 \ seek="${START_ROOTFS_A}" diff --git a/mod_image_for_dev_recovery.sh b/mod_image_for_dev_recovery.sh index 1a13047ea4..3ff2161335 100755 --- a/mod_image_for_dev_recovery.sh +++ b/mod_image_for_dev_recovery.sh @@ -115,8 +115,9 @@ update_partition_table() { dd if="${FLAGS_dev_install_shim}" of="${TEMP_PMBR}" bs=512 count=1 # Set up a new partition table - install_gpt "${TEMP_IMG}" "${TEMP_ROOTFS}" "${TEMP_STATE}" "${TEMP_PMBR}" \ - "${TEMP_ESP}" false $(roundup $(numsectors ${TEMP_ROOTFS})) + install_gpt "${TEMP_IMG}" "$(numsectors $TEMP_ROOTFS)" \ + "$(numsectors $TEMP_STATE)" "${TEMP_PMBR}" "$(numsectors $TEMP_ESP)" \ + false $(roundup $(numsectors ${TEMP_ROOTFS})) # Copy into the partition parts of the file dd if="${TEMP_ROOTFS}" of="${TEMP_IMG}" conv=notrunc bs=512 \