What's your kernel workflow?

I'm look at developing a patch and am familiar with the Linux patch process and have read through the FreeBSD docs and pinned material. On Linux I typically use qemu and boot directly to my locally built kernel using -kernel. Can anyone share how they test and iterate when working on FreeBSD, share any scripts they might use, specifically for patches that do not require physical hardware for testing?
 
Here's a good article on building images, for some more high-level info.

To speed up image building process, you can:

- make a ZFS dataset for the image tree
- make installworld and make distribution to it
- zfs snapshot it
- make installkernel

Now when you make kernel updates, rollback to the snapshot and installkernel again. Or clone fresh from the snapshot and installkernel there.
 
I use physical machines, usually PXE (diskless) booted. Some of them have serial consoles for debugging.

I just wish I could debug `pxeboot` somehow :)
Can you elaborate a bit, please? What cables needed, USB/serial? If you could paste even a bunch of commands, it'd be greatly appreciated.
 

Most of my mainboards support serial console in the BIOS. I have a 16-port serial PCIe card in a central machine connected to a few mainboards.
Would you mind sharing how to improve PXE especially NFS performance? I already can boot on Intel NUC directly connected to the extra ue0 interface on the host machine. Still resolving some NFS related permissions issues but in general, it's waaaay to slow even in such scenario. I dump the traffic and it seems that only 1kB packet UDP communication is used for NFS.

Please, would you mind sharing any tips or configs, how to make this diskless rw NFS setup a bit more usable? Moreover, still cannot get the multi-user mode...

Is this PXE's client side NFS somehow configurable, or this should go into loader.conf... any light would be greatly appreciated :-)
 
you can build pxeloader to use tftp instead of nfs (or at least it was possible in the past)
I don't think so. IMHO, TFTP transfers the boot loader but then NFS is in charge to mount the root filesystem. TFTP (operated via dnsmasq in my case) works perfectly.
 
Would you mind sharing how to improve PXE especially NFS performance? I already can boot on Intel NUC directly connected to the extra ue0 interface on the host machine. Still resolving some NFS related permissions issues but in general, it's waaaay to slow even in such scenario. I dump the traffic and it seems that only 1kB packet UDP communication is used for NFS.

Please, would you mind sharing any tips or configs, how to make this diskless rw NFS setup a bit more usable? Moreover, still cannot get the multi-user mode...

Is this PXE's client side NFS somehow configurable, or this should go into loader.conf... any light would be greatly appreciated :-)

My performance with PXE and NFS sucks, too. I am throwing hardware at the problem (U.2 SSDs and 10 Gbit/s Ethernet). On some mainboards the kernel load is atrociously long, on others fast. In addition, right now FreeBSD's pxeboot hangs on my main PXE mainboard. I have never been able to have the root filesystem on NFS4 either, just the ones from fstab. So it's all a bit in shambles right now. I need to do some kernel debugging and will have to set up a bhyve VM for it.

I never had problems not reaching multi-user runlevel, though.
 
Last edited:
loader got to big but it kinda works with older loaders from 11.x, etc
i have a bunch of nucs that wont work with a pxeloader past 12.x
if you build a custom, smaller loader it will probably work
you can set loading to tftp while you are at it
 
My performance with PXE and NFS sucks, too. I am throwing hardware at the problem (U.2 SSDs and 10 Gbit/s Ethernet). ...

I never had problems not reaching multi-user runlevel, though.
Sorry for that and great to hear that simultaneously. I finally have multi-user and I see no NFS related complains during the boot.

But I cannot log in, despite I tried to vipw root password but with no luck to get in. Using openssl passwd -6 for the hash.

For completeness, my /etc/fstab on the PXE guest is:
Code:
10.0.0.1:/zroot/nfsroot / nfs rw,vers=3,hard,intr,tcp,rsize=8192,wsize=8192 0 0

Regarding the root image on the host (the NFS root), I just downloaded the kernel.txz and base.txz and unpacked them as root into the NFS root thinking that might be enough. Then I chrooted into it and ran that vipw.
 
When you say "cannot log in", what exactly happens?

Just unpacking the tarfiles is what I do, too.
Simply put, I've tried a couple of methods how to update /etc/master.passwd, lastly I found SirDice 's recommendation to use:
echo "<newpassword>" | pw usermod username -h 0 potentially with -n. But... still when I try to log-in as root on the PXE guest I receive:

Login incorrect

For completeness again, I downloaded {base, kernel}.txz from the latest 15.0-CURRENT. If something I can see, then cron prints on console:

Code:
_secure_path: cannot stat /root/.login_conf: Permission denied

I suspect NFS mangled some permissions or something...

EDIT. For some reason I was able to tcpdump some failures for NFS trying to acces /etc on the host. No idea why yet...
Code:
22:12:59.584557 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 156)
    10.0.0.79.3com-amp3 > 10.0.0.1.nfsd: Flags [P.], cksum 0x90c0 (correct), seq 5428:5532, ack 8309, win 6528, options [nop,nop,TS val 2306840303 ecr 4111503792], length 104: NFS request xid 89390033 100 lookup fh Unknown/65884955DE78FF780A0006AF000000006BC70C000000000000000000 "etc"
22:12:59.584601 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 172)
    10.0.0.1.nfsd > 10.0.0.79.3com-amp3: Flags [P.], cksum 0x9349 (correct), seq 8309:8429, ack 5532, win 29128, options [nop,nop,TS val 4111503792 ecr 2306840303], length 120: NFS reply xid 89390033 reply ok 116 lookup ERROR: No such file or directory
 
Back
Top