Page MenuHomeFreeBSD

Net boot: allow both tftpfs and nfs
ClosedPublic

Authored by bapt on Aug 24 2016, 1:46 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, May 1, 5:54 AM
Unknown Object (File)
Wed, May 1, 5:53 AM
Unknown Object (File)
Tue, Apr 9, 2:44 AM
Unknown Object (File)
Apr 2 2024, 12:34 AM
Unknown Object (File)
Mar 16 2024, 6:30 PM
Unknown Object (File)
Mar 13 2024, 10:40 PM
Unknown Object (File)
Jan 29 2024, 9:26 PM
Unknown Object (File)
Jan 27 2024, 1:46 PM

Details

Summary

Add a new "netproto" which can be set to NET_TFTP or NET_NFS
if one set the root-path to ip:path then the efi loader and the pxeboot
loader will consider it booting over nfs (meaning no breakage on the current
default behaviour.

to enable tftpfs the 150 dhcp option "tftp server address" should be passed
the loader will then accept 2 syntaxes for "root-path":
"/path": the ip address passed via the 150 option as the ip of the tftp server
"IP:/path": the ip address passed in the rootpath overwrites the one passed via
the 150 option

Test Plan

Tested on both loader.efi and pxeboot

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bapt retitled this revision from to Net boot: allow both tftpfs and nfs.
bapt updated this object.
bapt edited the test plan for this revision. (Show Details)
bapt added a reviewer: emaste.

Remove garbage
Also note that guards where added around libstand's net.h because it ends up
being included multiple time

lib/libstand/nfs.c
461 ↗(On Diff #19630)

Can nfs_open even be called when netproto != NET_NFS?

1106 ↗(On Diff #19630)

same question.

lib/libstand/tftp.c
405 ↗(On Diff #19630)

same question....

sys/boot/common/dev_net.c
171 ↗(On Diff #19630)

I didn't catch this last time, but how is rootip different than tftpip?

sys/boot/i386/libi386/pxe.c
327–333 ↗(On Diff #19630)

this code looks identical to the code in dev_net.c. Why not have a common routine?

sys/boot/common/dev_net.c
171 ↗(On Diff #19629)

Perhaps switch() since we'll hopefully have NET_HTTP added soon?

lib/libstand/nfs.c
461 ↗(On Diff #19630)

yes, each time you open a file it loops over all the filesystems if they are in error (file not found) which happens all the time:
boot.4th not there, all files are compressed in .gz so it first fail to find the non compressed version etc.
on the loop it keeps the error which is not EINVAL

sys/boot/common/dev_net.c
171 ↗(On Diff #19630)

tftpip is passed via the dhcp 150 option. to avoid being intrusive we set rootip based on it. then I describe on the summary how one can overwrite it playing to the format of the root-path

Concerning the switch() I would say we should do once NET_HTTP is there, NET_HTTP is more complicated we would need a libstand mini tcp stack

sys/boot/i386/libi386/pxe.c
327–333 ↗(On Diff #19630)

The whole pxe.c and common/dev_net.c are really similar, I think we should merge both later. replacing the pxe.c by comment/dev_net.c which is cleaner.

But I first need to go further in common/dev_net.c: I want to make the NETIF_OPEN_CLOSE_ONCE the default otherwise it makes the loading very slow: issuing a dhcp request at every file open (on tftp at least)

tsoome edited edge metadata.

I like the idea as such, so even as I don't really have much experience with freebsd netboot support as such, it does sound very reasonable.

This revision is now accepted and ready to land.Aug 31 2016, 12:53 PM
This revision was automatically updated to reflect the committed changes.