FreeBSD crossbuild and test kernel/world via netboot ---------------------------------------------------- The motivation for this procedure is to reduce the many steps with iso images one has to complete when analyzing, fixing kernel issues on slow machines. The notes below focus on powerpc(64) but with small modifications it should be usable on other archs as well. Prerequisites: -------------- - Crossbuild machine - NFS server - DHCP/TFTP server - A source tree which is under svn control. (Makes syncing easier.) Crossbuild machine: ------------------- Here you have the choice, I took one of the fastest machines I have, an amd64 with lots of RAM and a few cores. The faster the better :) But you don't need to have a really fast machine. It only makes the process a bit faster. On this machine you need enough space to build world and kernel for your target. NFS server: ----------- To make your tree available to the boot process you need an NFS server. This server can be the same machine as the crossbuild one. But doesn't need to be. DHCP/TFTP server: ----------------- For simplicity I combine the NFS service and the DHCP/TFTP service on the same machine. For the DHCP service I use this: isc-dhcp41-server from the ports collection. Source tree: ------------ My notes concentrate on head, aka. -CURRENT. Find a place where to you want to have the source tree. It is not necessary that you place it under /usr. Once you found a place, with enough space, you should make a sym link under /usr to point to the svn src. Like this under /usr: src -> /export/devel/fbsd/src To get the source follow the notes about anon svn from the below link. http://wiki.freebsd.org/SubversionPrimer Configuration: -------------- - /etc/rc.conf: nfs_server_enable="YES" rpcbind_enable="YES" inetd_enable="YES" rpc_statd_enable="YES" rpc_lockd_enable="YES" - NFS server: Export the directory (/etc/exports) where you install the world. /export/netboot/powerpc64 -maproot=root -network 192.168.225.0 - DHCP add something like the below to your dchpd.conf: host { hardware ethernet ; fixed-address ; next-server ; filename "loader.ppc64"; option root-path "/export/netboot/powerpc64"; } The hardware ethernet address you'll find either on the case of your, PowerMac, you have to remove the side board and the you'll see it. Or you gather it via OSX or OF. You do not need to enable dhcpd in rc.conf, use onestart/stop instead. /usr/local/etc/rc.d/isc-dhcpd onestart/onestop - TFTP: /etc/inetd.conf: tftp dgram udp wait root /usr/libexec/tftpd tftpd -n -o -d -d -l -s /tftpboot Create a /tftpboot directory and place the loader there, check the rw permissions. /tftpboot -r-xr-xr-x 1 root wheel 245284 Feb 11 09:17 loader.ppc64 Crossbuild: ----------- Under /usr/src: Initial build: -------------- - 'make buildworld buildkernel TARGET=powerpc TARGET_ARCH=powerpc64' (to be faster you can use -jN) - 'make installworld installkernel distribution TARGET=powerpc \ TARGET_ARCH=powerpc64 DESTDIR=/place/where/to-install' (DESTDIR must be used, otherwise you overwrite your builders binaries.) - copy the loader from DESTDIR/boot to /tftpboot and set the permissions for the loader. To avoid confusions I renamed the loader to loader.ppc64. Rebuild kernel: --------------- If you test kernels you do not need to rebuild world, you can use the one already built. If you're working on a particular file you can speed up the kernel build with this: 'make -DNO_CLEAN buildkernel TARGET=powerpc TARGET_ARCH=powerpc64' 'make installkernel TARGET=powerpc TARGET_ARCH=powerpc64 \ DESTDIR=/place/where/to-install' You can even make it faster if you do not need modules, then you pass additionaly -DNO_MODULES to the make command line above. Netbooting on powerpc(64): -------------------------- - enter into OF with cmd-alt-o-f - on the OF prompt enter the following and press enter/return: boot enet:0,loader.ppc64 The powerpc should be able to download the loader.ppc64 from the TFTP server. You should see an abvious progress on the screen :) In case something does not work as expected you'll find some information here in the log files. On the DHCP/TFTP server here: - /var/log/messages - /var/log/xferlog Now the PowerMac should boot the kernel. In case it works successful, the machine displays the boot progress and reports about devices found etc. To work with netbooted systems, details will follow.