Skip to content

Commit 28e61a7

Browse files
smiradsseng
andcommitted
fix: set GRUB prefix correctly on arm64
We always unconditionally create `BIOS` partition, even on arm64, so the prefix should be same on all arches. We don't use `BIOS` on arm64, but still this would be easier to support in the future. Co-authored-by: Dmitrii Sharshakov <dmitry.sharshakov@siderolabs.com> Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
1 parent a4f1c52 commit 28e61a7

File tree

1 file changed

+7
-8
lines changed
  • internal/app/machined/pkg/runtime/v1alpha1/bootloader/grub

1 file changed

+7
-8
lines changed

internal/app/machined/pkg/runtime/v1alpha1/bootloader/grub/install.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ func (c *Config) generateGrubImage(opts options.InstallOptions) error {
121121
"all_video",
122122
}
123123

124+
const grubPrefix = "(hd0,gpt3)/grub" // EFI, BIOS, BOOT
125+
126+
// in amd64 mode only, install GRUB BIOS mode
124127
if opts.Arch == "amd64" {
125128
grub32Modules := []string{
126129
"biosdisk",
@@ -133,7 +136,7 @@ func (c *Config) generateGrubImage(opts options.InstallOptions) error {
133136
"--output",
134137
filepath.Join(opts.MountPrefix, "core.img"),
135138
"--prefix",
136-
"(hd0,gpt3)/grub",
139+
grubPrefix,
137140
}
138141

139142
args = append(args, slices.Concat(grubModules, grub32Modules)...)
@@ -153,18 +156,14 @@ func (c *Config) generateGrubImage(opts options.InstallOptions) error {
153156

154157
grubEFIPath := filepath.Join(opts.MountPrefix, "grub-efi.img")
155158

156-
var (
157-
platform string
158-
prefix string
159-
)
159+
var platform string
160160

161+
// install GRUB in UEFI mode
161162
switch opts.Arch {
162163
case "amd64":
163164
platform = "x86_64-efi"
164-
prefix = "(hd0,gpt3)/grub" // EFI, BIOS, BOOT
165165
case "arm64":
166166
platform = "arm64-efi"
167-
prefix = "(hd0,gpt2)/grub" // EFI, BOOT
168167
default:
169168
return fmt.Errorf("unsupported architecture for grub image: %s", opts.Arch)
170169
}
@@ -175,7 +174,7 @@ func (c *Config) generateGrubImage(opts options.InstallOptions) error {
175174
"--output",
176175
grubEFIPath,
177176
"--prefix",
178-
prefix,
177+
grubPrefix,
179178
"--compression",
180179
"xz",
181180
}

0 commit comments

Comments
 (0)