Trent W. Buck wrote: > 3. A single mount(2) call also works! > > It is quite annoying that we need *anything* special in userland, because > a nfsvers=4.2,sec=sys mount requires only 2049/tcp (no other ports/services), > and > the actual filesystem is in-kernel, so > really all that should be needed is enough of a C program to issue a single > mount(2)! > > As an experiment, I tried do compile in EXACTLY that, and it works for me: > > root@main:~# >nfsmount.c printf '#include <stdlib.h>\n#include > <sys/mount.h>\nint main() {exit(mount("10.0.2.100:/srv/netboot", "/mnt", > "nfs", 0, "vers=4.2,addr=10.0.2.100,clientaddr=10.0.2.15"));}' > root@main:~# klcc -o nfsmount nfsmount.c > root@main:~# ./nfsmount; echo $? > ./nfsmount; echo $? > Nov 17 10:11:31 main.lan kernel: process '/root/nfsmount' started with > executable stack > 0 > > This is pretty narrow in scope and is probably achievable. > It allows you to boot off NFSv4, without putting glibc into the initrd.
I had a go at actually packaging this (attached), but it turns out to be slightly harder than I thought (see comments in mount.nfs.c). I don't have time to pursue this further.
prisonpc-nfs4-client_11.0.tar.xz
Description: application/xz