Skip to content

Commit ffbaa39

Browse files
bbezakm-bull
authored andcommitted
Ironic: Add ESP image for UEFI virtual media
UEFI virtual media boot requires an ESP image [1]. [1] https://docs.openstack.org/ironic/2024.2/admin/drivers/redfish.html#virtual-media-boot Change-Id: Ie8485a7098743e1d736145e8fd9441cf13c929d7 (cherry picked from commit 5025ab6)
1 parent 50b3c6e commit ffbaa39

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed

docker/ironic/ironic-pxe/Dockerfile.j2

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build
99

1010
{% if base_package_type == 'rpm' %}
1111
{% set ironic_pxe_packages = [
12+
'dosfstools',
1213
'grub2-tools',
1314
'grub2-efi-*64',
1415
'grub2-efi-aa64-modules',
1516
'ipxe-bootimgs',
17+
'mtools',
1618
'shim-*64',
1719
'tftp-server',
1820
] %}
@@ -26,8 +28,10 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build
2628
{{ macros.install_packages(ironic_pxe_packages | customizable("packages")) }}
2729
{% elif base_package_type == 'deb' %}
2830
{% set ironic_pxe_packages = [
31+
'dosfstools',
2932
'grub-efi-*64-signed',
3033
'ipxe',
34+
'mtools',
3135
'pxelinux',
3236
'shim-signed',
3337
'syslinux-common',

docker/ironic/ironic-pxe/extend_start.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,35 @@ function prepare_ipxe {
5555
fi
5656
}
5757

58+
function prepare_esp_image {
59+
# NOTE(bbezak): based on https://docs.openstack.org/ironic/2024.2/install/configure-esp.html
60+
# ESP image needs to be provided for UEFI boot with virtual media:
61+
# https://docs.openstack.org/ironic/2024.2/admin/drivers/redfish.html#virtual-media-boot
62+
if [[ "${KOLLA_BASE_DISTRO}" =~ debian|ubuntu ]]; then
63+
shim_src_file="/usr/lib/shim/shim*64.efi.signed"
64+
grub_src_file="/usr/lib/grub/*-efi-signed/grubnet*64.efi.signed"
65+
elif [[ "${KOLLA_BASE_DISTRO}" =~ centos|rocky ]]; then
66+
shim_src_file="/boot/efi/EFI/${KOLLA_BASE_DISTRO}/shim*64.efi"
67+
grub_src_file="/boot/efi/EFI/${KOLLA_BASE_DISTRO}/grub*64.efi"
68+
fi
69+
70+
if [[ "${KOLLA_BASE_ARCH}" == "x86_64" ]]; then
71+
shim_dst_file="bootx64.efi"
72+
grub_dst_file="grubx64.efi"
73+
elif [[ "${KOLLA_BASE_ARCH}" == "aarch64" ]]; then
74+
shim_dst_file="bootaa64.efi"
75+
grub_dst_file="grubaa64.efi"
76+
fi
77+
78+
DEST=${HTTPBOOT_PATH}/esp.img
79+
dd if=/dev/zero of=$DEST bs=4096 count=2048
80+
mkfs.msdos -F 12 -n ESP_IMAGE $DEST
81+
mmd -i $DEST EFI EFI/BOOT
82+
mcopy -i $DEST -v $shim_src_file ::EFI/BOOT/$shim_dst_file
83+
mcopy -i $DEST -v $grub_src_file ::EFI/BOOT/$grub_dst_file
84+
mdir -i $DEST ::EFI/BOOT
85+
}
86+
5887
# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases
5988
# of the KOLLA_BOOTSTRAP variable being set, including empty.
6089
if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then
@@ -63,6 +92,7 @@ if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then
6392
prepare_pxe_pxelinux
6493
prepare_pxe_grub
6594
prepare_ipxe
95+
prepare_esp_image
6696
exit 0
6797
fi
6898

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
features:
3+
- |
4+
Added ESP image needed for UEFI virtual media boot. More context in
5+
`Ironic documentation
6+
<https://docs.openstack.org/ironic/2024.2/admin/drivers/redfish.html#virtual-media-boot>`__.

0 commit comments

Comments
 (0)