Skip to content

[ironic-pxe] Backport aarch64 iPXE config #429

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

Draft
wants to merge 3 commits into
base: stackhpc/2024.1
Choose a base branch
from
Draft
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
5 changes: 5 additions & 0 deletions docker/ironic/ironic-pxe/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build

{% if base_package_type == 'rpm' %}
{% set ironic_pxe_packages = [
'dosfstools',
'grub2-tools',
'grub2-efi-*64',
'grub2-efi-aa64-modules',
'ipxe-bootimgs',
'ipxe-bootimgs-aarch64',
'mtools',
'shim-*64',
'tftp-server',
] %}
Expand All @@ -26,8 +29,10 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build
{{ macros.install_packages(ironic_pxe_packages | customizable("packages")) }}
{% elif base_package_type == 'deb' %}
{% set ironic_pxe_packages = [
'dosfstools',
'grub-efi-*64-signed',
'ipxe',
'mtools',
'pxelinux',
'shim-signed',
'syslinux-common',
Expand Down
42 changes: 40 additions & 2 deletions docker/ironic/ironic-pxe/extend_start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,55 @@ function prepare_ipxe {
# was ipxe.efi. Ensure that both exist, using symlinks where the files are
# named differently to allow the original names to be used in ironic.conf.
if [[ "${KOLLA_BASE_DISTRO}" =~ debian|ubuntu ]]; then
cp /usr/lib/ipxe/{undionly.kpxe,ipxe.efi,snponly.efi} ${TFTPBOOT_PATH}/
# NOTE(m-anson): ipxe-arm64.efi is not symlinked from /boot to
# /usr/lib/ipxe by the Ubuntu ipxe package, so fix that here.
if [[ -e /boot/ipxe-arm64.efi ]]; then
ln -s /boot/ipxe-arm64.efi /usr/lib/ipxe/
fi
cp /usr/lib/ipxe/{undionly.kpxe,ipxe*.efi,snponly.efi} ${TFTPBOOT_PATH}/
elif [[ "${KOLLA_BASE_DISTRO}" =~ centos|rocky ]]; then
cp /usr/share/ipxe/{undionly.kpxe,ipxe*.efi} ${TFTPBOOT_PATH}/
cp /usr/share/ipxe/arm64-efi/snponly.efi ${TFTPBOOT_PATH}/ipxe-snponly-aarch64.efi
if [[ ! -e ${TFTPBOOT_PATH}/ipxe.efi ]]; then
ln -s ${TFTPBOOT_PATH}/ipxe-${KOLLA_BASE_ARCH}.efi ${TFTPBOOT_PATH}/ipxe.efi
# NOTE(m-anson): No ipxe-aarch64.efi exists so no need to use
# $KOLLA_BASE_ARCH in the symlink target
ln -s ${TFTPBOOT_PATH}/ipxe-x86_64.efi ${TFTPBOOT_PATH}/ipxe.efi
fi
if [[ ! -e ${TFTPBOOT_PATH}/snponly.efi ]]; then
ln -s ${TFTPBOOT_PATH}/ipxe-snponly-${KOLLA_BASE_ARCH}.efi ${TFTPBOOT_PATH}/snponly.efi
fi
fi
}

function prepare_esp_image {
# NOTE(bbezak): based on https://docs.openstack.org/ironic/2024.2/install/configure-esp.html
# ESP image needs to be provided for UEFI boot with virtual media:
# https://docs.openstack.org/ironic/2024.2/admin/drivers/redfish.html#virtual-media-boot
if [[ "${KOLLA_BASE_DISTRO}" =~ debian|ubuntu ]]; then
shim_src_file="/usr/lib/shim/shim*64.efi.signed"
grub_src_file="/usr/lib/grub/*-efi-signed/grubnet*64.efi.signed"
elif [[ "${KOLLA_BASE_DISTRO}" =~ centos|rocky ]]; then
shim_src_file="/boot/efi/EFI/${KOLLA_BASE_DISTRO}/shim*64.efi"
grub_src_file="/boot/efi/EFI/${KOLLA_BASE_DISTRO}/grub*64.efi"
fi

if [[ "${KOLLA_BASE_ARCH}" == "x86_64" ]]; then
shim_dst_file="bootx64.efi"
grub_dst_file="grubx64.efi"
elif [[ "${KOLLA_BASE_ARCH}" == "aarch64" ]]; then
shim_dst_file="bootaa64.efi"
grub_dst_file="grubaa64.efi"
fi

DEST=${HTTPBOOT_PATH}/esp.img
dd if=/dev/zero of=$DEST bs=4096 count=2048
mkfs.msdos -F 12 -n ESP_IMAGE $DEST
mmd -i $DEST EFI EFI/BOOT
mcopy -i $DEST -v $shim_src_file ::EFI/BOOT/$shim_dst_file
mcopy -i $DEST -v $grub_src_file ::EFI/BOOT/$grub_dst_file
mdir -i $DEST ::EFI/BOOT
}

# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases
# of the KOLLA_BOOTSTRAP variable being set, including empty.
if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then
Expand All @@ -63,6 +100,7 @@ if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then
prepare_pxe_pxelinux
prepare_pxe_grub
prepare_ipxe
prepare_esp_image
exit 0
fi

Expand Down
9 changes: 9 additions & 0 deletions releasenotes/notes/aarch64-ipxe-51888a5972528d77.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
features:
- |
Adds aarch64 iPXE support to the ironic-pxe image, by adding
``ipxe-bootimgs-aarch64`` RPM package to Rocky Linux ironic-pxe
images, and ensuring that an aarch64 iPXE binary is available
in Ubuntu ironic-pxe images. No support for aarch64 iPXE in
Debian images is included, as the distro packages do not
install an aarch64 binary.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
fixes:
- |
Ensure that ipxe-snponly-aarch64.efi is available in
/tftpboot in Centos and Rocky after bootstrapping
ironic-pxe.
6 changes: 6 additions & 0 deletions releasenotes/notes/ironic-esp-image-886b5fb5b01e7b56.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
features:
- |
Added ESP image needed for UEFI virtual media boot. More context in
`Ironic documentation
<https://docs.openstack.org/ironic/2024.2/admin/drivers/redfish.html#virtual-media-boot>`__.