Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sys-boot/grub: Move to portage-stable, bump to 2.12 #2318

Merged
merged 1 commit into from
Sep 17, 2024
Merged

Conversation

chewi
Copy link
Contributor

@chewi chewi commented Sep 13, 2024

sys-boot/grub: Move to portage-stable, bump to 2.12

We can now use Gentoo's upstream ebuild, save for a few small overrides in a separate env file.

This bumps GRUB from 2.06 to 2.12, The existing two Flatcar patches have been rebased.

This supersedes #2301 as we don't need the Red Hat patches after all.

How to use

Build an image and try it out. Alternatively, take an existing image, replace grubx64.efi in the first partition, and test with UEFI. You can build grubx64.efi by installing sys-boot/grub to the host and the board root (--nodeps should be okay), tweaking the grub_install.sh script, and running the following command.

--- a/build_library/grub_install.sh
+++ b/build_library/grub_install.sh
@@ -113,23 +113,9 @@ cleanup() {
 trap cleanup EXIT
 
 info "Installing GRUB ${FLAGS_target} in ${FLAGS_disk_image##*/}"
-LOOP_DEV=$(sudo losetup --find --show --partscan "${FLAGS_disk_image}")
 ESP_DIR=$(mktemp --directory)
 MOUNTED=
 
-for (( i=0; i<5; ++i )); do
-    if sudo mount -t vfat "${LOOP_DEV}p1" "${ESP_DIR}"; then
-        MOUNTED=x
-        break
-    fi
-    warn "loopback device node ${LOOP_DEV}p1 still missing, reprobing..."
-    sudo blockdev --rereadpt "${LOOP_DEV}"
-    # sleep for 0.5, then 1, then 2, then 4, then 8 seconds.
-    sleep "$(bc <<<"scale=1; (2.0 ^ ${i}) / 2.0")"
-done
-if [[ -z ${MOUNTED} ]]; then
-    failboat "${LOOP_DEV}p1 where art thou? udev has forsaken us!"
-fi
 sudo mkdir -p "${ESP_DIR}/${GRUB_DIR}"
 
 info "Compressing modules in ${GRUB_DIR}"
@@ -143,7 +129,7 @@ info "Generating ${GRUB_DIR}/load.cfg"
 # by filesystem ID in case the platform doesn't provide the boot disk.
 # $root points to memdisk here so instead use hd0,gpt1 as a hint so it is
 # searched first.
-ESP_FSID=$(sudo grub-probe -t fs_uuid -d "${LOOP_DEV}p1")
+ESP_FSID=XXXX-XXXX # Get this from guestfish with blkid /dev/sda1
 sudo_clobber "${ESP_DIR}/${GRUB_DIR}/load.cfg" <<EOF
 search.fs_uuid ${ESP_FSID} root hd0,gpt1
 set prefix=(memdisk)
sudo ./build_library/grub_install.sh --target x86_64-efi --verity --copy_efi_grub .

Testing done

A Jenkins run passes, including with the new TPM event log Kola test in flatcar/mantle#558, and local testing with QEMU amd64 works. The size increases seen in #2301 are much smaller here and hopefully not an issue.

  • Changelog entries added in the respective changelog/ directory (user-facing change, bug fix, security fix, update)
  • Inspected CI output for image differences: /boot and /usr size, packages, list files for any missing binaries, kernel modules, config files, kernel modules, etc.

We can now use Gentoo's upstream ebuild, save for a few small overrides
in a separate env file.

This bumps GRUB from 2.06 to 2.12, The existing two Flatcar patches have
been rebased.

Signed-off-by: James Le Cuirot <[email protected]>
@chewi
Copy link
Contributor Author

chewi commented Sep 13, 2024

@jepio Do we want to merge this now?

Copy link

Copy link
Member

@sayanchowdhury sayanchowdhury left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, let's merge this and then we can merge the other PRs on top of this?

@chewi chewi merged commit ea395fe into main Sep 17, 2024
1 check failed
@chewi chewi deleted the chewi/grub-2.12 branch September 17, 2024 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging this pull request may close these issues.

4 participants