From 0479480ef1696f9d86bea8dae6262ef5559f5e19 Mon Sep 17 00:00:00 2001 From: Sayan Chowdhury Date: Wed, 3 Jan 2024 21:19:23 +0530 Subject: [PATCH] grub_install.sh: Sign the GRUB/MM with the proper keys Add the linux.mod file back Signed-off-by: Sayan Chowdhury --- build_library/grub_install.sh | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/build_library/grub_install.sh b/build_library/grub_install.sh index 9b4c82f8c1..dc74a9a160 100755 --- a/build_library/grub_install.sh +++ b/build_library/grub_install.sh @@ -58,7 +58,7 @@ case "${FLAGS_target}" in CORE_NAME="core.img" ;; x86_64-efi) - CORE_MODULES+=( serial efi_gop efinet pgp http tftp ) + CORE_MODULES+=( serial linux efi_gop efinet pgp http tftp ) CORE_NAME="core.efi" ;; x86_64-xen) @@ -192,17 +192,25 @@ case "${FLAGS_target}" in x86_64-efi) info "Installing default x86_64 UEFI bootloader." sudo mkdir -p "${ESP_DIR}/EFI/boot" - # Use the test keys for signing unofficial builds - if [[ ${COREOS_OFFICIAL:-0} -ne 1 ]]; then - sudo sbsign --key /usr/share/sb_keys/DB.key \ - --cert /usr/share/sb_keys/DB.crt \ - "${ESP_DIR}/${GRUB_DIR}/${CORE_NAME}" + # Use the test keys for signing unofficial builds + if [[ ${COREOS_OFFICIAL:-0} -ne 1 ]]; then + # Sign the GRUB with the shim-embedded key + sudo sbsign --key /usr/share/sb_keys/shim.key \ + --cert /usr/share/sb_keys/shim.pem \ + "${ESP_DIR}/${GRUB_DIR}/${CORE_NAME}" sudo cp "${ESP_DIR}/${GRUB_DIR}/${CORE_NAME}.signed" \ - "${ESP_DIR}/EFI/boot/grub.efi" + "${ESP_DIR}/EFI/boot/grubx64.efi" + # Sign the mokmanager(mm) with the shim-embedded key + sudo sbsign --key /usr/share/sb_keys/shim.key \ + --cert /usr/share/sb_keys/shim.pem \ + "/usr/lib/shim/mmx64.efi" + sudo cp "/usr/lib/shim/mmx64.efi.signed" \ + "${ESP_DIR}/EFI/boot/mmx64.efi" + sudo sbsign --key /usr/share/sb_keys/DB.key \ - --cert /usr/share/sb_keys/DB.crt \ - --output "${ESP_DIR}/EFI/boot/bootx64.efi" \ - "/usr/lib/shim/shim.efi" + --cert /usr/share/sb_keys/DB.crt \ + --output "${ESP_DIR}/EFI/boot/bootx64.efi" \ + "/usr/lib/shim/shim.efi" else sudo cp "${ESP_DIR}/${GRUB_DIR}/${CORE_NAME}" \ "${ESP_DIR}/EFI/boot/grub.efi" @@ -211,7 +219,7 @@ case "${FLAGS_target}" in fi # copying from vfat so ignore permissions if [[ -n "${FLAGS_copy_efi_grub}" ]]; then - cp --no-preserve=mode "${ESP_DIR}/EFI/boot/grub.efi" \ + cp --no-preserve=mode "${ESP_DIR}/EFI/boot/grubx64.efi" \ "${FLAGS_copy_efi_grub}" fi if [[ -n "${FLAGS_copy_shim}" ]]; then