Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Proof of concept: dual-arch x86_64/aarch64 ironic image #437

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
13 changes: 6 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,10 @@ RUN dnf install -y gcc git make xz-devel

WORKDIR /tmp

RUN git clone --depth 1 --branch v1.21.1 https://github.com/ipxe/ipxe.git && \
cd ipxe/src && \
ARCH=$(uname -m | sed 's/aarch/arm/') && \
# NOTE(elfosardo): warning should not be treated as errors by default
NO_WERROR=1 make bin/undionly.kpxe "bin-$ARCH-efi/snponly.efi"

COPY prepare-efi.sh /bin/
RUN git clone --depth 1 --branch v1.21.1 https://github.com/ipxe/ipxe.git
RUN dnf install -y epel-release
COPY build-ipxe.sh prepare-efi.sh /bin/
RUN build-ipxe.sh
RUN prepare-efi.sh centos

FROM $BASE_IMAGE
Expand Down Expand Up @@ -44,6 +41,8 @@ COPY scripts/ /bin/

# IRONIC #
COPY --from=ironic-builder /tmp/ipxe/src/bin/undionly.kpxe /tmp/ipxe/src/bin-x86_64-efi/snponly.efi /tftpboot/
COPY --from=ironic-builder /tmp/ipxe/src/bin-x86_64-efi/snponly.efi /tftpboot/snponly-x86_64.efi
COPY --from=ironic-builder /tmp/ipxe/src/bin-arm64-efi/snponly.efi /tftpboot/snponly-aarch64.efi
COPY --from=ironic-builder /tmp/esp.img /tmp/uefi_esp.img

COPY ironic-config/ironic.conf.j2 /etc/ironic/
Expand Down
13 changes: 13 additions & 0 deletions build-ipxe.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

set -eux -o pipefail

dnf install -y gcc-aarch64-linux-gnu gcc-x86_64-linux-gnu

cd ipxe/src
# NOTE(elfosardo): warning should not be treated as errors by default
export NO_WERROR=1

CROSS_COMPILE=aarch64-linux-gnu- make bin-arm64-efi/snponly.efi
CROSS_COMPILE=x86_64-linux-gnu- make bin-x86_64-efi/snponly.efi
make bin/undionly.kpxe
10 changes: 6 additions & 4 deletions ironic-config/dnsmasq.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ dhcp-match=ipxe,175
dhcp-boot=tag:ipxe,http://{{ env.IRONIC_URL_HOST }}:{{ env.HTTP_PORT }}/boot.ipxe

# Note: Need to test EFI booting
dhcp-match=set:efi,option:client-arch,7
dhcp-match=set:efi,option:client-arch,9
dhcp-match=set:efi,option:client-arch,11
dhcp-match=set:x86_64-efi,option:client-arch,7
dhcp-match=set:x86_64-efi,option:client-arch,9
dhcp-match=set:aarch64-efi,option:client-arch,11
# Client is PXE booting over EFI without iPXE ROM; send EFI version of iPXE chainloader
dhcp-boot=tag:efi,tag:!ipxe,snponly.efi
dhcp-boot=tag:x86_64-efi,tag:!ipxe,snponly-x86_64.efi
dhcp-boot=tag:aarch64-efi,tag:!ipxe,snponly-aarch64.efi

# Client is running PXE over BIOS; send BIOS version of iPXE chainloader
dhcp-boot=/undionly.kpxe,{{ env.IRONIC_IP }}
Expand All @@ -49,6 +50,7 @@ ra-param={{ env.PROVISIONING_INTERFACE }},0,0

dhcp-vendorclass=set:pxe6,enterprise:343,PXEClient
dhcp-userclass=set:ipxe6,iPXE
# TODO(dtantsur): multiarch
dhcp-option=tag:pxe6,option6:bootfile-url,tftp://{{ env.IRONIC_URL_HOST }}/snponly.efi
dhcp-option=tag:ipxe6,option6:bootfile-url,http://{{ env.IRONIC_URL_HOST }}:{{ env.HTTP_PORT }}/boot.ipxe

Expand Down
8 changes: 5 additions & 3 deletions prepare-efi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ fi
# ``Cannot initialize '::'``
# This is due to the conversion table missing codepage 850, included in glibc-gconv-extra
# shellcheck disable=SC2086
dnf install -y grub2 shim dosfstools mtools glibc-gconv-extra $PACKAGES
dnf install -y grub2 shim dosfstools mtools glibc-gconv-extra grub2-efi-x64 grub2-efi-aa64

## TODO(TheJulia): At some point we may want to try and make the size
## of the ESP image file to be sized smaller for the files that need to
Expand All @@ -40,6 +40,8 @@ mkfs.msdos -F 12 -n 'ESP_IMAGE' "$DEST"

mmd -i "$DEST" EFI
mmd -i "$DEST" EFI/BOOT
mcopy -i "$DEST" -v "/boot/efi/EFI/BOOT/$BOOTEFI" ::EFI/BOOT
mcopy -i "$DEST" -v "/boot/efi/EFI/$OS/$GRUBEFI" ::EFI/BOOT
mcopy -i "$DEST" -v "/boot/efi/EFI/BOOT/BOOTX64.EFI" ::EFI/BOOT
mcopy -i "$DEST" -v "/boot/efi/EFI/BOOT/BOOTAA64.EFI" ::EFI/BOOT
mcopy -i "$DEST" -v "/boot/efi/EFI/$OS/grubx64.efi" ::EFI/BOOT
mcopy -i "$DEST" -v "/boot/efi/EFI/$OS/grubaa64.efi" ::EFI/BOOT
mdir -i "$DEST" ::EFI/BOOT