Skip to content
This repository has been archived by the owner on Dec 16, 2024. It is now read-only.

Commit

Permalink
Fix usb efi boot
Browse files Browse the repository at this point in the history
Signed-off-by: Itxaka <itxaka@kairos.io>
  • Loading branch information
Itxaka committed Dec 9, 2024
1 parent 6cce494 commit 8efbc04
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pkg/action/build-iso.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 8efbc04

Please sign in to comment.