From c6818be0da433a18f5ebcd0fc9802f176d510cc6 Mon Sep 17 00:00:00 2001 From: Richard Barnette Date: Mon, 1 Aug 2011 13:52:01 -0700 Subject: [PATCH] Revert "Skip filling in kernel partition until cros_make_image_bootable" This reverts commit a966c2bad686f787268f01a7529851a1a2a6ad9b Change-Id: I0990252c34853f7e1884da19b2649ed32e52e078 Reviewed-on: http://gerrit.chromium.org/gerrit/5091 Reviewed-by: Elly Jones Tested-by: Richard Barnette --- bin/cros_make_image_bootable | 6 ++---- build_image | 9 ++++++++- build_library/build_gpt.sh | 9 +++++++-- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/bin/cros_make_image_bootable b/bin/cros_make_image_bootable index a82348f9d0..a3f91c0e22 100755 --- a/bin/cros_make_image_bootable +++ b/bin/cros_make_image_bootable @@ -220,6 +220,8 @@ make_image_bootable() { if="${FLAGS_rootfs_hash}" \ of="${image}" \ conv=notrunc + # We don't need to keep the file around anymore. + sudo rm "${FLAGS_rootfs_hash}" # Move the verification block needed for the hard disk install to the # stateful partition. Mount stateful fs, copy file, and umount fs. @@ -266,10 +268,6 @@ make_image_bootable() { ${bootloader_to_flags} \ $kernel_part - # We don't need to keep these files around anymore. - sudo rm "${FLAGS_rootfs_hash}" "${FLAGS_output_dir}/vmlinuz.image" \ - "${FLAGS_output_dir}/vmlinuz_hd.vblock" - trap - EXIT ${SCRIPTS_DIR}/mount_gpt_image.sh -u -r "${FLAGS_rootfs_mountpoint}" \ -s "${FLAGS_statefulfs_mountpoint}" diff --git a/build_image b/build_image index ad3c54156f..15977272eb 100755 --- a/build_image +++ b/build_image @@ -678,6 +678,11 @@ create_base_image() { # create /usr/local or /var on host (already exist on target). setup_symlinks_on_root "/usr/local" "/var" "${STATEFUL_FS_DIR}" + # 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. + cp "${ROOT_FS_DIR}/boot/vmlinuz" "${OUTPUT_DIR}/vmlinuz.image" + # Create EFI System Partition to boot stock EFI BIOS (but not # ChromeOS EFI BIOS). ARM uses this space to determine which # partition is bootable. NOTE: The size argument for mkfs.vfat is @@ -695,6 +700,7 @@ create_base_image() { # Create the GPT-formatted image. build_gpt "${OUTPUT_DIR}/${image_name}" \ "${ROOT_FS_IMG}" \ + "${OUTPUT_DIR}/vmlinuz.image" \ "${STATEFUL_FS_IMG}" \ "${ESP_FS_IMG}" @@ -897,7 +903,8 @@ if [ ${FLAGS_test} -eq ${FLAGS_TRUE} ] ; then fi # Clean up temporary files. -rm -f "${ROOT_FS_IMG}" "${STATEFUL_FS_IMG}" "${ESP_FS_IMG}" +rm -f "${ROOT_FS_IMG}" "${STATEFUL_FS_IMG}" "${OUTPUT_DIR}/vmlinuz.image" \ + "${ESP_FS_IMG}" "${OUTPUT_DIR}/vmlinuz_hd.vblock" rmdir "${ROOT_FS_DIR}" "${STATEFUL_FS_DIR}" "${ESP_FS_DIR}" # Generating AU generator zip file to run outside chroot diff --git a/build_library/build_gpt.sh b/build_library/build_gpt.sh index 3471235f1a..f23f91b75b 100755 --- a/build_library/build_gpt.sh +++ b/build_library/build_gpt.sh @@ -40,8 +40,9 @@ HEADER build_gpt() { local outdev="$1" local rootfs_img="$2" - local stateful_img="$3" - local esp_img="$4" + local kernel_img="$3" + local stateful_img="$4" + local esp_img="$5" # We'll need some code to put in the PMBR, for booting on legacy BIOS. local pmbr_img @@ -71,6 +72,10 @@ build_gpt() { $sudo dd if="$stateful_img" of="$outdev" conv=notrunc bs=512 \ seek=$START_STATEFUL + echo "Copying kernel..." + $sudo dd if="$kernel_img" of="$outdev" conv=notrunc bs=512 \ + seek=$START_KERN_A + echo "Copying rootfs..." $sudo dd if="$rootfs_img" of="$outdev" conv=notrunc bs=512 \ seek=$START_ROOTFS_A