Howto boot FreeBSD with iPXE
|
2018-06-20, 01:53
Post: #1
|
|||
|
|||
Howto boot FreeBSD with iPXE
Hi people.
I was not found any instructions regarding how to boot FreeBSD with iPXE, and this turned out to be not trivial for me. So here is my investigations. Main idea - unpack cd/dvd with some FreeBSD release to the directory, accessible via NFS, setup DHCP to answer with a proper root-path option, and boot FreeBSD PXE loader /boot/pxeboot. That's all. The devil in the details, as usual. Mentioned pxeboot loader is a very capricious. In a frequent situation, when your host during boot get two (or more) different IP leases, due different client-id presentation to DHCP server by sequential loaders (firmware-PXE - iPXE - pxeboot), this pxeboot stuck for a long time, trying to get a "proper" lease offer. Up to 30 minutes, I think, and then drop into emergency shell. So the first thing we must provide - avoid IP lease changing during boot. The easiest way for ISC DHCPD - use the ignore-client-uids statement, with it DHCPD will consider only hardware MAC address for IP assignment. Another ways - use fixed-address assigments in dhcpd.conf, or instruct iPXE to do "ifopen" instead of "dhcp". So, we boot this loader: #!ipxe kernel our-fbsd-dir/boot/pxeboot boot and passed this level! pxeboot will mount root-path NFS share and load a FreeBSD kernel with a further boot stuff (sorry, I'm not very familiar with FreeBSD itself). Then, some of "further boot stuff" try to mount root on some CDROM device (dark and grim legacy of the ISO image we are using) and fail on remount / in rw. This can be fixed by commenting out description of this ISO in our-fbsd-dir/etc/fstab. With fixed fstab, installator will be run and OS may be installed smoothly. The next problem we'll meet if we want to have a few options for a different releases. In this case we have to provide different root-path for each release's choices. Unfortunately, iPXE hack with "set root-path some-dir" doesn't work - this stupid pxeboot want to get this option from DHCP server personally. And it provide to DHCPD not so much info about himself, the only useful option for us - vendor-class-identifier (60), which value is "PXEClient" from version to version. Not so much, but we haven't anything else. First times when I faced this problem, i installed a sources, recompile pxeboot to provide a distinguished version number in 60 option, and describe accordingly root-path options for each possible vendor-class-identifier. Now I'm too lazy for all this sources-compilers and DHCP configs modification for each new FreeBSD release, so i just modify pxeboot binary file with hexeditor, and replace "PXEClient" with some version codename, like 'PXE-fb104' for 10.4 release, limited by 9 symbols. And I also put a construction in my dhcp.conf, which allow to build a root-path option using value of vendor-class-identifier: if exists vendor-class-identifier and substring (option vendor-class-identifier, 0, 6) = "PXE-fb" { option root-path = concat("/content/freebsd/", option vendor-class-identifier); } And with the next OS release we'll just create "codename" dir inside "/content/freebsd/" (which also may be a symlink), copy all ISO's files here, and modify accordingly pxeboot and fstab. Thats all. Oh, last but not least! Please make sure you had set a proper loader_logo option: put 'loader_logo="beastie"' line into your our-fbsd-dir/boot/loader.conf file (you may have to create a new one). Without it, nothing can work! Happy birthday, FreeBSD! |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)