diff options
| author | Xinliang Liu <xinliang.liu@linaro.org> | 2020-05-15 07:12:56 +0000 |
|---|---|---|
| committer | Radosław Piliszek <radoslaw.piliszek@gmail.com> | 2022-01-26 19:48:34 +0000 |
| commit | b6e057d694d90d50ea278411d0edf20afe427e13 (patch) | |
| tree | 76e8150912a8dd46c4967b107483940e6d3d5fdb /docker | |
| parent | e8651961929a00fb8684c56983c2f9c46822553d (diff) | |
| download | kolla-b6e057d694d90d50ea278411d0edf20afe427e13.tar.gz kolla-b6e057d694d90d50ea278411d0edf20afe427e13.zip | |
Use distro provided GRUB efi
Use distro provided GRUB efi instead of creating it like ironic GRUB
setup doc[1]. This avoids below ubuntu ironic-python-agent images PXE
booting failure.
----------
error: invalid magic number.
error: you need to load the kernel first.
Press any key to continue...
----------
This also fixes x86_64 uefi pxe booting issue by setting up GRUB efi
for x86_64.
Besides, GRUB setup only needs to do once at bootstrap stage.
[1]:
https://docs.openstack.org/ironic/train/install/configure-pxe.html#uefi-pxe-GRUB-setup
Closes-Bug: #1879265
Change-Id: I8be5bdf5f1a62751aefe6bd0959e8f558fcfe591
Diffstat (limited to 'docker')
| -rw-r--r-- | docker/ironic/ironic-pxe/Dockerfile.j2 | 8 | ||||
| -rw-r--r-- | docker/ironic/ironic-pxe/extend_start.sh | 40 |
2 files changed, 30 insertions, 18 deletions
diff --git a/docker/ironic/ironic-pxe/Dockerfile.j2 b/docker/ironic/ironic-pxe/Dockerfile.j2 index d165e66c0..f212e7f30 100644 --- a/docker/ironic/ironic-pxe/Dockerfile.j2 +++ b/docker/ironic/ironic-pxe/Dockerfile.j2 @@ -10,8 +10,10 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build {% if base_package_type == 'rpm' %} {% set ironic_pxe_packages = [ 'grub2-tools', + 'grub2-efi-*64', 'grub2-efi-aa64-modules', 'ipxe-bootimgs', + 'shim-*64', 'tftp-server', ] %} @@ -24,8 +26,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 = [ + 'grub-efi-*64-signed', 'ipxe', 'pxelinux', + 'shim-signed', 'syslinux-common', 'tftpd-hpa' ] %} @@ -34,10 +38,6 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build {% set ironic_pxe_packages = ironic_pxe_packages + [ 'syslinux' ] %} - {% elif base_arch == 'aarch64' %} - {% set ironic_pxe_packages = ironic_pxe_packages + [ - 'grub-efi-arm64' - ] %} {% endif %} {{ macros.install_packages(ironic_pxe_packages | customizable("packages")) }} diff --git a/docker/ironic/ironic-pxe/extend_start.sh b/docker/ironic/ironic-pxe/extend_start.sh index af20d01d6..6a5071e6a 100644 --- a/docker/ironic/ironic-pxe/extend_start.sh +++ b/docker/ironic/ironic-pxe/extend_start.sh @@ -1,7 +1,8 @@ #!/bin/bash -function prepare_pxe { +# For x86 legacy BIOS boot mode +function prepare_pxe_pxelinux { chown -R ironic: /tftpboot for pxe_file in /var/lib/tftpboot/pxelinux.0 /var/lib/tftpboot/chain.c32 /usr/lib/syslinux/pxelinux.0 \ /usr/lib/syslinux/chain.c32 /usr/lib/PXELINUX/pxelinux.0 \ @@ -12,6 +13,28 @@ function prepare_pxe { done } +# For UEFI boot mode +function prepare_pxe_grub { + 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|rhel ]]; then + shim_src_file="/boot/efi/EFI/centos/shim*64.efi" + grub_src_file="/boot/efi/EFI/centos/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 + + cp $shim_src_file /tftpboot/$shim_dst_file + cp $grub_src_file /tftpboot/$grub_dst_file +} + function prepare_ipxe { if [[ "${KOLLA_BASE_DISTRO}" =~ debian|ubuntu ]]; then cp /usr/lib/ipxe/{undionly.kpxe,ipxe.efi} /tftpboot @@ -23,21 +46,10 @@ function prepare_ipxe { # 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 - prepare_pxe + prepare_pxe_pxelinux + prepare_pxe_grub prepare_ipxe exit 0 fi -if [[ -d /usr/lib/grub/arm64-efi ]]; then - modules="boot chain configfile efinet ext2 fat gettext help hfsplus loadenv \ - lsefi normal part_gpt part_msdos read search search_fs_file search_fs_uuid \ - search_label terminal terminfo tftp linux" - - if [[ "${KOLLA_BASE_DISTRO}" =~ debian|ubuntu ]]; then - grub-mkimage -v -o /tftpboot/grubaa64.efi -O arm64-efi -p "grub" $modules - elif [[ "${KOLLA_BASE_DISTRO}" =~ centos ]]; then - grub2-mkimage -v -o /tftpboot/grubaa64.efi -O arm64-efi -p "EFI/centos" $modules - fi -fi - . /usr/local/bin/kolla_httpd_setup |
