Skip to content

Commit d1fc4a5

Browse files
committed
fix(image-factory): install a GRUB that works on any build host
Alpine has no grub-bios and no ovmf for aarch64, apk add is atomic, and the || true hid the failure - so the arm64 half of the multi-arch factory shipped with no grub-install at all and died far downstream in install-kernel-grub.sh. The tools and the modules come apart cleanly: the grub package holds grub-install, grub-mkimage, grub-bios-setup and grub-probe for every architecture and builds a boot chain for any target whose modules are present, while grub-bios and grub-efi hold nothing but /usr/lib/grub/<target>/. So install grub natively and copy i386-pc and x86_64-efi from an x86_64 stage. ovmf is dropped: x86_64-only and referenced nowhere. Signed-off-by: Simon Walz <contact@simonwalz.de>
1 parent 058d88d commit d1fc4a5

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

‎image-factory/Dockerfile‎

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
# SPDX-License-Identifier: Apache-2.0
2+
3+
# GRUB modules for the x86_64 boot chain. Alpine ships the i386-pc and
4+
# x86_64-efi module directories in x86_64-only packages, so they are unpacked on
5+
# an x86_64 stage and carried into whichever architecture this image is built
6+
# for. Both packages hold nothing but /usr/lib/grub/<target>/ - target data, no
7+
# host binaries - which is what makes the copy sound.
8+
FROM --platform=linux/amd64 alpine:3.23 AS grub-x86_64
9+
RUN apk add --no-cache grub-bios grub-efi
10+
211
FROM docker:29.5.3-alpine3.23
312

413
# WARNING: This Dockerfile is intended to be built from the parent directory.
@@ -16,8 +25,14 @@ RUN apk add --no-cache \
1625
parted dosfstools btrfs-progs \
1726
gptfdisk qemu-img kpartx util-linux jq btrfs-progs bash tar
1827

19-
RUN apk add --no-cache \
20-
grub-efi grub-bios ovmf || true
28+
# grub: grub-install, grub-mkimage, grub-bios-setup and grub-probe. These build
29+
# and write a boot chain for any target whose modules are present, so this stage
30+
# needs no architecture of its own - system/cuos/install-kernel-grub.sh runs
31+
# them here in the factory, not inside the target rootfs.
32+
RUN apk add --no-cache grub
33+
34+
COPY --from=grub-x86_64 /usr/lib/grub/i386-pc/ /usr/lib/grub/i386-pc/
35+
COPY --from=grub-x86_64 /usr/lib/grub/x86_64-efi/ /usr/lib/grub/x86_64-efi/
2136

2237
COPY image-factory/create_image.sh /create_image.sh
2338
COPY updater/*.sh /usr/local/updater/

0 commit comments

Comments
 (0)