From 5d1705f7e8c13f71f9b69db98d6b6b277e93eade Mon Sep 17 00:00:00 2001 From: Tony Nguyen Date: Fri, 5 Sep 2025 19:11:32 -0600 Subject: [PATCH] Use GRUB for OCI PR URL: https://www.github.com/delphix/appliance-build/pull/849 --- .../hooks/vm-artifacts/90-raw-disk-image.binary | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/live-build/config/hooks/vm-artifacts/90-raw-disk-image.binary b/live-build/config/hooks/vm-artifacts/90-raw-disk-image.binary index 6cc96f6f..088a74ff 100755 --- a/live-build/config/hooks/vm-artifacts/90-raw-disk-image.binary +++ b/live-build/config/hooks/vm-artifacts/90-raw-disk-image.binary @@ -347,7 +347,7 @@ done # # Mount /boot/efi and do grub and bootctl install # -EFI_DIR="/mnt/boot/efi" +EFI_DIR="/boot/efi" chroot "$DIRECTORY" mkdir -p $EFI_DIR chroot "$DIRECTORY" mount /dev/mapper/${LOOPNAME}p2 $EFI_DIR @@ -356,6 +356,18 @@ chroot "$DIRECTORY" cp /boot/initrd.img $EFI_DIR chroot "$DIRECTORY" cp /boot/vmlinuz $EFI_DIR chroot "$DIRECTORY" bootctl --esp-path=$EFI_DIR install --no-variables +# +# Install GRUB if building for OCI +# +if [[ "$APPLIANCE_PLATFORM" == oci ]] || [[ "$APPLIANCE_PLATFORM" == oci ]]; then + chroot "$DIRECTORY" mount -t zfs "$FSNAME/grub" /mnt + # chroot "$DIRECTORY" grub-install --root-directory=/mnt "/dev/$LOOPNAME" + chroot "$DIRECTORY" grub-install --target=x86_64-efi --efi-directory="$EFI_DIR" \ + --root-directory=/mnt --bootloader-id=GRUB --no-nvram + chroot "$DIRECTORY" grub-mkconfig -o /mnt/boot/grub/grub.cfg + chroot "$DIRECTORY" umount /mnt +fi + # Use GRUB_CMDLINE_LINUX_DEFAULT boot options source $DIRECTORY/etc/default/grub.d/override.cfg cat <<-EOF >"${DIRECTORY}/${EFI_DIR}/loader/entries/delphix.conf"