Heavily based on https://oshogbo.vexillium.org/blog/28/
You may want to look at the handbook first: https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/makeworld.html
freebsdsrc/.git clone https://github.com/freebsd/freebsd freebsdsrc
cd freebsdsrc
# If your system is 32-bit. cd sys/i386/conf/ # If your system is 64-bit. cd sys/amd64/conf/
cp GENERIC CUSTOM0MP
make -j$(sysctl -n hw.ncpu) buildkernel KERNCONF=CUSTOM0MP -DNO_CLEAN
Estimated time on Hasee Q540S running on a one processor: 2 hours.
Estimated time on Dell L702X running on 8 processors: 19 minutes.
freebsdsrc/ directory and build the world:make -j$(sysctl -n hw.ncpu) buildworld KERNCONF=CUSTOM0MP -DNO_CLEAN
Estimated time on Hasee Q540S running on a one processor: 8 hours.
Estimated time on Dell L702X running on 8 processors: 98 minutes.
/usr/home/0mp/CUSTOM0MP. Just add the following lines to /etc/src.conf to set it up:.if ${KERNCONF} == "CUSTOM0MP"
DESTDIR?=/usr/home/0mp/CUSTOM0MP
MODULES_OVERRIDE=md ufs
.endif
Remember to use spaces not tabs if you wish to indent the code.
sudo make distrib-dirs KERNCONF=CUSTOM0MP
Estimated time on Hasee Q540S running on a one processor: a few seconds.
make distribution KERNCONF=CUSTOM0MP
Estimated time on Hasee Q540S running on a one processor: 3 minutes.
sudo make installworld KERNCONF=CUSTOM0MP
Estimated time on Hasee Q540S running on a one processor: 5 minutes.
sudo make installkernel KERNCONF=CUSTOM0MP
Estimated time on Hasee Q540S running on a one processor: a few seconds.
vboxnet0) and click the Edit host-only network (Space) screwdriver button.The VirtualBox configuration is also covered by [the oshogbo's tutorial] in the VIRTUALBOX CONFIGURATION section.
Uncomment the
tftp dgram udp wait root /usr/libexec/tftpd tftpd -l -s /tftpboot
line from the /etc/inetd.conf file.
Edit it so that /tftpboot points to your kernel's root directory. In my case the line looks like this:
tftp dgram udp wait root /usr/libexec/tftpd tftpd -l -s /usr/home/0mp/CUSTOM0MP
inetd_enable="YES" to /etc/rc.conf and restart the service:sudo service inetd restart
pxeboot.sudo cp /boot/pxeboot /usr/home/0mp/CUSTOM0MP/boot/pxeboot
tftp localhost
Now in type get boot/pxeboot in the tftp prompt. You should get a message similar to:
Received 268289 bytes during 0.1 seconds in 526 blocks
You've just downloaded a copy of pxeboot to the current folder - you should probably delete it. See FAQ if you've got pxeboot files scattered around the system.
My custom0mp machine will be assigned the 192.168.56.103 IP address.
/etc/exports file:/usr/home/0mp/CUSTOM0MP -alldirs -maproot=0 -network 192.168.56.0 -mask 255.255.255.0
/etc/rc.conf:nfs_server_enable="YES"
sudo service nfsd restart
showmount -e
You should get an input like:
Exports list on localhost: /usr/home/0mp/CUSTOM0MP 192.168.56.0
/usr/home/0mp/CUSTOM0MP/etc/fstab:192.168.56.1:/usr/home/0mp/CUSTOM0MP / nfs rw 0 0
loader.conf and rc.conf.
Add the following lines to /usr/home/0mp/CUSTOM0MP/boot/loader.conf:
autoboot_delay="3" beastie_disable="YES" boot.nfsroot.options="nolockd,tcp"
Add the following lines to /usr/home/0mp/CUSTOM0MP/etc/rc.conf:
sshd_enable="YES" sendmail_enable="NO" sendmail_submit_enable="NO" sendmail_outbound_enable="NO" sendmail_msp_queue_enable="NO" cron_enable="NO" devd_enable="NO"
isc-dhcpd. For example with:sudo pkg install isc-dhcp43-server
/usr/local/etc/dhcpd.conf to suit your needs. Here's mine configuration:default-lease-time 600;
max-lease-time 7200;
ddns-update-style none;
# Set the subnet and the mask values the same as in /etc/exports.
subnet 192.168.56.0 netmask 255.255.255.0 {
authoritative;
use-host-decl-names on;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.56.255;
host custom0mp {
hardware ethernet 08:00:27:22:A9:64;
# The fixed IP address assigned to the virtual machine.
fixed-address 192.168.56.103;
# The path to the boot loader; it is relative to the root-path below.
filename "boot/pxeboot";
# The IP address that provides the NFS.
next-server 192.168.56.1;
# The path to the root directory over the NFS.
option root-path "/usr/home/0mp/CUSTOM0MP/";
}
}
/etc/rc.conf:dhcpd_enable="YES" dhcpd_ifaces="vboxnet0"
sudo service isc-dhcpd restart
This part is also covered in detail by the oshogbo's tutorial in the DHCP SERVER section.
This step is needed because DHCP probably failed to start since there had been no vboxnet0 interface before a virtual machine was launched. Now, as VirtualBox host-only network is up and running we want to restart the DHCP server.
sudo service isc-dhcpd restart
It might fail if vboxnet0 is not yet available.
You might need to restart your machine if the DHCP server isn't yet fully functional.
/etc/rc.conf:inetd_enable="YES" nfs_server_enable="YES" dhcpd_enable="YES" dhcpd_ifaces="vboxnet0"
pxeboot files scattered around? Whenever you do this to test whether your NFS is bootable:tftp localhost.get boot/pxeboot when prompted by tftp.Received 333825 bytes during 0.0 seconds in 655 blocks
You actually save a copy of the pxeboot file in the current working director when you do this. Hence the presence of those pxeboot files all over your system.
NFS ROOT: 192.168.56.1:/usr/home/0mp/CUSTOM0MP/
In my case I had to leave it for 3 hours to be able to log in on Hasee Q540S. It takes about a minute to boot over NFS on Dell L702X however.
passwd: could not lock the passwd file: Operation not supported
you might be missing boot.nfsroot.options="nolockd,tcp" from the boot/loader.conf file of your NFS.
If it doesn't help then try to tinker with rpc.lockd(8) and rpc.statd(8); I stumbled upon them as I was looking for the solution myself.