Index: build_image |
diff --git a/build_image b/build_image |
index 6fd3720b3e708fc5f0f4c1ed9b61219348d37387..c4f94dfe4edcc20ead4d5d932707f5e7551d51a0 100755 |
--- a/build_image |
+++ b/build_image |
@@ -403,33 +403,6 @@ create_base_image() { |
sudo tune2fs -L "${DISK_LABEL}" -U "${UUID}" -c 0 -i 0 "${OEM_LOOP_DEV}" |
sudo mount "${OEM_LOOP_DEV}" "${OEM_FS_DIR}" |
- # Turn root file system into bootable image. |
- if [[ "${ARCH}" = "x86" ]]; then |
- # Setup extlinux configuration. |
- # TODO: For some reason the /dev/disk/by-uuid is not being generated by udev |
- # in the initramfs. When we figure that out, switch to root=UUID=${UUID}. |
- sudo mkdir -p "${ROOT_FS_DIR}"/boot |
- # TODO(adlr): use initramfs for booting. |
- cat <<EOF | sudo dd of="${ROOT_FS_DIR}"/boot/extlinux.conf |
-DEFAULT chromeos-usb |
-PROMPT 0 |
-TIMEOUT 0 |
- |
-label chromeos-usb |
- menu label chromeos-usb |
- kernel vmlinuz |
- append quiet console=tty2 init=/sbin/init boot=local rootwait root=/dev/sdb3 ro noresume noswap i915.modeset=1 loglevel=1 cros_legacy |
- |
-label chromeos-hd |
- menu label chromeos-hd |
- kernel vmlinuz |
- append quiet console=tty2 init=/sbin/init boot=local rootwait root=HDROOT ro noresume noswap i915.modeset=1 loglevel=1 cros_legacy |
-EOF |
- |
- # Make partition bootable and label it. |
- sudo extlinux -z --install "${ROOT_FS_DIR}/boot" |
- fi |
- |
# -- Install packages into the root file system -- |
# We need to install libc manually from the cross toolchain. |
@@ -485,29 +458,28 @@ EOF |
fi |
sudo losetup "${ESP_LOOP_DEV}" "${ESP_FS_IMG}" |
sudo mount "${ESP_LOOP_DEV}" "${ESP_FS_DIR}" |
- sudo mkdir -p "${ESP_FS_DIR}/efi/boot" |
- sudo grub-mkimage -p /efi/boot -o "${ESP_FS_DIR}/efi/boot/bootx64.efi" \ |
- part_gpt fat ext2 normal boot sh chain configfile linux |
- cat <<'EOF' | sudo dd of="${ESP_FS_DIR}/efi/boot/grub.cfg" |
-set default=0 |
-set timeout=2 |
- |
-# NOTE: These magic grub variables are a Chrome OS hack. They are not portable. |
- |
-menuentry "local image A" { |
- linux $grubpartA/boot/vmlinuz quiet console=tty2 init=/sbin/init boot=local rootwait root=/dev/$linuxpartA ro noresume noswap i915.modeset=1 loglevel=1 cros_efi |
-} |
-menuentry "local image B" { |
- linux $grubpartB/boot/vmlinuz quiet console=tty2 init=/sbin/init boot=local rootwait root=/dev/$linuxpartB ro noresume noswap i915.modeset=1 loglevel=1 cros_efi |
-} |
- |
-menuentry "Alternate USB Boot" { |
- linux (hd0,3)/boot/vmlinuz quiet console=tty2 init=/sbin/init boot=local rootwait root=/dev/sdb3 ro noresume noswap i915.modeset=1 loglevel=1 cros_efi |
-} |
- |
-EOF |
- # TODO(wad) add baseline syslinux files to ESP and install the syslinux loader |
+ # Populates the root filesystem with legacy bootloader templates |
+ # appropriate for the platform. The autoupdater and installer will |
+ # use those templates to update the legacy boot partition (12/ESP) |
+ # on update. |
+ # (This script does not populate vmlinuz.A and .B needed by syslinux.) |
+ use_vboot= |
+ ${SCRIPTS_DIR}/create_legacy_bootloader_templates.sh \ |
+ --arch=${ARCH} \ |
+ --to="${ROOT_FS_DIR}"/boot \ |
+ --install \ |
+ ${use_vboot} |
+ |
+ # Create a working copy so we don't need the rootfs mounted |
+ sudo mkdir -p "${OUTPUT_DIR}"/boot |
+ # This will include any built files dropped in /boot as well. |
+ # Like the current vmlinuz. |
+ sudo cp -r "${ROOT_FS_DIR}"/boot/. "${OUTPUT_DIR}"/boot/ |
+ |
+ # Until bootloader management is unified, copy EFI in here. |
+ sudo mkdir -p "${ESP_FS_IMG}"/efi |
+ sudo cp -r "${ROOT_FS_DIR}"/boot/efi/. "${ESP_FS_IMG}"/efi |
# Builds the kernel partition image. The temporary files are kept around |
# so that we can perform a load_kernel_test later on the final image. |