Change paths for bootloader files in iso element

This PR updates locations for files used by the bootloader depending on
the target operating system built. The current logic does not take into
account latest versions of operating systems and makes it impossible to
build ISOs against those.

With this change it is possible to correctly build CentOS 8, Ubuntu
18.04 and Ubuntu 20.04 images.

Closes-Bug: #1916913
Change-Id: I3ed0041640f539e82805d03ba26fe46217f3ac3c
This commit is contained in:
Mateusz Kowalski 2021-02-25 16:30:21 +01:00 committed by Mateusz Kowalski
parent 5c1f9a3238
commit 3b22ee8784
No known key found for this signature in database
GPG Key ID: 66680B80E7DC2703
3 changed files with 33 additions and 9 deletions

View File

@ -32,6 +32,12 @@ function build_efiboot_img() {
if [[ $DISTRO_NAME = "fedora" || $DISTRO_NAME = "rhel7" ]] ; then if [[ $DISTRO_NAME = "fedora" || $DISTRO_NAME = "rhel7" ]] ; then
cp $TMP_BOOTLOADER_DIR/shim.efi $TMP_BUILD_DIR/bootx64.efi cp $TMP_BOOTLOADER_DIR/shim.efi $TMP_BUILD_DIR/bootx64.efi
cp $TMP_BOOTLOADER_DIR/grubx64.efi $TMP_BUILD_DIR/grubx64.efi cp $TMP_BOOTLOADER_DIR/grubx64.efi $TMP_BUILD_DIR/grubx64.efi
elif [[ $DISTRO_NAME = "centos" ]] ; then
cp $TMP_BOOTLOADER_DIR/shimx64-centos.efi $TMP_BUILD_DIR/bootx64.efi
cp $TMP_BOOTLOADER_DIR/grubx64.efi $TMP_BUILD_DIR/grubx64.efi
elif [[ $DISTRO_NAME = "ubuntu" || $DISTRO_NAME = "debian" ]] ; then
cp $TMP_BOOTLOADER_DIR/shimx64.efi.signed $TMP_BUILD_DIR/bootx64.efi
cp $TMP_BOOTLOADER_DIR/grubx64.efi.signed $TMP_BUILD_DIR/grubx64.efi
else else
cp $TMP_BOOTLOADER_DIR/shim.efi.signed $TMP_BUILD_DIR/bootx64.efi cp $TMP_BOOTLOADER_DIR/shim.efi.signed $TMP_BUILD_DIR/bootx64.efi
cp $TMP_BOOTLOADER_DIR/grubx64.efi.signed $TMP_BUILD_DIR/grubx64.efi cp $TMP_BOOTLOADER_DIR/grubx64.efi.signed $TMP_BUILD_DIR/grubx64.efi
@ -65,6 +71,10 @@ function build_iso() {
if [ $DISTRO_NAME = "fedora" ]; then if [ $DISTRO_NAME = "fedora" ]; then
EFI_BOOT_DIR="EFI/fedora" EFI_BOOT_DIR="EFI/fedora"
EXTRA_KERNEL_PARAMS="usbcore.autosuspend=-1" EXTRA_KERNEL_PARAMS="usbcore.autosuspend=-1"
#centos
elif [ $DISTRO_NAME = "centos" ]; then
EFI_BOOT_DIR="EFI/centos"
EXTRA_KERNEL_PARAMS=""
#debian #debian
elif [ $DISTRO_NAME = "debian" ]; then elif [ $DISTRO_NAME = "debian" ]; then
EFI_BOOT_DIR="EFI/debian" EFI_BOOT_DIR="EFI/debian"
@ -178,4 +188,3 @@ build_iso "$EMITTED_KERNEL" "$EMITTED_RAMDISK" "$EMITTED_KERNEL_CMDLINE_ARGS" \
# Clean-up the bootloaders directory # Clean-up the bootloaders directory
sudo rm -fr $TMP_BOOTLOADER_DIR sudo rm -fr $TMP_BOOTLOADER_DIR

View File

@ -4,6 +4,11 @@
"syslinux": "syslinux", "syslinux": "syslinux",
"syslinux-common": "syslinux-common", "syslinux-common": "syslinux-common",
"isolinux": "isolinux" "isolinux": "isolinux"
},
"ubuntu":{
"syslinux": "syslinux",
"syslinux-common": "syslinux-common",
"isolinux": "isolinux"
} }
}, },
"family":{ "family":{
@ -24,4 +29,3 @@
"isolinux": "" "isolinux": ""
} }
} }

View File

@ -16,10 +16,16 @@ if [ $DISTRO_NAME = "fedora" ]; then
SHIM_FILE="/boot/efi/EFI/fedora/shim.efi" SHIM_FILE="/boot/efi/EFI/fedora/shim.efi"
SYSLINUX_FILE="/usr/share/syslinux/isolinux.bin" SYSLINUX_FILE="/usr/share/syslinux/isolinux.bin"
LDLINUX_FILE="/usr/share/syslinux/ldlinux.c32" LDLINUX_FILE="/usr/share/syslinux/ldlinux.c32"
#debian #centos
elif [ $DISTRO_NAME = "debian" ]; then elif [ $DISTRO_NAME = "centos" ]; then
GRUB_FILE="/boot/efi/EFI/centos/grubx64.efi"
SHIM_FILE="/boot/efi/EFI/centos/shimx64-centos.efi"
SYSLINUX_FILE="/usr/share/syslinux/isolinux.bin"
LDLINUX_FILE="/usr/share/syslinux/ldlinux.c32"
#debian/ubuntu
elif [ $DISTRO_NAME = "ubuntu" || $DISTRO_NAME = "debian" ]; then
GRUB_FILE="/usr/lib/grub/x86_64-efi-signed/grubx64.efi.signed" GRUB_FILE="/usr/lib/grub/x86_64-efi-signed/grubx64.efi.signed"
SHIM_FILE="/usr/lib/shim/shim.efi.signed" SHIM_FILE="/usr/lib/shim/shimx64.efi.signed"
SYSLINUX_FILE="/usr/lib/ISOLINUX/isolinux.bin" SYSLINUX_FILE="/usr/lib/ISOLINUX/isolinux.bin"
LDLINUX_FILE="/usr/lib/syslinux/modules/bios/ldlinux.c32" LDLINUX_FILE="/usr/lib/syslinux/modules/bios/ldlinux.c32"
#rhel7 #rhel7
@ -28,18 +34,23 @@ elif [ $DISTRO_NAME = "rhel7" ]; then
SHIM_FILE="/boot/efi/EFI/redhat/shim.efi" SHIM_FILE="/boot/efi/EFI/redhat/shim.efi"
SYSLINUX_FILE="/usr/share/syslinux/isolinux.bin" SYSLINUX_FILE="/usr/share/syslinux/isolinux.bin"
LDLINUX_FILE="/usr/share/syslinux/ldlinux.c32" LDLINUX_FILE="/usr/share/syslinux/ldlinux.c32"
#ubuntu #other
else else
GRUB_FILE="/usr/lib/grub/x86_64-efi-signed/grubx64.efi.signed" GRUB_FILE="/usr/lib/grub/x86_64-efi-signed/grubx64.efi.signed"
SHIM_FILE="/usr/lib/shim/shim.efi.signed" SHIM_FILE="/usr/lib/shim/shimx64.efi.signed"
SYSLINUX_FILE="/usr/lib/syslinux/isolinux.bin" SYSLINUX_FILE="/usr/lib/ISOLINUX/isolinux.bin"
LDLINUX_FILE="/usr/lib/syslinux/ldlinux.c32" LDLINUX_FILE="/usr/lib/syslinux/modules/bios/ldlinux.c32"
fi fi
cp $GRUB_FILE $TMP_BOOTLOADER_DIR cp $GRUB_FILE $TMP_BOOTLOADER_DIR
cp $SHIM_FILE $TMP_BOOTLOADER_DIR cp $SHIM_FILE $TMP_BOOTLOADER_DIR
cp $SYSLINUX_FILE $TMP_BOOTLOADER_DIR cp $SYSLINUX_FILE $TMP_BOOTLOADER_DIR
# On some operating systems signed bootloader packages install
# files with read permissions for root only, whereas some for all
# the users.
chmod --recursive +r $TMP_BOOTLOADER_DIR
# Starting from SYSLINUX 5.00, the isolinux.bin is dependent # Starting from SYSLINUX 5.00, the isolinux.bin is dependent
# on ldlinux.c32. # on ldlinux.c32.
# http://www.syslinux.org/wiki/index.php/Library_modules # http://www.syslinux.org/wiki/index.php/Library_modules