First we clone from iPXE’s git repo:
Custom script for iPXE build
Now we need to create a text script that will be built into iPXE. This will be compiled into iPXE’s binaries. It loads a separate text file that can be configured outside of the binary to allow for changes, though for security reasons the binary should also contain what’s in the ipxe.cfg file instead of loading it separately.
In git/ipxe/src/ create a file called script.ipxe and put the below into it, and change as needed obviously:
Building iPXE for UEFI and Legacy BIOS
We are going to build for both UEFI and Legacy BIOS at this time. They both accept the same menu and work practically the same, just require different compiled binaries based on the architecture.
Custom iPXE menu script
This is an iPXE menu that you can load up either in the compiled version, or let the script.ipxe chainload into this one at a URL somewhere.
I hope this helps!