aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docker/ironic/ironic-pxe/Dockerfile.j24
-rw-r--r--docker/ironic/ironic-pxe/extend_start.sh30
-rw-r--r--releasenotes/notes/ironic-esp-image-886b5fb5b01e7b56.yaml6
3 files changed, 40 insertions, 0 deletions
diff --git a/docker/ironic/ironic-pxe/Dockerfile.j2 b/docker/ironic/ironic-pxe/Dockerfile.j2
index 51588ac61..f4a7734f9 100644
--- a/docker/ironic/ironic-pxe/Dockerfile.j2
+++ b/docker/ironic/ironic-pxe/Dockerfile.j2
@@ -9,10 +9,12 @@ 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',
+ 'mtools',
'shim-*64',
'tftp-server',
] %}
@@ -26,8 +28,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 50aa543a7..54d6b1b21 100644
--- a/docker/ironic/ironic-pxe/extend_start.sh
+++ b/docker/ironic/ironic-pxe/extend_start.sh
@@ -55,6 +55,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 +92,7 @@ if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then
prepare_pxe_pxelinux
prepare_pxe_grub
prepare_ipxe
+ prepare_esp_image
exit 0
fi
diff --git a/releasenotes/notes/ironic-esp-image-886b5fb5b01e7b56.yaml b/releasenotes/notes/ironic-esp-image-886b5fb5b01e7b56.yaml
new file mode 100644
index 000000000..616e1a7bf
--- /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
+ <https://docs.openstack.org/ironic/2024.2/admin/drivers/redfish.html#virtual-media-boot>`__.