diff --git a/docker/ironic/ironic-pxe/Dockerfile.j2 b/docker/ironic/ironic-pxe/Dockerfile.j2 index d122e1b115..c7ebdcc873 100644 --- a/docker/ironic/ironic-pxe/Dockerfile.j2 +++ b/docker/ironic/ironic-pxe/Dockerfile.j2 @@ -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', ] %} @@ -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', diff --git a/docker/ironic/ironic-pxe/extend_start.sh b/docker/ironic/ironic-pxe/extend_start.sh index 50aa543a70..07652b803e 100644 --- a/docker/ironic/ironic-pxe/extend_start.sh +++ b/docker/ironic/ironic-pxe/extend_start.sh @@ -43,11 +43,19 @@ 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 @@ -55,6 +63,35 @@ function prepare_ipxe { 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 @@ -63,6 +100,7 @@ if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then prepare_pxe_pxelinux prepare_pxe_grub prepare_ipxe + prepare_esp_image exit 0 fi diff --git a/releasenotes/notes/aarch64-ipxe-51888a5972528d77.yaml b/releasenotes/notes/aarch64-ipxe-51888a5972528d77.yaml new file mode 100644 index 0000000000..eb891b30c3 --- /dev/null +++ b/releasenotes/notes/aarch64-ipxe-51888a5972528d77.yaml @@ -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. diff --git a/releasenotes/notes/el-aarch64-ipxe-snponly-e7fc23bdc7edfe3d.yaml b/releasenotes/notes/el-aarch64-ipxe-snponly-e7fc23bdc7edfe3d.yaml new file mode 100644 index 0000000000..539a6886c7 --- /dev/null +++ b/releasenotes/notes/el-aarch64-ipxe-snponly-e7fc23bdc7edfe3d.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Ensure that ipxe-snponly-aarch64.efi is available in + /tftpboot in Centos and Rocky after bootstrapping + ironic-pxe. diff --git a/releasenotes/notes/ironic-esp-image-886b5fb5b01e7b56.yaml b/releasenotes/notes/ironic-esp-image-886b5fb5b01e7b56.yaml new file mode 100644 index 0000000000..616e1a7bf9 --- /dev/null +++ b/releasenotes/notes/ironic-esp-image-886b5fb5b01e7b56.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + Added ESP image needed for UEFI virtual media boot. More context in + `Ironic documentation + `__.