2016년 1월 30일 토요일

Detecting client architecture during PXE boot

According to IETF's RFC 4578 Dynamic Host Configuration Protocol (DHCP) Options for the Intel Preboot eXecution Environment (PXE), client system architecture type is denoted by a code in option 93. In the RFC, the following 10 types are listed:

Type   Architecture Name
            ----   -----------------
              0    Intel x86PC
              1    NEC/PC98
              2    EFI Itanium
              3    DEC Alpha
              4    Arc x86
              5    Intel Lean Client
              6    EFI IA32
              7    EFI BC
              8    EFI Xscale
              9    EFI x86-64

This option MUST be present in all DHCP and PXE packets sent by PXE-compliant clients and servers.


For my PXE server setup, I use dnsmasq. In its manpages and the default /etc/dnsmasq.conf however, the architecture codes are a bit different:

# Test for the architecture of a netboot client. PXE clients are
# supposed to send their architecture as option 93. (See RFC 4578)

#dhcp-match=peecees, option:client-arch, 0 #x86-32
#dhcp-match=itanics, option:client-arch, 2 #IA64
#dhcp-match=hammers, option:client-arch, 6 #x86-64
#dhcp-match=mactels, option:client-arch, 7 #EFI x86-64


RFC 4578 lists x86-64 EFI architecture as code '9' but most information I've found on the Internet about dhcpd and dnsmasq configs suggests that code '7' for option 93 denotes EFI x86-64...

Within the conf file for dnsmasq it is possible to make dhcp-boot send a specific boot image depending on whether the client architecture is detected as x86 BIOS or x64 EFI as follows:

dhcp-match=bios, option:client-arch, 0 #BIOS x86
dhcp-match=efi32, option:client-arch, 6 #IA32-EFI
dhcp-match=efi64, option:client-arch, 7 #EFI x86-64

...
# Load different PXE boot image depending on 'dhcp-match' tag
pxe-service=tag:bios, x86PC, "Install Linux on x86 legacy BIOS", pxelinux.0
pxe-service=tag:efi32, IA32-EFI,"Install Linux on IA32-EFI", bootx32.efi
pxe-service=tag:efi64, X86-64_EFI, "Install Linux on x86-64 UEFI", bootx64.efi


The client system types (i.e. x86PC, IA32-EFI, X86-64_EFI above) in pxe-service are defined in the dnsmasq manpages (and differ from some dnsmasq config examples I've found on the Internet) and are as follows:

The known types are x86PC, PC98, IA64_EFI, Alpha, Arc_x86, Intel_Lean_Client, IA32_EFI, BC_EFI, Xscale_EFI and X86-64_EFI; an integer may be used for other types.

The boot images above come from the syslinux project. Install this package on your Linux machine and then navigate to the directories for the bios, efi32, and efi64 boot images. In the case of Archlinux, the syslinux path is /usr/lib/syslinux and under this path are the architecture-specific directories .../bios, .../efi32, .../efi64

pxelinux.0 can be found under the bios directory, but the efi boot images for 32 and 64-bit architectures are different. The can be found under the efi32 and efi64 directories, respectively, but have the same name syslinux.efi. Along with the boot image for bios architectures, copy the efi boot images to the tftp-root path for your pxe server and rename them appropriately as bootx32.efi or bootx64.efi


댓글 없음:

댓글 쓰기