On 03/01/2025 10:40, Lluís Batlle i Rossell wrote:
here is a patch I used to be able to netboot Raspberry Pi (2B in my case).
Their bootcode.bin expects a proxy DHCP like for PXE, but it doesn't want a
filename+sname/tftp_name to fetch a file, but instead it requests DHCP
Option 66 (TFTP Server) to try to download a wide set of files.

I don't understand why this patch is necessary - I've netbooted a range of Raspberry Pis (3B, 3B+, 4B), both with and without proxy DHCP, using the options that currently exist in Dnsmasq. The most important one is

dhcp-option=option:tftp-server,<TFTP_IP>

where <TFTP_IP> is the IP address of either the TFTP server if proxy DHCP is being used or the interface on which Dnsmasq is responding to the DHCP discover message if not. Dnsmasq won't advertise the TFTP server in DHCP offers even if its TFTP server function is enabled, but a suitable dhcp-option line in the Dnsmasq configuration will suffice - it shouldn't be necessary to force the TFTP server to be advertised (with dhcp-option-force) because IIRC the Raspberry Pi boot ROM always requests it in its discover message.

To netboot old (<= 3B+) Raspberry Pis you'll also need

dhcp-reply-delay=1

to compensate for a bug in the boot ROM that causes DHCP responses to be lost if they're sent too soon after the request. You can gate both of these options being included in DHCP offers using tags that are set based either on the MAC address (dhcp-mac) for <= 3B+ devices or on the DHCP client ID for >= 4B devices.

The Dnsmasq instance being used as the TFTP server just requires TFTP to be enabled, and a suitable TFTP root containing bootcode.bin et al to be set:

enable-tftp
tftp-root=/path/to/tftp/root

It might be desirable to serve different TFTP files for each device, in which case

tftp-unique-root=mac

can be used for <= 3B+ devices - the bootloader firmware for >= 4B devices already has this capability, it just needs to be enabled in the bootloader configuration.

Best wishes,
Chris

_______________________________________________
Dnsmasq-discuss mailing list
Dnsmasq-discuss@lists.thekelleys.org.uk
https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss

Reply via email to