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
This commit is contained in:
Kenneth Waters 2010-09-30 14:20:34 -07:00
parent b5ab343a0d
commit e3049de00f
6 changed files with 9 additions and 47 deletions

View File

@ -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

View File

@ -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}"

View File

@ -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}"

View File

@ -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

View File

@ -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}"

View File

@ -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