Project

General

Profile

Download (8.89 KB) Statistics
| Branch: | Tag: | Revision:
9b83dfe5 Ondřej Ezr
default=local
89eaa0b6 Kamil Szubrycht
timeout=20
9b83dfe5 Ondřej Ezr
echo Default PXE global template entry is set to 'local'
89eaa0b6 Kamil Szubrycht
e392b9f9 Tomer Brisker
echo "Trying /httpboot/grub2/grub.cfg-$net_default_mac"
configfile "/httpboot/grub2/grub.cfg-$net_default_mac"
d96043f5 Tomer Brisker
e392b9f9 Tomer Brisker
echo "Trying /grub2/grub.cfg-$net_default_mac"
configfile "/grub2/grub.cfg-$net_default_mac"
d96043f5 Tomer Brisker
e392b9f9 Tomer Brisker
# The following four statements breaks grub2 and it's no
# longer able to load any file from the base URL.
# Comment them out to be able to use (UEFI/iPXE) HTTP Boot:
# https://bugzilla.redhat.com/show_bug.cgi?id=1763216
echo "Trying grub2/grub.cfg-$net_default_mac"
configfile "grub2/grub.cfg-$net_default_mac"

echo "Trying grub.cfg-$net_default_mac"
configfile "grub.cfg-$net_default_mac"
89eaa0b6 Kamil Szubrycht
4f290348 Tomer Brisker
insmod part_gpt
insmod fat
insmod chain

0462f797 Lukas Zapletal
echo "VMWare hosts with QuickBoot feature enabled may not find the local ESP"
7a77b3ce Bernhard Suttner
echo "partition due to not initializing all the EFI devices. To address this,"
echo "use an up-to-date grub2 (*) version and include the "connectefi scsi" statement"
echo "as provided below. If you're using an older grub2 version or"
echo "the "connectefi" option isn't recognized by your grub2, grub2 will print a error"
echo "like 'can't find command connectefi' but the boot process will continue."
echo "For hosts, you can omit this by adding a (global) parameter to 'grub2-connectefi=false'."
echo "For the default GRUB2 script, you can omit this by setting the"
echo "default_connectefi_option below to 'false'."
echo "Valid values of 'grub2-connectefi' parameter: false, scsi, pciroot"
0462f797 Lukas Zapletal
echo
echo "Virtual or physical hosts using Software RAID for the ESP partition may try"
echo "booting on the Software RAID, which will fail. To workaround, upgrade to the"
echo "latest grub2 (*) and add "--efidisk-only" argument to the "search" command in"
echo "the grub2_chainload template."
echo
echo "(*) grub2-efi-x64-2.02-122.el8 (upstream doesn't have the patches yet)"
echo
7a77b3ce Bernhard Suttner
connectefi scsi
dd8ff395 Lukas Zapletal
0462f797 Lukas Zapletal
menuentry 'Chainload Grub2 EFI from ESP' --id local_chain_hd0 {
7d603148 Lukáš Zapletal
echo "Chainloading Grub2 EFI from ESP, enabled devices for booting:"
89eaa0b6 Kamil Szubrycht
ls
4f290348 Tomer Brisker
echo "Trying /EFI/fedora/shim.efi "
d96043f5 Tomer Brisker
unset chroot
0462f797 Lukas Zapletal
# add --efidisk-only when using Software RAID
d96043f5 Tomer Brisker
search --file --no-floppy --set=chroot /EFI/fedora/shim.efi
if [ -f ($chroot)/EFI/fedora/shim.efi ]; then
chainloader ($chroot)/EFI/fedora/shim.efi
echo "Found /EFI/fedora/shim.efi at $chroot, attempting to chainboot it..."
4f290348 Tomer Brisker
sleep 2
boot
fi
echo "Trying /EFI/fedora/grubx64.efi "
d96043f5 Tomer Brisker
unset chroot
0462f797 Lukas Zapletal
# add --efidisk-only when using Software RAID
d96043f5 Tomer Brisker
search --file --no-floppy --set=chroot /EFI/fedora/grubx64.efi
if [ -f ($chroot)/EFI/fedora/grubx64.efi ]; then
chainloader ($chroot)/EFI/fedora/grubx64.efi
echo "Found /EFI/fedora/grubx64.efi at $chroot, attempting to chainboot it..."
4f290348 Tomer Brisker
sleep 2
boot
fi
echo "Trying /EFI/redhat/shim.efi "
d96043f5 Tomer Brisker
unset chroot
0462f797 Lukas Zapletal
# add --efidisk-only when using Software RAID
d96043f5 Tomer Brisker
search --file --no-floppy --set=chroot /EFI/redhat/shim.efi
if [ -f ($chroot)/EFI/redhat/shim.efi ]; then
chainloader ($chroot)/EFI/redhat/shim.efi
echo "Found /EFI/redhat/shim.efi at $chroot, attempting to chainboot it..."
4f290348 Tomer Brisker
sleep 2
boot
fi
echo "Trying /EFI/redhat/grubx64.efi "
d96043f5 Tomer Brisker
unset chroot
0462f797 Lukas Zapletal
# add --efidisk-only when using Software RAID
d96043f5 Tomer Brisker
search --file --no-floppy --set=chroot /EFI/redhat/grubx64.efi
if [ -f ($chroot)/EFI/redhat/grubx64.efi ]; then
chainloader ($chroot)/EFI/redhat/grubx64.efi
echo "Found /EFI/redhat/grubx64.efi at $chroot, attempting to chainboot it..."
4f290348 Tomer Brisker
sleep 2
boot
fi
echo "Trying /EFI/centos/shim.efi "
d96043f5 Tomer Brisker
unset chroot
0462f797 Lukas Zapletal
# add --efidisk-only when using Software RAID
d96043f5 Tomer Brisker
search --file --no-floppy --set=chroot /EFI/centos/shim.efi
if [ -f ($chroot)/EFI/centos/shim.efi ]; then
chainloader ($chroot)/EFI/centos/shim.efi
echo "Found /EFI/centos/shim.efi at $chroot, attempting to chainboot it..."
4f290348 Tomer Brisker
sleep 2
boot
fi
echo "Trying /EFI/centos/grubx64.efi "
d96043f5 Tomer Brisker
unset chroot
0462f797 Lukas Zapletal
# add --efidisk-only when using Software RAID
d96043f5 Tomer Brisker
search --file --no-floppy --set=chroot /EFI/centos/grubx64.efi
if [ -f ($chroot)/EFI/centos/grubx64.efi ]; then
chainloader ($chroot)/EFI/centos/grubx64.efi
echo "Found /EFI/centos/grubx64.efi at $chroot, attempting to chainboot it..."
4f290348 Tomer Brisker
sleep 2
boot
fi
38d2bf3c Ewoud Kohl van Wijngaarden
echo "Trying /EFI/rocky/shim.efi "
unset chroot
# add --efidisk-only when using Software RAID
search --file --no-floppy --set=chroot /EFI/rocky/shim.efi
if [ -f ($chroot)/EFI/rocky/shim.efi ]; then
chainloader ($chroot)/EFI/rocky/shim.efi
echo "Found /EFI/rocky/shim.efi at $chroot, attempting to chainboot it..."
sleep 2
boot
fi
echo "Trying /EFI/rocky/grubx64.efi "
unset chroot
# add --efidisk-only when using Software RAID
search --file --no-floppy --set=chroot /EFI/rocky/grubx64.efi
if [ -f ($chroot)/EFI/rocky/grubx64.efi ]; then
chainloader ($chroot)/EFI/rocky/grubx64.efi
echo "Found /EFI/rocky/grubx64.efi at $chroot, attempting to chainboot it..."
sleep 2
boot
fi
29e1c27b Mike Rochefort
echo "Trying /EFI/almalinux/shim.efi "
unset chroot
# add --efidisk-only when using Software RAID
search --file --no-floppy --set=chroot /EFI/almalinux/shim.efi
if [ -f ($chroot)/EFI/almalinux/shim.efi ]; then
chainloader ($chroot)/EFI/almalinux/shim.efi
echo "Found /EFI/almalinux/shim.efi at $chroot, attempting to chainboot it..."
sleep 2
boot
fi
echo "Trying /EFI/almalinux/grubx64.efi "
unset chroot
# add --efidisk-only when using Software RAID
search --file --no-floppy --set=chroot /EFI/almalinux/grubx64.efi
if [ -f ($chroot)/EFI/almalinux/grubx64.efi ]; then
chainloader ($chroot)/EFI/almalinux/grubx64.efi
echo "Found /EFI/almalinux/grubx64.efi at $chroot, attempting to chainboot it..."
sleep 2
boot
fi
4f290348 Tomer Brisker
echo "Trying /EFI/debian/grubx64.efi "
d96043f5 Tomer Brisker
unset chroot
0462f797 Lukas Zapletal
# add --efidisk-only when using Software RAID
d96043f5 Tomer Brisker
search --file --no-floppy --set=chroot /EFI/debian/grubx64.efi
if [ -f ($chroot)/EFI/debian/grubx64.efi ]; then
chainloader ($chroot)/EFI/debian/grubx64.efi
echo "Found /EFI/debian/grubx64.efi at $chroot, attempting to chainboot it..."
4f290348 Tomer Brisker
sleep 2
boot
fi
echo "Trying /EFI/ubuntu/grubx64.efi "
d96043f5 Tomer Brisker
unset chroot
0462f797 Lukas Zapletal
# add --efidisk-only when using Software RAID
d96043f5 Tomer Brisker
search --file --no-floppy --set=chroot /EFI/ubuntu/grubx64.efi
if [ -f ($chroot)/EFI/ubuntu/grubx64.efi ]; then
chainloader ($chroot)/EFI/ubuntu/grubx64.efi
echo "Found /EFI/ubuntu/grubx64.efi at $chroot, attempting to chainboot it..."
4f290348 Tomer Brisker
sleep 2
boot
fi
echo "Trying /EFI/sles/grubx64.efi "
d96043f5 Tomer Brisker
unset chroot
0462f797 Lukas Zapletal
# add --efidisk-only when using Software RAID
d96043f5 Tomer Brisker
search --file --no-floppy --set=chroot /EFI/sles/grubx64.efi
if [ -f ($chroot)/EFI/sles/grubx64.efi ]; then
chainloader ($chroot)/EFI/sles/grubx64.efi
echo "Found /EFI/sles/grubx64.efi at $chroot, attempting to chainboot it..."
4f290348 Tomer Brisker
sleep 2
boot
fi
echo "Trying /EFI/opensuse/grubx64.efi "
d96043f5 Tomer Brisker
unset chroot
0462f797 Lukas Zapletal
# add --efidisk-only when using Software RAID
d96043f5 Tomer Brisker
search --file --no-floppy --set=chroot /EFI/opensuse/grubx64.efi
if [ -f ($chroot)/EFI/opensuse/grubx64.efi ]; then
chainloader ($chroot)/EFI/opensuse/grubx64.efi
echo "Found /EFI/opensuse/grubx64.efi at $chroot, attempting to chainboot it..."
4f290348 Tomer Brisker
sleep 2
boot
fi
echo "Trying /EFI/Microsoft/boot/bootmgfw.efi "
d96043f5 Tomer Brisker
unset chroot
0462f797 Lukas Zapletal
# add --efidisk-only when using Software RAID
d96043f5 Tomer Brisker
search --file --no-floppy --set=chroot /EFI/Microsoft/boot/bootmgfw.efi
if [ -f ($chroot)/EFI/Microsoft/boot/bootmgfw.efi ]; then
chainloader ($chroot)/EFI/Microsoft/boot/bootmgfw.efi
echo "Found /EFI/Microsoft/boot/bootmgfw.efi at $chroot, attempting to chainboot it..."
4f290348 Tomer Brisker
sleep 2
boot
89eaa0b6 Kamil Szubrycht
fi
7d603148 Lukáš Zapletal
echo "Partition with known EFI file not found, you may want to drop to grub shell"
echo "and investigate available files updating 'pxegrub2_chainload' template and"
echo "the list of known filepaths for probing. Available devices are:"
694b95f2 Lukas Zapletal
echo
ls
echo
7d603148 Lukáš Zapletal
echo "If you cannot see the HDD, make sure the drive is marked as bootable in EFI and"
echo "not hidden. Boot order must be the following:"
echo "1) NETWORK"
echo "2) HDD"
694b95f2 Lukas Zapletal
echo
dd8ff395 Lukas Zapletal
echo "The system will poweroff in 2 minutes or press ESC to poweroff immediately."
4f290348 Tomer Brisker
sleep -i 120
dd8ff395 Lukas Zapletal
halt
89eaa0b6 Kamil Szubrycht
}

4f290348 Tomer Brisker
menuentry 'Chainload into BIOS bootloader on first disk' --id local_chain_legacy_hd0 {
89eaa0b6 Kamil Szubrycht
set root=(hd0,0)
chainloader +1
4f290348 Tomer Brisker
boot
89eaa0b6 Kamil Szubrycht
}

4f290348 Tomer Brisker
menuentry 'Chainload into BIOS bootloader on second disk' --id local_chain_legacy_hd1 {
89eaa0b6 Kamil Szubrycht
set root=(hd1,0)
chainloader +1
4f290348 Tomer Brisker
boot
89eaa0b6 Kamil Szubrycht
}

0ed80f45 Ondřej Ezr
common="rootflags=loop root=live:/fdi.iso rootfstype=auto ro rd.live.image acpi=force rd.luks=0 rd.md=0 rd.dm=0 rd.lvm=0 rd.bootif=0 rd.neednet=0 nokaslr nomodeset proxy.url=http://foreman.example.com proxy.type=foreman BOOTIF=01-$net_default_mac"
f7e8785b Tomer Brisker
if [ ${grub_platform} == "pc" ]; then
menuentry 'Foreman Discovery Image' --id discovery {
linux boot/fdi-image/vmlinuz0 ${common}
initrd boot/fdi-image/initrd0.img
}
else
menuentry 'Foreman Discovery Image EFI' --id discovery {
linuxefi boot/fdi-image/vmlinuz0 ${common}
initrdefi boot/fdi-image/initrd0.img
}
fi
d96043f5 Tomer Brisker