Fwd: Adding Macs with FAI

Juri Grabowski fai-ml at lihas.de
Sat Jun 17 19:36:46 CEST 2017


Hello,

I would try this with ipxe as iso or usb drive or as new entry in your
bootloader + network boot with fai.
You can embed ipxe config to image or make use of your dhcp.
# just a part of dhcpd.conf from isc-dhcp-server package:
   if exists user-class and option user-class = "iPXE" {
	set hwmac = concat (
	suffix (concat ("0", binary-to-ascii (16, 8, "", substring(hardware,1,1))),2), ":",
	suffix (concat ("0", binary-to-ascii (16, 8, "", substring(hardware,2,1))),2), ":",
	suffix (concat ("0", binary-to-ascii (16, 8, "", substring(hardware,3,1))),2), ":",
	suffix (concat ("0", binary-to-ascii (16, 8, "", substring(hardware,4,1))),2), ":",
	suffix (concat ("0", binary-to-ascii (16, 8, "", substring(hardware,5,1))),2), ":",
	suffix (concat ("0", binary-to-ascii (16, 8, "", substring(hardware,6,1))),2)
	);

      filename = concat( "http://$FQDN/", hwmac );
   }

You need webserver on your fai-server.
In you http DocumentRoot you need symlinks like that:
ln -s /srv/tftp/fai/pxelinux.cfg/01-52-54-00-00-00-00 52:54:00:00:00:00
ln -s /srv/fai/stretch-nfsroot/boot/initrd.img-4.9.0-3-amd64 /var/www/html/stretch-initrd
ln -s /srv/fai/stretch-nfsroot/boot/vmlinuz-4.9.0-3-amd64 /var/www/html/stretch-kernel

And your fai-config template should looks like that:
#!ipxe
#dhcp
kernel http://$FQDN/stretch-kernel boot=live components root=live:http://$FQDN/stretch-squashfs.img noswap live aufs kernel.sysrq=1 sysrq_always_enabled log_buf_len=1M quickreboot consoleblank=0 keep_bootcon initrd=stretch-initrd rootwait=120 rd.live.image rd.neednet rd.luks=0 rd.lvm=0 rd.md=0 rd.dm=0 rd.driver.pre=loop rd.noverifyssl rd.skipfsck rd.live.overlay.check rd.live.overlay.reset rd.live.ram FAI_FLAGS=verbose,sshd,initial,createvt FAI_ACTION=install FAI_CONFIG_SRC=$YOUR_FAI_CONFIG_SRC LOGUSER=fai
initrd http://$FQDN/stretch-initrd
boot


Your Squashfs image you can build with: fai-cd -Mef -d "" stretch-squashfs.img
after "fai-chboot -c $TEMPLATE $HOST" you should remove the first line
with "sed 1d /srv/tftp/fai/pxelinux.cfg/$HOST" or use patched version of fai-chboot
to avoid "# template generated by fai-chboot for host" on first line.

After this manipulations you can boot your macbook with ipxe and start
the installation over http.

Best Regards,
Juri Grabowski


More information about the linux-fai mailing list