From 8efbc049e22d978c7292466e5575ecc85b6e3ce1 Mon Sep 17 00:00:00 2001 From: Itxaka Date: Mon, 9 Dec 2024 13:31:53 +0100 Subject: [PATCH] Fix usb efi boot Signed-off-by: Itxaka --- pkg/action/build-iso.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pkg/action/build-iso.go b/pkg/action/build-iso.go index b52fdd5..d3c10ae 100644 --- a/pkg/action/build-iso.go +++ b/pkg/action/build-iso.go @@ -184,6 +184,11 @@ func (b BuildISOAction) createEFI(rootdir string, isoDir string) error { b.cfg.Logger.Errorf("Failed writing grub.cfg: %v", err) return err } + err = b.cfg.Fs.WriteFile(filepath.Join(temp, constants.EfiBootPath, constants.GrubCfg), []byte(constants.GrubEfiCfg), constants.FilePerm) + if err != nil { + b.cfg.Logger.Errorf("Failed writing grub.cfg: %v", err) + return err + } // Ubuntu efi searches for the grub.cfg file under /EFI/ubuntu/grub.cfg while we store it under /boot/grub2/grub.cfg // workaround this by copying it there as well // read the kairos-release from the rootfs to know if we are creating a ubuntu based iso @@ -205,11 +210,21 @@ func (b BuildISOAction) createEFI(rootdir string, isoDir string) error { b.cfg.Logger.Errorf("Failed writing grub.cfg: %v", err) return err } + err = utils.MkdirAll(b.cfg.Fs, filepath.Join(temp, "EFI/ubuntu/"), constants.DirPerm) + if err != nil { + b.cfg.Logger.Errorf("Failed writing grub.cfg: %v", err) + return err + } err = b.cfg.Fs.WriteFile(filepath.Join(isoDir, "EFI/ubuntu/", constants.GrubCfg), []byte(constants.GrubEfiCfg), constants.FilePerm) if err != nil { b.cfg.Logger.Errorf("Failed writing grub.cfg: %v", err) return err } + err = b.cfg.Fs.WriteFile(filepath.Join(temp, "EFI/ubuntu/", constants.GrubCfg), []byte(constants.GrubEfiCfg), constants.FilePerm) + if err != nil { + b.cfg.Logger.Errorf("Failed writing grub.cfg: %v", err) + return err + } } // Calculate EFI image size based on artifacts