Network: Diskless Booting II: Setting up the client

(last edit: 2001-05-01)

Setting up the client

As far as I know there are two ways of booting your client: via 'netboot' or via 'etherboot'. You can find netboot in the '/usr/src/sys/i386/boot/netboot' dir providing that you have installed the 'sys' source. I didn't use netboot and I won't discuss it here. You don't realy install the Etherboot on your system, you just get the source and you install it in a bootrom or on a floppy. You can get the source via the etherboot port which is '/usr/ports/net/etherboot'. Just type a 'make'. After the make you should have at least the following dirs: /usr/ports/net/etherboot/work/etherboot-4.7.22 /usr/ports/net/etherboot/work/etherboot-4.7.22/src /usr/ports/net/etherboot/work/etherboot-4.7.22/src/bin32 First of all you have to edit the following file: '/usr/ports/net/etherboot/work/etherboot-4.7.22/src/Config' Here is an example of a working version: --- #Booting CFLAGS32+= -DNO_DHCP_SUPPORT -DASK_BOOT=0 -DANS_DEFAULT=ANS_NETWORK #Kernel images CFLAGS32+= -DELF_IMAGE -DAOUT_IMAGE -DIMAGE_FREEBSD #Console CFLAGS32+= -DCONSOLE_DUAL -DCOMCONSOLE=0x3F8 -DCONSPEED=9600 #Tweaking CFLAGS32+= -DBACKOFF_LIMIT=7 -DUSE_INTERNAL_BUFFER # These flags affect the loader that is prepended to the Etherboot image LCONFIG+= -DMOVEROM # you should normally not need to change these RM= rm -f TOUCH= touch CC32= gcc LD32= ld SIZE32= size AR32= ar RANLIB32= ranlib # If you use egcs or gcc-2.8, using -Os may help to reduce the code size. # Otherwise use -O2 (under no circumstance use -O3 or above!). CFLAGS32+= -O2 -g -fstrength-reduce -fomit-frame-pointer -m386 # Squeeze the code in as little space as possible. CFLAGS32+= -malign-jumps=1 -malign-loops=1 -malign-functions=1 CFLAGS32+= -Wall -W -Wno-format -Wno-unused ASFLAGS32= LDFLAGS32+= -N -Ttext $(RELOCADDR) -e _start LDBINARY32= -oformat binary # flag for headerless binary --- All the options are explained at the top of the file but I've copied the ones I've used for you: -DNO_DHCP_SUPPORT- Use BOOTP instead of DHCP -DASK_BOOT=n - Ask "Boot from Network or from Local? " at startup, timeout after n seconds (0 = no timeout) -DANS_DEFAULT=ANS_NETWORK - Assume Network to previous question (alternative: ANS_LOCAL) on timeout or Return key -DAOUT_IMAGE - Add a.out kernel boot support (generic) -DELF_IMAGE - Add generic ELF kernel boot support (recommended) -DIMAGE_FREEBSD - Add FreeBSD image loading support (requires at least -DAOUT_IMAGE and/or -DELF_IMAGE) -DCONSOLE_DUAL - set for CRT and serial console, see comment at -DANSIESC and -DGFX -DCOMCONSOLE - set port, e.g. 0x3F8 -DCONSPEED - set speed, e.g. 57600 -DBACKOFF_LIMIT - sets the maximum RFC951 backoff exponent to n. Do not set this unreasonably low, because on networks with many machines they can saturate the link (the delay corresponding to the exponent is a random time in the range 0..3.5*2^n seconds). Use 5 for a VERY small network (max. 2 minutes delay), 7 for a medium sized network (max. 7.5 minutes delay) or 10 for a really huge network with many clients, frequent congestions (max. 1 hour delay). -DUSE_INTERNAL_BUFFER - Define to keep buffers internal to Etherboot space (recommended). Undefine to put some buffers below 0x10000 which may interfere with other programs. Making a floppy Make sure there is a good 1.44MB floppy in the diskdrive. Go to the dir '/usr/ports/net/etherboot/work/etherboot-4.7.22/src' and type 'gmake bin32/[NICTYPE].fd0'. Replace the [NICTYPE] with your nic. If you have an NIC with a RealTek chip and a floppy drive situated at 'fd0' then it would be: 'gmake bin32/rtl8139.fd0'. Note that there is no file called 'bin32/rtl8139.fd0', this is because the '.fd0' indicates which destination to use. Your floppy has been created if the gmake finishes without errors . Making a kernel You NEED to make a new kernel for the client because you have to specify some bootp options (and while youre at it you can stip those options out which aren't relevant for the client). Copy your kernel file to a new one, strip irrelevant options and add the following: options BOOTP # Use BOOTP to obtain IP address/hostname options BOOTP_NFSROOT # NFS mount root filesystem using BOOTP info options BOOTP_NFSV3 # Use NFS v3 to NFS mount root options BOOTP_COMPAT # Workaround for broken bootp daemons. options BOOTP_WIRED_TO=fxp0 # Use interface fxp0 for BOOTP Set the device at 'BOOTP_WIRED_TO=' to the correct one. In case of a RealTek chip use: 'BOOTP_WIRED_TO=rl0'. Make the new kernel, do a 'configure [KERNEL NAME]', 'make depend' and a 'make' DON'T DO a 'make install' because you'll override your kernel. Copy the '/usr/src/sys/compile/[KERNELNAME]/kernel' file to your rootfs dir (in this case we had specified the dir '/usr/diskless'). Making a rootfs You have to make copy or you have to copy a part of your filesystem to the rootfs dir you've specified. In this case that would be '/usr/diskless' the size of your rootfs depends entirely on what you would like te do with the diskless client. I've managed to strip the rootfs to 16MB but then it does only a 'ls', 'tar', 'mount' and some other basic thing. If you don't know what you need then start with a full copy of your own filesystem. In any case make sure you've changed the following files to apply to your client: /[rootfs]/etc/crontab /[rootfs]/etc/exports /[rootfs]/etc/fstab /[rootfs]/etc/group /[rootfs]/etc/hosts /[rootfs]/etc/hosts.allow /[rootfs]/etc/inetd.conf /[rootfs]/etc/master.passwd /[rootfs]/etc/passwd /[rootfs]/etc/rc.conf /[rootfs]/etc/resolv.conf And offcourse all files which are important for the programs you want to run or are running. Previous is Setting up the server Next up is Automating things

Click here to go back to the index.