UEFI + Legacy BIOS TFTP/PXELINUX
John G Heim
jheim at math.wisc.edu
Fri Jul 6 17:14:03 CEST 2018
Sorry to reply to your posts out of order but I would not follow the
advice in that message. It is at least out dated. You do not have to
change your dhcp config after each install and you can continue to use
your fai-chboot config files. Syslinux does support EFI booting. It's
in the syslinux-efi package.
Here is the code in my dhcp config file that sets the filename option
depending on EFI/BIOS boot:
=== begin ===
# tell a kernel how to boot via PXE or NFS
server-name faiserver;
next-server faiserver;
# Check pxe boot code #93 to determine whether we are booting via BIOS
or EFI
# 2018-07-04: jheim
option architecture-type code 93 = unsigned integer 16;
class "pxeclients" {
match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
if option architecture-type = 00:00 {
filename "fai/pxelinux.0";
} else {
filename "fai/syslinux.efi64";
}
}
=== end ===
The file syslinux.efi64 is from the debian syslinux-efi package. It's
original name/path was /usr/lib/SYSLINUX.EFI/efi64/syslinux.efi. I
renamed it syslinux.efi64 to distinguish it from the 32-bit syslinux.efi
file. Then I decided not to bother with 32-bit EFI boots. You also need
some libs in your tftp directory to support EFI booting via syslinux. I
think if you modify your dhcp config as abobe, copy the necessary files
from the syslinux-efi package to your tftp space, you'll successfully
boot into the FAI install. You will also need to create new disk config
files to partition via gpt instead of msdos. (More on that below.)
1. Cut/passte above code into your dhcp config.
2. apt-get install syslinux-efi
3a. cp /usr/lib/SYSLINUX.EFI/efi64/syslinux.efi /srv/tftp/fai/
3b. cp /usr/lib/syslinux/modules/efi64/ldlinux.e64 /srv/tftp/fai/
Done with the boot stuff. Now the disk config stuff. Code that detects
whether you have booted via BIOS or EFI already exists in the fai-doc
examples. It's in a class script called 60-grub. It creates either
GRUB_PC or GRUB_EFI class. You have to retain your old BIOS disk config
files for older machines. I used to create a class called LARGEDISK for
disks large enough to partition into /, /var/ usr, ... So I just renamed
that GRUB_PC. Then I copied that file to GRUB_EFI andmodified it for
gpt partitioning and EFI boot. It looks like this:
=== begin ===
# 2018-07-04: jheim
disk_config disk1 disklabel:gpt fstabkey:label align-at:1
primary /boot/efi 204800K vfat rw
primary /usr/local 157286400K ext4 rw,relatime
createopts="-L LOCALFS"
primary / 72G- ext4 rw,relatime
createopts="-L ROOTFS"
primary swap 8G swap rw
createopts="-L SWAPFS"
# EOF
=== end ===
On 07/06/2018 07:27 AM, Rémy Dernat wrote:
> Hi,
>
> I am trying to set up an UEFI boot pxe mainly because our hardware
> servers do not support full legacy BIOS anymore (particularly hard disk
> plugin on those servers).
>
> Our legacy pxelinux works just fine from a while now (and thanks for it).
>
> I followed this link :
> https://lists.uni-koeln.de/pipermail/linux-fai/2014-February/010294.html
> ... with no luck. I created an "UEFI" specific class to avoid the erase
> of DEFAULT, and put everything in that new class, because we will need
> to keep the pxelinux config.
>
> My tftp fai folder is organised like this:
> ```
> root at faiserv:/srv# tree -L 2
> .
> ├── fai
> │ ├── config
> │ └── nfsroot
> ├── nfs4
> └── tftp
> └── fai
>
> root at faiserv:/srv/tftp/fai# tree -L 2
> .
> ├── c2960s-universalk9-tar.150-2a.SE9.tar
> ├── cisco-ios-150-2a.tar -> c2960s-universalk9-tar.150-2a.SE9.tar
> ├── efi
> │ ├── fonts
> │ ├── grub.cfg
> │ ├── grub.cfg.nok
> │ ├── i386-pc
> │ ├── locale
> │ ├── pxelinux.cfg -> ../pxelinux.cfg
> │ ├── unicode.pf2
> │ └── x86_64-efi
> ├── gpxelinux.0
> ├── initrd.img-3.16.0-4-amd64
> ├── initrd.img-3.16.0-6-amd64
> ├── ldlinux.c32
> ├── lpxelinux.0
> ├── pxelinux.0
> ├── pxelinux.0.back
> ├── pxelinux.cfg
> │ ├── 0A01FD03
> │ ├── 0A01FFF2
> │ ├── A226B5A1.disable
> │ ├── A226B5A2.disable
> │ ├── A226B5A3.disable
> │ ├── A226B5A4.disable
> │ ├── A226B5A5.disable
> │ ├── A226B5A6.disable
> │ ├── A226B5A7.disable
> │ ├── A226B5A9
> │ ├── A226B5AA.disable
> │ ├── A226B5AB.disable
> │ ├── A226B5B0.disable
> │ ├── A226B5B4.disable
> │ ├── A226B5B8
> │ └── default
> ├── syslinux.efi
> ├── vmlinuz-3.16.0-4-amd64
> └── vmlinuz-3.16.0-6-amd64
>
> ```
>
> I do not know if the UEFI is also searching for a filename matching its
> IP address with the hexa value, so I created a symbolic link to the
> pxelinux.cfg parent directory...
>
>
> I have no problem with DHCP, and my client is loading the grub.cfg menu.
> However, it fails while searching for the nfsroot. The error I get (with
> debug=all) is (replacing sensitive informations):
> ```
> kern/disk.c:196 : Opening `tftp,IP.IP.IP.IP'...
> disk/efi/efidisk.c:461 : opening tftp
> kern/disk.c: 281: Opening `tftp,IP.IP.IP.IP' failed.
> kern/disk.c: 295: Closing `tftp'.
> ```
>
>
> Here is my grub.cfg config :
> ```
> root at faiserv:/srv/tftp/fai/efi# cat grub.cfg
> set menu_color_normal=white/black
> set menu_color_highlight=black/light-gray
> set timeout=5
> # for debug:
> #set pager=1
> set debug=all
>
> insmod efi_gop
> insmod efi_uga
> if loadfont ${prefix}/unicode.pf2
> then
> insmod gfxterm
> set gfxmode=auto
> set gfxpayload=keep
> terminal_output gfxterm
> fi
>
> menuentry "Install from FAI" {
> linux vmlinuz-3.16.0-6-amd64 rw ip=dhcp root=/dev/nfs
> nfsroot=IP.IP.IP.IP:/srv/fai/nfsroot
> FAI_FLAGS=verbose,sshd,createvt,reboot FAI_ACTION=install
> server=faiserv.acme.ltd FAI_CONFIG_SRC=nfs://faiserv.acme.ltd/srv/fai/config
> initrd initrd.img-3.16.0-6-amd64
> }
>
> ```
>
>
> Any help would be greatly appreciated.
>
> Thanks,
> Rémy
More information about the linux-fai
mailing list