Network booting detect BIOS vs UEFI

Hi, I see some very nice fedora documentation about automatically feeding BIOS and UEFI clients with the correct file:


# refer to RFC4758 for possible arch option values
option arch code 93 = unsigned integer 16;

subnet netmask {
if option arch = 00:07 {
filename "uefi/shim.efi";
} else {
filename "pxelinux.0";


My question is where do I put such configuration in LEDE?

Update: I figured I can put raw dnsmasq config in /et/dnsmasq.conf like:


The above works. I think it would be nice though to support this in uci. I tried this in /etc/config/dhcp:

config dnsmasq
     list dhcp_boot 'tag:!uefi,pxelinux.0'                                 
     list dhcp_boot 'tag:uefi,uefi/shim.efi'                               
     option dhcp_match 'set:uefi,option:client-arch,7'

But it turned out that dhcp-match option is not set at all in /var/etc/dnsmasq.conf.cfg02411c and instead of two dhcp-boot directives, only one ends up in there which is incorrect syntax for dnsmasq.

I guess that dnsmasq config generator needs to be improved for this to work.

I have these lines in my /etc/dnsmasq.conf for this purpose:



You can read about the dhcp-match and dhcp-boot options in the dnsmasq manual. In short, the dhcp-match lines sets one or more tags (internal dnsmasq identifier) based on the DHCP options the client sends. In my environment I have both legacy and UEFI clients, and I also utilize iPXE. When a legacy PXE ROM boots it will receive the legacy iPXE boot file (undionly.kpxe). When a UEFI ROM boots it will receive the UEFI version of iPXE (ipxe.efi). If iPXE boots (whether legacy or UEFI), it will receive a URL to the iPXE boot menu I want it to load.

1 Like

Thank you @makro , this is what really works and you gave me the other interesting magic values. I'm thinking that it would be good to have that supported in UCI as well. See the edit of my original post. I edited the post before I saw your reply.

In any case, it's very nice this is supported in the first place.

I believe the /etc/init.d/dnsmasq is where the /etc/config/dhcp file is processed and the proper dnsmasq config is generated. If you fix it, please send PR to the OpenWrt packages repo.