# hdw - linux FAI file

whats this?
-----------
explains how to setup a networked computer acting as dhcp/pxeboot/nfsroot fully
automated installation server to automate installing your favorite hdw-linux
distribution.

files:
------

./scripts/Create-FAI
./fai/*
./doc/FAI

procedure
---------

	1) install minimal nfsroot binaries

		vi Config [specify arch* variables]

	note: you dont need to specify fai-server as a target. we are just
	      going to install the nfsroot which will automate the install
	      process. the packages of the fai-server target have to be running
              on the computer on which you are right now following these
              instructions.

	note: you might want to fetch hdw binaries from a mirror.
	      edit your /etc/hdw-get.conf file.

		./scripts/Create-FAI <nfsroot>

		where <nfsroot> is the directory to install the fairoot.

	2) adapt the hdw-get.conf file in the fai nfsroot tree

	note: again you might want to use a mirror. edit hdw-get.conf, but make
	      sure it is the one from fairoot.

	3) edit the following files to match your needs, and restart services

		/etc/dhcpd.conf
		/etc/inetd.conf
		/etc/exports
		/tftpboot/pxelinux.cfg/{default,*}

		(have a look at chapter "fai server configuration")

	4) adapt configs in ./fai (see chapter "fai config files")

	5) pxeboot your install candidates. this is actually not fully
	   automated. have a look athe bootdisk section if your client does
	   not support pxeboot.

		- type "fai" on pxeboot prompt
		- after first bootup, use cfdisk to partition your harddisk
		- touch a disk_ready file in configuration space
		  (after using cfdisk, sync to disk file!)
		- reboot and finaly wathc your target system to get hdw'ed :)

	6) optional: login, build a new kernel or do other modifications.


fai config files
----------------

	config files reside in 1) ./fai/config/<client_ip>/ and 2) ./fai/files/
	directories.

	config dir:

		- the files reside in a subdirectory, which is simply the
		  clients ip address, as different clients may need different
		  config.
		- files:
			1) disk
			2) packages

			disk file is used to determine the partition layout and
			used harddisk. the format: (example, its intuitive!)

			# disk /dev/hda
			# swap 7
			1	/boot	ext3	format
			5	/	ext3	format
			6	/home	ext3	preserve

			packages file contains packages to get installed. you
			may use ./scripts/Helper -create_dist_files to create
			one. make sure that all the packages are available on
			the mirror, otherwise the fai install routine will
			break. hint: switch the partitions to "preserve" and
			hdw-get will not install already installed packages
			again.
			
	 files dir:

		- files called DEFAULT in a special directory will be copied to
		  every client to the file of its dirname.
		- files named like a clients ip address will be only copied to
		  that client (again, the file will be the dirname)

		example:

		./fai/files/etc/X11/XF86Config/DEFAULT will be copied to all
		clients as /etc/X11/XF86Config file.


fai server configuration
------------------------

there are several files you need to hack. here we go:

	- dhcpd:

		file: /etc/dhcpd.conf

		examples rule, have a look at the configuration for my fai
		client:

		...
		option routers 192.168.10.10;
		option domain-name-servers 192.168.10.50, 194.25.134.203;
		host compaq {
        		fixed-address 192.168.10.80;
        		hardware ethernet 00:50:8b:cb:8e:d2;
        		allow booting;
        		allow bootp;
        		next-server hackstation; # the fai server
        		server-name hackstation;
        		filename "pxelinux.0";
		}
		...

	- tftpboot (you will need tftp-hpa as tftpserver)

		the scripts prepared a working fai config file at
		/tftpboot/pxelinux.cfg, just add a symbolic link of your clients
		ip address (in hex, use: gethostip) pointing to fai.
		ofcourse you need to have the package syslinux installed.

	- nfsd:

		file: /etc/exports

		the scripts added export entries. just substitute "foobar" to
		the name or ip address of your fai clients.

	- inetd

		file: /etc/inetd.conf

		make sure the tftpboot line is uncommented. if you have problems
		of tftpd switching to user nobody google for solutions. if you
		are too lazy substitute "nobody" by "root in inetd.conf. this
		is dangerous though, you have been warned.

note: restart all the mentioned services.

bootdisk
--------

for computers old enough to not support pxe but having installed a piece
of hardware called floppy disk, you may create a bootdisk containing the
install kernel (the pxe stuff is replaced by the bootdisk).

- compile a customized kernel <= 1.3 mb. do not unset needed features!

	(use ./misc/arch/${hdw_arch}/linux.config as .config + modify)

- copy bzImage to fai/files/boot/vmlinuz_custom/<ip>

- create bootfloppy image

	dd if=/dev/zero of=bootdisk.img bs=1024 count=1440
	yes | mke2fs -q -i 40000 -m 0 bootdisk.img
	mkdir -p /mnt/tmp ; mount -o loop bootdisk.img /mnt/tmp
	mkdir -p /mnt/tmp/{boot,etc} ; cp bzImage /mnt/tmp/boot/vmlinuz
	cp misc/fai/lilo.conf /mnt/tmp/etc/lilo.conf
	(change boot, disk map and image values)
	touch /mnt/tmp/boot/map # enough? if not take yours from /boot
	lilo -C /mnt/tmp/etc/lilo.conf
	umount /mnt/tmp
	(you may store bootdisk.img in the clients config space)

	finaly: (create the boot floppy)

	dd if=bootdisk.img of=/dev/floppy/0

troubleshooting
---------------

contact me! -> http://www.hackdaworld.dyndns.org/contents/contact/
email: hackbard@hackdaworld.dyndns.org
irc: irc.hackdaworld.dyndns.org - #hackdaworld

greets
------

good luck now, you are own your own! enjoy hdw. :)

regards, hackbard.
