@@ -55,6 +55,35 @@ function prepare_ipxe {
55
55
fi
56
56
}
57
57
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
+
58
87
# Bootstrap and exit if KOLLA_BOOTSTRAP variable is set. This catches all cases
59
88
# of the KOLLA_BOOTSTRAP variable being set, including empty.
60
89
if [[ " ${! KOLLA_BOOTSTRAP[@]} " ]]; then
@@ -63,6 +92,7 @@ if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then
63
92
prepare_pxe_pxelinux
64
93
prepare_pxe_grub
65
94
prepare_ipxe
95
+ prepare_esp_image
66
96
exit 0
67
97
fi
68
98
0 commit comments