Date: Tue, 25 Jul 2006 20:49:27 +0200 From: des@des.no (Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?=) To: Eric Anderson <anderson@centtech.com> Cc: freebsd-fs@freebsd.org Subject: Re: Advice for hacking on ufs/ffs Message-ID: <86lkqheczs.fsf@xps.des.no> In-Reply-To: <44C6430D.1050506@centtech.com> (Eric Anderson's message of "Tue, 25 Jul 2006 11:13:01 -0500") References: <20060724185205.17021.qmail@web31812.mail.mud.yahoo.com> <86wta1en0e.fsf@xps.des.no> <44C6430D.1050506@centtech.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Eric Anderson <anderson@centtech.com> writes: > DES - anything special with the nfs root'ed box, to make this work > well? Not really. Here's a short summary. Assume you have a spare disk in your workstation, ad1, which you are going to use for your test box. Create and populate a file system for your test box: % mkdir /box % echo '/dev/ad1 /box ufs rw 2 2' >>/etc/fstab % newfs -U /box % mount /box % mergemaster -i -D /box % cd /usr/src % make installworld DESTDIR=3D/box Check out a source tree: % cd /box/usr % cvs -R -q -d /home/ncvs co -P src Chroot into your sandbox: % echo 'devfs /box/dev devfs rw 0 0' >>/etc/fstab % mount /box/dev % chroot /box /bin/sh At this point you want to create an appropriate make.conf and kernel config for your test box. Useful make.conf settings include: # build *everything* with debugging symbols DEBUG_FLAGS ?=3D -g # and leave them in when installing STRIP =3D # empty # don't clean out your previous build before rebuilding the kernel - # you'll be doing that a lot NO_KERNELCLEAN =3D YES When you are ready, build and install world and kernel: [still inside the chroot] % cd /usr/src % make buildworld buildkernel && make installworld installkernel You don't really need to chroot; you can do everything outside the sandbox, making sure that DESTDIR and __MAKE_CONF are correctly defined. I find it easier to work in a chroot because it saves me from having to remember just that. If you're going to use a serial console, kick up the speed a notch: [still inside the chroot] % cat >>/boot/loader.conf <<EOF console=3D"comconsole" comconsole_speed=3D"115200" boot_verbose=3D"YES" EOF You'll also need an fstab: [still inside the chroot] % cat >>/etc/fstab <<EOF workstation:/box / nfs rw 0 0 md /tmp mfs rw,-s8m 0 0 md /var/tmp mfs rw,-s8m 0 0 md /var/run mfs rw,-s8m 0 0 EOF Now, outside the chroot, you need to set things up for PXE. First, you'll need to set up a DHCP server which will hand out an IP address to your test box and instruct it to get the loader and root file system from your workstation: % pkg_add -r isc-dhcp3-server % cat >/usr/local/etc/dhcp.conf <<EOF ddns-update-style none; authoritative; default-lease-time 86400; max-lease-time 604800; subnet 10.0.0.0 netmask 255.255.255.0 { option routers 10.0.0.1; option subnet-mask 255.255.255.0; option broadcast-address 10.0.0.255; option domain-name "example.com"; option domain-name-servers 10.0.0.1; host box { hardware ethernet 00:01:02:03:04:05; fixed-address box.example.com; next-server workstation.example.com; filename "pxeboot"; option root-path "/box"; } } EOF % echo 'dhcp_enable=3D"YES"' >>/etc/rc.conf % /usr/local/etc/rc.d/isc-dhcpd.sh start Of course, you also need to set up NFS and TFTP: [nfs] % echo 'nfs_server_enable=3D"YES"' >>/etc/rc.conf % echo 'mountd_enable=3D"YES"' >>/etc/rc.conf % echo '/box -maproot=3Droot -network 10.0.0.0 -mask 255.255.255.0' >>/etc/= exports % /etc/rc.d/nfsserver start % /etc/rc.d/mountd start [tftp] % mkdir /tftpboot % cp /box/boot/pxeboot /tftpboot % sed -i.bak -e 's/^#tftp/tftp/' /etc/inetd.conf % echo 'inetd_enable=3D"YES"' >>/etc/rc.conf % /etc/rc.d/inetd start At this point, if I didn't miss anything, you should be able to just switch on your test box and watch it boot. DES --=20 Dag-Erling Sm=F8rgrav - des@des.no
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86lkqheczs.fsf>