From e3049de00f257a3333928a0b8dd6585eb11cd246 Mon Sep 17 00:00:00 2001 From: Kenneth Waters Date: Thu, 30 Sep 2010 14:20:34 -0700 Subject: [PATCH] build_image: Merge x86 and ARM where possible. - I looked at all of the x86 and ARM paths through out build image scripts, these changes clean up stale comments, stale code, and unforks some small things. BUG=none TEST=Built images for x86-generic, arm-generic and tegra2-seaboard, booted tegra2-seaboard image. Review URL: http://codereview.chromium.org/3448022 Change-Id: Ibad2774ff2cbf5f15528454506542b87e43e24a2 --- bin/cros_make_image_bootable | 19 +++---------------- build_gpt.sh | 17 +---------------- build_image | 7 +------ create_esp.sh | 3 +-- image_to_usb.sh | 3 --- update_bootloaders.sh | 7 +++---- 6 files changed, 9 insertions(+), 47 deletions(-) diff --git a/bin/cros_make_image_bootable b/bin/cros_make_image_bootable index 8aacf8c913..20c21911d6 100755 --- a/bin/cros_make_image_bootable +++ b/bin/cros_make_image_bootable @@ -86,9 +86,6 @@ DEFINE_integer verity_max_ios 1024 \ DEFINE_string verity_algorithm "sha1" \ "Cryptographic hash algorithm used for kernel vboot." -DEFINE_string arm_extra_bootargs "" \ - "Additional command line options to pass to the ARM kernel." - DEFINE_string keys_dir "/usr/share/vboot/devkeys" \ "Directory containing the signing keys." @@ -199,8 +196,7 @@ make_image_bootable() { sudo dd if="${FLAGS_output_dir}/vmlinuz.image" of="${image}" \ conv=notrunc bs=512 seek=${koffset} - # Update the bootloaders. For legacy/efi x86, the EFI system partition - # will be updated and for arm, the mbr will be updated (for u-boot). + # Update the bootloaders. The EFI system partition will be updated. local kernel_part= local usb_disk="${FLAGS_usb_disk}" @@ -218,17 +214,8 @@ make_image_bootable() { # Install syslinux on the EFI System Partition. kernel_part="${kernel_part} --install_syslinux" elif [[ "${FLAGS_arch}" = "arm" ]]; then - # TODO(wad) mmcblk1p3 is hardcoded for arm for now! - usb_disk="/dev/mmcblk1p3" - # ARM doesn't support using the kernel image for kernel cmdline flags yet. - kernel_part="--kernel_cmdline=\"${FLAGS_arm_extra_bootargs}\" " - # TODO(wad) Integrate dmtable extraction into the arm build - # E.g. $(cat ${FLAGS_output_dir}/boot.config | tr -s '\n' ' ')" - local kpart_offset="--kernel_partition_offset=${koffset}" - local kpart_size="--kernel_partition_sectors=" - kpart_size="${kpart_size}$(partsize ${image} 2)" - kernel_part="${kernel_part} ${kpart_size} ${kpart_offset}" - info "Using addition bootloader arguments: ${kernel_part}" + # These flags are not used for ARM update_bootloaders.sh + kernel_part="" fi # Update partition 12 diff --git a/build_gpt.sh b/build_gpt.sh index 84888a902c..df0f4fc070 100755 --- a/build_gpt.sh +++ b/build_gpt.sh @@ -21,8 +21,6 @@ DEFINE_string arch "" \ "The target architecture (\"arm\" or \"x86\")." DEFINE_string board "$DEFAULT_BOARD" \ "The board to build an image for." -DEFINE_string arm_extra_bootargs "" \ - "Additional command line options to pass to the ARM kernel." DEFINE_integer rootfs_partition_size 1024 \ "rootfs parition size in MBs." @@ -109,8 +107,7 @@ if [ ! -s ${ESP_IMG} ]; then exit 1 fi -# We'll need some code to put in the PMBR, for booting on legacy BIOS. Some ARM -# systems will use a U-Boot script temporarily, but it goes in the same place. +# We'll need some code to put in the PMBR, for booting on legacy BIOS. if [[ "$ARCH" = "arm" ]]; then PMBRCODE=/dev/zero else @@ -122,18 +119,6 @@ fi 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} - DEVICE=1 - MBR_SCRIPT_UIMG=$(make_arm_mbr \ - ${START_KERN_A} \ - ${NUM_KERN_SECTORS} \ - ${DEVICE} \ - "${FLAGS_arm_extra_bootargs}") - sudo dd bs=1 count=`stat --printf="%s" ${MBR_SCRIPT_UIMG}` \ - if="$MBR_SCRIPT_UIMG" of=${OUTDEV} conv=notrunc -fi - # Emit helpful scripts for testers, etc. ${SCRIPTS_DIR}/emit_gpt_scripts.sh "${OUTDEV}" "${IMAGEDIR}" diff --git a/build_image b/build_image index 7620d0af7f..2df9a3cc05 100755 --- a/build_image +++ b/build_image @@ -49,8 +49,6 @@ DEFINE_boolean factory_install ${FLAGS_FALSE} \ is also required in image_to_usb." DEFINE_boolean dev_install ${FLAGS_FALSE} \ "Build a smaller image to overlay the dev recovery install shim on" -DEFINE_string arm_extra_bootargs "" \ - "Additional command line options to pass to the ARM kernel." DEFINE_integer rootfs_partition_size 1024 \ "rootfs partition size in MiBs." DEFINE_integer rootfs_size 720 \ @@ -360,7 +358,6 @@ create_boot_desc() { --verity_algorithm="${FLAGS_verity_algorithm}" --keys_dir="${DEVKEYSDIR}" --usb_disk="${FLAGS_usb_disk}" - --arm_extra_bootargs="${FLAGS_arm_extra_bootargs}" --nocleanup_dirs ${enable_rootfs_verification_flag} EOF @@ -637,8 +634,7 @@ create_base_image() { # cros_make_image_bootable will clobber vmlinuz.image for x86. # Until then, just copy the kernel to vmlinuz.image. It is - # expected in build_gpt.sh and needed by ARM until it supports the - # full, signed kernel partition format. + # expected in build_gpt.sh. cp "${ROOT_FS_DIR}/boot/vmlinuz" "${OUTPUT_DIR}/vmlinuz.image" # Create an empty esp image to be updated in by update_bootloaders.sh. @@ -652,7 +648,6 @@ create_base_image() { ${SCRIPTS_DIR}/build_gpt.sh \ --arch=${ARCH} \ --board=${FLAGS_board} \ - --arm_extra_bootargs="${FLAGS_arm_extra_bootargs}" \ --rootfs_partition_size=${FLAGS_rootfs_partition_size} \ "${OUTPUT_DIR}" \ "${OUTPUT_DIR}/${image_name}" diff --git a/create_esp.sh b/create_esp.sh index 5b345e20e1..261b8de340 100755 --- a/create_esp.sh +++ b/create_esp.sh @@ -26,8 +26,7 @@ fi info "Creating a new esp image at ${FLAGS_to}" anyway. # Create EFI System Partition to boot stock EFI BIOS (but not ChromeOS EFI -# BIOS). We only need this for x86, but it's simpler and safer to keep the -# disk images the same for both x86 and ARM. +# BIOS). ARM uses this space to determine which partition is bootable. # NOTE: The size argument for mkfs.vfat is in 1024-byte blocks. # We'll hard-code it to 16M for now. ESP_BLOCKS=16384 diff --git a/image_to_usb.sh b/image_to_usb.sh index 0bd67ce5ee..f40e57a4a3 100755 --- a/image_to_usb.sh +++ b/image_to_usb.sh @@ -243,15 +243,12 @@ then echo "Installation must be done from inside the chroot." exit 1 fi - #TODO(kwaters): fix when verified root works on ARM - [ "${FLAGS_arch}" = "ARM" ] && SKIP_VBLOCK="--skip_vblock" echo "Installing ${SRC_IMAGE} to ${FLAGS_to}..." "${FLAGS_build_root}/${FLAGS_board}/usr/sbin/chromeos-install" \ --yes \ --skip_src_removable \ --skip_dst_removable \ - ${SKIP_VBLOCK:-} \ --arch="${FLAGS_arch}" \ --payload_image="${SRC_IMAGE}" \ --dst="${FLAGS_to}" diff --git a/update_bootloaders.sh b/update_bootloaders.sh index 7c6b0dd9be..63faaceec8 100755 --- a/update_bootloaders.sh +++ b/update_bootloaders.sh @@ -21,7 +21,7 @@ DEFINE_boolean install_syslinux ${FLAGS_FALSE} \ DEFINE_string from "/tmp/boot" \ "Path the legacy bootloader templates are copied from. (Default /tmp/boot)" DEFINE_string to "/tmp/esp.img" \ - "Path to esp image or ARM output MBR (Default: /tmp/esp.img)" + "Path to esp image (Default: /tmp/esp.img)" DEFINE_integer to_offset 0 \ "Offset in bytes into 'to' if it is a file (Default: 0)" DEFINE_integer to_size -1 \ @@ -39,7 +39,7 @@ DEFINE_string kernel_partition_offset "0" \ DEFINE_string kernel_partition_sectors "0" \ "Kernel partition sectors (Default: 0)" DEFINE_string usb_disk /dev/sdb3 \ - "Path syslinux should use to do a usb (or arm!) boot. Default: /dev/sdb3" + "Path syslinux should use to do a usb boot. Default: /dev/sdb3" # Parse flags FLAGS "$@" || exit 1 @@ -102,8 +102,7 @@ if [[ ! -e "${FLAGS_to}" ]]; then # This shouldn't happen. info "Creating a new esp image at ${FLAGS_to}" anyway. # Create EFI System Partition to boot stock EFI BIOS (but not ChromeOS EFI - # BIOS). We only need this for x86, but it's simpler and safer to keep the - # disk images the same for both x86 and ARM. + # BIOS). ARM uses this space to determine which partition is bootable. # NOTE: The size argument for mkfs.vfat is in 1024-byte blocks. # We'll hard-code it to 16M for now. ESP_BLOCKS=16384