From 59c90bfb389f06dcf0be6b789d5c091e44e53bc9 Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Thu, 14 Nov 2013 15:00:37 -0800 Subject: [PATCH 1/4] fix(pvgrub): Disable support for gptprio root detection/fallback. This scheme only works robustly with kexec. Until the happy day that kexec is supported on Xen (or when Xen is dead, long live Xen!) we shouldn't bother trying. This allows us to use kernel modules again. --- .../create_legacy_bootloader_templates.sh | 23 ++++--------------- 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/build_library/create_legacy_bootloader_templates.sh b/build_library/create_legacy_bootloader_templates.sh index ed05c5f5b1..b69fab1076 100755 --- a/build_library/create_legacy_bootloader_templates.sh +++ b/build_library/create_legacy_bootloader_templates.sh @@ -52,39 +52,26 @@ if [[ "${FLAGS_arch}" = "x86" || "${FLAGS_arch}" = "amd64" ]]; then # Add hvc0 for hypervisors grub_args="${common_args} console=hvc0" - cat </dev/null + sudo_clobber "${GRUB_DIR}/menu.lst.A" </dev/null + sudo_clobber "${GRUB_DIR}/menu.lst.B" <> ${GRUB_DIR}/menu.lst.B" + sudo_append "${GRUB_DIR}/menu.lst.B" <"${GRUB_DIR}/menu.lst.A" 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/. SYSLINUX_DIR="${FLAGS_to}/syslinux" sudo mkdir -p "${SYSLINUX_DIR}" From 23b1b01f1ae7c3bd3dde710e85ea9e8482df9ad6 Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Tue, 19 Nov 2013 18:41:27 -0800 Subject: [PATCH 2/4] fix(syslinux): Apply sudo_clobber fix to syslinux configs. Already cleaned up the contrived cat/dd combo for the pvgrub configs, do the same for the syslinux configs. --- build_library/create_legacy_bootloader_templates.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/build_library/create_legacy_bootloader_templates.sh b/build_library/create_legacy_bootloader_templates.sh index b69fab1076..11902f9dc1 100755 --- a/build_library/create_legacy_bootloader_templates.sh +++ b/build_library/create_legacy_bootloader_templates.sh @@ -79,7 +79,7 @@ EOF # This leaves /dev/console mapped to tty0 (vga) which is reasonable default. syslinux_args="console=ttyS0,115200n8 ${common_args}" - cat </dev/null + sudo_clobber "${SYSLINUX_DIR}/syslinux.cfg" </dev/null + sudo_clobber "${SYSLINUX_DIR}/boot_kernel.cfg" </dev/null + + sudo_clobber "${SYSLINUX_DIR}/root.A.cfg" </dev/null + sudo_clobber "${SYSLINUX_DIR}/root.B.cfg" < Date: Tue, 19 Nov 2013 21:40:40 -0800 Subject: [PATCH 3/4] fix(pvgrub): Stick root's copy of the configs in /boot/grub Previously this was in /boot/grub/grub which was probably by mistake. --- build_library/create_legacy_bootloader_templates.sh | 2 +- update_bootloaders.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build_library/create_legacy_bootloader_templates.sh b/build_library/create_legacy_bootloader_templates.sh index 11902f9dc1..c4dd64a08b 100755 --- a/build_library/create_legacy_bootloader_templates.sh +++ b/build_library/create_legacy_bootloader_templates.sh @@ -46,7 +46,7 @@ if [[ "${FLAGS_arch}" = "x86" || "${FLAGS_arch}" = "amd64" ]]; then ROOTB="PARTUUID=$(get_uuid base ROOT-B)" # Build configuration files for pygrub/pvgrub - GRUB_DIR="${FLAGS_to}/boot/grub" + GRUB_DIR="${FLAGS_to}/grub" sudo mkdir -p "${GRUB_DIR}" # Add hvc0 for hypervisors diff --git a/update_bootloaders.sh b/update_bootloaders.sh index 24b2d6e9d9..184c0335e8 100755 --- a/update_bootloaders.sh +++ b/update_bootloaders.sh @@ -101,8 +101,8 @@ if [[ "${FLAGS_arch}" = "x86" || "${FLAGS_arch}" = "amd64" ]]; then # Copy over the grub configurations for cloud machines and the # kernel into both the A and B slot sudo mkdir -p "${ESP_FS_DIR}"/boot/grub - sudo cp -r "${FLAGS_from}"/boot/grub/. "${ESP_FS_DIR}"/boot/grub - sudo cp -r "${FLAGS_from}"/boot/grub/menu.lst.A "${ESP_FS_DIR}"/boot/grub/menu.lst + sudo cp -r "${FLAGS_from}"/grub/. "${ESP_FS_DIR}"/boot/grub + sudo cp -r "${FLAGS_from}"/grub/menu.lst.A "${ESP_FS_DIR}"/boot/grub/menu.lst # Prepopulate the syslinux directories too and update for verified boot values # after the rootfs work is done. From 1807fa2978431352ccc1274ab60189e8709fe1b5 Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Tue, 19 Nov 2013 21:42:28 -0800 Subject: [PATCH 4/4] cleanup(update_bootloaders.sh): Remove dead code. --- update_bootloaders.sh | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/update_bootloaders.sh b/update_bootloaders.sh index 184c0335e8..41092cfd7a 100755 --- a/update_bootloaders.sh +++ b/update_bootloaders.sh @@ -19,9 +19,6 @@ assert_inside_chroot # Flags. DEFINE_string arch "x86" \ "The boot architecture: arm or x86. (Default: x86)" -# TODO(wad) once extlinux is dead, we can remove this. -DEFINE_boolean install_syslinux ${FLAGS_TRUE} \ - "Controls whether syslinux is run on 'to'. (Default: true)" DEFINE_string from "/tmp/boot" \ "Path the legacy bootloader templates are copied from. (Default /tmp/boot)" DEFINE_string to "/tmp/esp.img" \ @@ -119,27 +116,12 @@ if [[ "${FLAGS_arch}" = "x86" || "${FLAGS_arch}" = "amd64" ]]; then sudo mkdir -p "${ESP_FS_DIR}"/EFI/boot sudo cp -f "${FLAGS_vmlinuz}" "${ESP_FS_DIR}"/EFI/boot/bootx64.efi - # Extract kernel flags - kernel_cfg="cros_debug" - old_root="%U+1" - - # Install the syslinux loader on the ESP image (part 12) so it is ready when - # we cut over from rootfs booting (extlinux). - if [[ ${FLAGS_install_syslinux} -eq ${FLAGS_TRUE} ]]; then - safe_umount "${ESP_FS_DIR}" - sudo syslinux -d /syslinux "${ESP_DEV}" - # mount again for cleanup to free resource gracefully - sudo mount -o ro "${ESP_DEV}" "${ESP_FS_DIR}" - fi -elif [[ "${FLAGS_arch}" = "arm" ]]; then - # Copy u-boot script to ESP partition - if [ -r "${FLAGS_from}/boot-A.scr.uimg" ]; then - sudo mkdir -p "${ESP_FS_DIR}/u-boot" - sudo cp "${FLAGS_from}/boot-A.scr.uimg" \ - "${ESP_FS_DIR}/u-boot/boot.scr.uimg" - sudo cp -f "${FLAGS_from}"/vmlinuz "${ESP_FS_DIR}"/vmlinuz.uimg.A - sudo cp -f "${FLAGS_from}"/zImage "${ESP_FS_DIR}"/vmlinuz.A - fi + safe_umount "${ESP_FS_DIR}" + sudo syslinux -d /syslinux "${ESP_DEV}" + # mount again for cleanup to free resource gracefully + sudo mount -o ro "${ESP_DEV}" "${ESP_FS_DIR}" +else + die "Unknown arch ${FLAGS_arch}" fi set +e