diff --git a/bin/cros_make_image_bootable b/bin/cros_make_image_bootable index 2a89df9215..70d42c4c8f 100755 --- a/bin/cros_make_image_bootable +++ b/bin/cros_make_image_bootable @@ -232,6 +232,7 @@ make_image_bootable() { --arch=${FLAGS_arch} \ --to="${bootloader_to}" \ --from="${FLAGS_rootfs_mountpoint}"/boot \ + --vmlinuz_boot_kernel="${FLAGS_rootfs_mountpoint}"/boot/vmlinuz-boot_kernel \ --vmlinuz="${FLAGS_rootfs_mountpoint}"/boot/vmlinuz \ ${bootloader_to_flags} diff --git a/build_library/create_legacy_bootloader_templates.sh b/build_library/create_legacy_bootloader_templates.sh index d20ca6a91c..796cf6ca81 100755 --- a/build_library/create_legacy_bootloader_templates.sh +++ b/build_library/create_legacy_bootloader_templates.sh @@ -72,6 +72,10 @@ if [[ "${FLAGS_arch}" = "x86" || "${FLAGS_arch}" = "amd64" ]]; then cat </dev/null timeout 0 +title CoreOS bootengine +root (hd0,0) +kernel /syslinux/vmlinuz-boot_kernel ${common_args} root=gptprio: cros_legacy + title CoreOS A root (hd0,0) kernel /syslinux/vmlinuz.A ${common_args} root=${ROOTA} cros_legacy @@ -82,12 +86,8 @@ kernel /syslinux/vmlinuz.B ${common_args} root=${ROOTB} cros_legacy EOF info "Emitted ${GRUB_DIR}/menu.lst.A" - cat </dev/null -default 1 -EOF - sudo sh -c "cat ${GRUB_DIR}/menu.lst.A >> ${GRUB_DIR}/menu.lst.B" + sudo cp ${GRUB_DIR}/menu.lst.A ${GRUB_DIR}/menu.lst.B info "Emitted ${GRUB_DIR}/menu.lst.B" - sudo cp ${GRUB_DIR}/menu.lst.A ${GRUB_DIR}/menu.lst # /boot/syslinux must be installed in partition 12 as /syslinux/. @@ -97,9 +97,9 @@ EOF cat </dev/null PROMPT 0 TIMEOUT 0 +DEFAULT boot_kernel -# the actual target -include /syslinux/default.cfg +include /syslinux/boot_kernel.cfg # coreos.A include /syslinux/root.A.cfg @@ -109,15 +109,16 @@ include /syslinux/root.B.cfg EOF info "Emitted ${SYSLINUX_DIR}/syslinux.cfg" - # To change the active target, only this file needs to change. - cat </dev/null -DEFAULT coreos.A -EOF - info "Emitted ${SYSLINUX_DIR}/default.cfg" - # Different files are used so that the updater can only touch the file it # needs to for a given change. This will minimize any potential accidental # updates issues, hopefully. + cat </dev/null +label boot_kernel + menu label boot_kernel + kernel vmlinuz-boot_kernel + append ${common_args} root=gptprio: cros_legacy +EOF + info "Emitted ${SYSLINUX_DIR}/boot_kernel.cfg" cat </dev/null label coreos.A menu label coreos.A diff --git a/update_bootloaders.sh b/update_bootloaders.sh index afe1bd95da..2144b180e7 100755 --- a/update_bootloaders.sh +++ b/update_bootloaders.sh @@ -32,6 +32,8 @@ DEFINE_integer to_size -1 \ "Size in bytes of 'to' to use if it is a file. -1 is ignored. (Default: -1)" DEFINE_string vmlinuz "/tmp/vmlinuz" \ "Path to the vmlinuz file to use (Default: /tmp/vmlinuz)" +DEFINE_string vmlinuz_boot_kernel "/tmp/vmlinuz-boot_kernel" \ + "Path to the vmlinuz-boot_kernel file to use (Default: /tmp/vmlinuz)" # Parse flags FLAGS "$@" || exit 1 @@ -108,6 +110,7 @@ if [[ "${FLAGS_arch}" = "x86" || "${FLAGS_arch}" = "amd64" ]]; then sudo cp -r "${FLAGS_from}"/syslinux/. "${ESP_FS_DIR}"/syslinux # Stage both kernels with the only one we built. + sudo cp -f "${FLAGS_vmlinuz_boot_kernel}" "${ESP_FS_DIR}"/syslinux/vmlinuz-boot_kernel sudo cp -f "${FLAGS_vmlinuz}" "${ESP_FS_DIR}"/syslinux/vmlinuz.A sudo cp -f "${FLAGS_vmlinuz}" "${ESP_FS_DIR}"/syslinux/vmlinuz.B