Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 20 additions & 25 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -110,32 +110,8 @@ RUN --mount=type=tmpfs,target=/run --mount=type=tmpfs,target=/tmp <<EOF
fi
EOF

# Get the latest GrubCC binary
FROM quay.io/fedora/eln:latest AS grub-cc-download
RUN --mount=type=tmpfs,target=/run --mount=type=tmpfs,target=/tmp <<EOF
set -eux

# There isn't a generic grub2-efi-cc package that DNF can automatically resolve
case "$(uname -m)" in
x86_64)
dnf download grub2-efi-x64-cc
;;
aarch64)
dnf download grub2-efi-aa64-cc
;;
*)
echo "Unsupported architecture: $(uname -m)" >&2
exit 1
;;
esac

mv ./*.rpm grub-cc.rpm

EOF

FROM scratch as fetch
COPY --from=target-base /target-rootfs/ /
COPY --from=grub-cc-download /grub-cc.rpm /var/grub-cc.rpm
# SKIP_CONFIGS=1 skips LBIs, test kargs, and install configs (for FCOS testing)
ARG SKIP_CONFIGS
ARG boot_type
Expand Down Expand Up @@ -172,6 +148,24 @@ RUN --mount=type=tmpfs,target=/run --mount=type=tmpfs,target=/tmp \
dnf install -y "${pkgs_to_install[@]}"
fi

if [[ "$bootloader" == "grub-cc" ]]; then
case "$(uname -m)" in
x86_64)
grub_cc_url=https://kojipkgs.fedoraproject.org/packages/grub2/2.12/60.eln156/x86_64/grub2-efi-x64-cc-2.12-60.eln156.x86_64.rpm
;;
aarch64)
grub_cc_url=https://kojipkgs.fedoraproject.org/packages/grub2/2.12/60.eln156/aarch64/grub2-efi-aa64-cc-2.12-60.eln156.aarch64.rpm
;;
*)
echo "Unsupported architecture: $(uname -m)" >&2
exit 1
;;
esac

curl --fail --location --retry 5 --retry-all-errors --retry-delay 1 \
--output /var/grub-cc.rpm "$grub_cc_url"
fi

# Currently dnf installs grub-cc at /usr/lib/efi/grub2/1:2.12-60.eln156/EFI/eln/cc/grubx64-cc.efi
# which is less than ideal because:
# - the "cc" subdirectory
Expand All @@ -181,7 +175,8 @@ RUN --mount=type=tmpfs,target=/run --mount=type=tmpfs,target=/tmp \
# we can copy the EFI binary to the ESP
if [[ "$bootloader" == "grub-cc" ]]; then
mkdir /var/grub-cc
rpm2archive /var/grub-cc.rpm | tar -xvz -C /var/grub-cc
rpm2archive /var/grub-cc.rpm > /tmp/grub-cc.tar.gz
tar -xvz -f /tmp/grub-cc.tar.gz -C /var/grub-cc
file=$(find /var/grub-cc -name '*.efi')
mkdir -p /usr/lib/grub-cc
cp "$file" /usr/lib/grub-cc/grub-cc.efi
Expand Down
Loading