PXELINUX基本已经没有人在维护了,iPXE在支持HTTP等高级传输协议的同时还支持动态语言php之类的解析,同时还可以烧录在网卡上替代网卡出厂设置。
唯一比PXELINUX复杂的是这玩意需要自己编译,官方释出的版本会一直重复一个死循环。官方网站给的依赖包有问题,同时iPXE有自己的语法,pxeliux.cfg下的文件不能直接拿来用。这次重复搞这些东西基本上把以前踩过的坑重新都踩了一次,记录一下免得下次又浪费时间

 http://ipxe.org/cmd

 Download and boot a Linux kernel with an initrd

kernel http://192.168.0.1/vmlinuz
initrd http://192.168.0.1/initrd.img
boot

 [root@kickstart ks]# uname -a

Linux kickstart.share.demo 3.10.0-957.el7.x86_64 #1 SMP Thu Nov 8 23:39:32 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
yum -y install gcc binutils make perl liblzma xz-devel mtools mkisofs

[root@kickstart ~]# cd ipxe/src/
[root@kickstart src]# cat demo.ipxe
#!ipxe
dhcp
chain http://kickstart.share.demo/ks/boot.ipxe

[root@kickstart src]# make bin/undionly.kpxe EMBED=demo.ipxe

[root@kickstart src]# cat /var/www/html/ks/boot.ipxe
#!ipxe

echo product...........: ${product}
echo manufacturer......: ${manufacturer}
echo platform..........: ${platform}
echo chip .............: ${chip}
echo serial............: ${serial}
echo asset.............: ${asset}
echo mac...............: ${mac}
echo ip................: ${ip}
echo netmask...........: ${netmask}
echo gateway...........: ${gateway}
echo dns...............: ${dns}
echo domain............: ${domain}
echo dhcp-server.......: ${dhcp-server}
echo filename..........: ${filename}
echo next-server.......: ${next-server}
echo boot menu will show in 5 seconds
sleep 5

#login
#iseq ${username} fire && goto start || goto error

:start
menu
item --gap -- Vetting CentOS
item --key 7 CentOS7 7---- CentOS 7
item --key 6 CentOS6 6---- CentOS 6

choose --default CentOS7 --timeout 6000 target && goto ${target}

:CentOS7
kernel http://kickstart.share.demo/centos7/images/pxeboot/vmlinuz ks=http://kickstart.share.demo/ks/cenos7_text.ks
initrd http://kickstart.share.demo/centos7/images/pxeboot/initrd.img
boot
:CentOS6
kernel http://kickstart.share.demo/centos6/images/pxeboot/vmlinuz ks=http://kickstart.share.demo/ks/centos6_text.ks
initrd http://kickstart.share.demo/centos6/images/pxeboot/initrd.img
boot

:local
sanboot --no-describe --drive 0x80 || goto start
:shell
shell || goto start
:reboot
reboot || goto start
:error
echo You are not intened to be here
echo This is for TEST use only
echo Which will destory ALL YOU HARDDISK DATA
echo If you still believe you need credentials
echo blame jere@
echo Warning will be disappeared in 30 seconds
echo And your computer will start from local hard disk automatically
sleep 30
local || reboot