Compiling iPXE boot kernels
-
NOTE: This method below is no longer needed, but we are leaving it active for reference only. FOG now contains all of the tools you need to compile the current version of iPXE. That tutorial is listed here:
https://forums.fogproject.org/topic/15826/updating-compiling-the-latest-version-of-ipxe
To answer several requests in the forum about changing the keyboard mapping in the FOG iPXE menu. The only way to do change the keyboard mappings is to recompile the iPXE kernels from their source code since the keyboard layout is defined/set at compile time and not run time.
By following the process below you should be able to compile your own copies of the ipxe boot kernels (undionly.kpxe, ipxe.efi or any other FOG Project supplied boot kernel).
Understand: This method of creating your own boot kernels is not supported by the FOG Project Developers. If your make your own boot kernels and your computers fail to pxe boot, YOU are responsible for fixing any issue (or rerun the fog installer to restore the files to what the developers have created and tested).
Be aware that FOG uses another open source application called iPXE to provide the dynamic menuing structure. iPXE is created and manged by the iPXE Project team and not the FOG Developers.
This tutorial is only an example of how one might compile your own iPXE boot kernels on your fog server.
If your fog server is Ubuntu based you will need to install the compiler and development tools
sudo apt-get install build-essential liblzma-dev
If your fog server is Centos based you will need to install the compiler tools and required library
yum groupinstall "Development Tools" yum install xz-devel
Change to your home directory and clone the ipxe source files
git clone http://git.ipxe.org/ipxe.git ipxe
Make back up copies of the files we ar e about to change.
mv ~/ipxe/src/config/console.h ~/ipxe/src/config/console.h.sav mv ~/ipxe/src/config/general.h ~/ipxe/src/config/general.h.sav mv ~/ipxe/src/config/settings.h ~/ipxe/src/config/settings.h.sav
If you have the FOG Project installer files already downloaded on your fog server, you can just copy the FOG Project customized files to the iPXE source directories
cp <path_to_installer_files>/fogproject/src/ipxe/src/config/* ~/ipxe/src/config cp <path_to_installer_files>/fogproject/src/ipxe/src/ipxescript ~/ipxe/src
If you DO NOT have the FOG Project installer files you can download only the specific files needed from the FOG Project GitHub site to create your custom iPXE boot kernels:
wget https://raw.githubusercontent.com/FOGProject/fogproject/blob/master/src/ipxe/src/config/console.h -O ~/ipxe/src/config/console.h wget https://raw.githubusercontent.com/FOGProject/fogproject/blob/master/src/ipxe/src/config/general.h -O ~/ipxe/src/config/general.h wget https://raw.githubusercontent.com/FOGProject/fogproject/blob/master/src/ipxe/src/config/settings.h -O ~/ipxe/src/config/settings.h wget https://raw.githubusercontent.com/FOGProject/fogproject/blob/master/src/ipxe/src/ipxescript -O ~/ipxe/src/ipxescript
Use the linux command
sed
to change the keyboard mapping. To use the following command replace XX with the proper keyboard code for your location.
sed -i 's/KEYBOARD_MAP\tus/KEYBOARD_MAP\tXX/g' ~/ipxe/src/config/console.h
For example if you want to change the US keyboard to the French keyboard in the FOG iPXE menus you would replace XX with fr as in this example:
sed -i 's/KEYBOARD_MAP\tus/KEYBOARD_MAP\tfr/g' ~/ipxe/src/config/console.h
To be sure the settings are correct, you can run the following command to confirm the keyboard mappings have been changed.
grep -e 'KEYBOARD_MAP' ~/ipxe/src/config/console.h
[Editor note, insert expected output here]
All supported iPXE keymaps are listed on this page:
https://github.com/ipxe/ipxe/tree/master/src/hci/keymapNow that you have the keyboard mapping set, lets compile iPXE…
Change to the iPXE source directory and runmake clean
to remove any unneeded bitscd ~/ipxe/src make clean
Build the BIOS boot kernel
undionly.kpxe
, rename the original undionly.kpxe file, and finally copy over the custom iPXE boot kernel.make bin/undionly.kpxe EMBED=~/fogproject/src/ipxe/src/ipxescript sudo mv /tftpboot/undionly.kpxe /tftpboot/undionly.kpxe.old sudo cp bin/undionly.kpxe /tftpboot
Purge any prevoiusly built object files (aways good practice when you update configuration files.
make clean
If you have the FOG Project installer files already downloaded on your fog server, you can just copy the FOG Project customized files to the iPXE source directories
cp <path_to_installer_files>/fogproject/src/ipxe/src-efi/config/* ~/ipxe/src/config
If you DO NOT have the FOG Project installer files you can download only the specific files needed from the FOG Project GitHub site to create your custom iPXE boot kernels:
wget https://raw.githubusercontent.com/FOGProject/fogproject/blob/master/src/ipxe/src-efi/config/console.h -O ~/ipxe/src/config/console.h wget https://raw.githubusercontent.com/FOGProject/fogproject/blob/master/src/ipxe/src-efi/config/general.h -O ~/ipxe/src/config/general.h wget https://raw.githubusercontent.com/FOGProject/fogproject/blob/master/src/ipxe/src-efi/config/settings.h -O ~/ipxe/src/config/settings.h
Use the same sed command above to update the UEFI boot files. Hint: Don’t forget to replace XX with your desired keyboard map.
sed -i 's/KEYBOARD_MAP\tus/KEYBOARD_MAP\tXX/g' ~/ipxe/src/config/console.h
Build the UEFI boot kernel
ipxe.efi
, rename the original ipxe.efi file, and finally copy over the custom iPXE boot kernel.make bin-x86_64-efi/ipxe.efi EMBED=~/fogproject/src/ipxe/src/ipxescript sudo mv /tftpboot/ipxe.efi /tftpboot/ipxe.efi.old sudo cp ~/ipxe/src/bin-x86_64-efi/ipxe.efi /tftpboot
If you need snponly.efi (roughly equivelent to BIOS’ undionly.kpxe) run these commands (Hint: This compile command will run really quick since all of the hard work was done in the previous step).
make bin-x86_64-efi/snponly.efi EMBED=~/fogproject/src/ipxe/src/ipxescript sudo mv /tftpboot/snponly.efi /tftpboot/snponly.efi.old sudo cp ~/ipxe/src/bin-x86_64-efi/snponly.efi /tftpboot
Clean up after yourself in case you need to build these kernels over again.
make clean