====== Examples ====== There are many different ways to use iPXE. The iPXE [[:docs|documentation]] provides plenty of examples for using individual features, and you can always try [[:contact|contacting]] the iPXE developers and other users. There are plenty of examples of complete solutions built around iPXE; this page provides links to examples that you may find useful. ===== Extensive iPXE menu example ===== If you need a text-based boot menu that emulates most of what pxelinux.0 and menu.c32 does, with options to override the boot process for specific machines, you should look carefully at the example located at [[https://gist.github.com/robinsmidsrod/2234639]]. The bootstrap.ipxe script there basically implements all of the features of PXE dispatcher mentioned below with a solution using only iPXE scripting. It also doesn't require any server-side scripting support, like Perl, PHP or Python. {{ :clipart:lightbulb.png?180x200|A light bulb}} ===== Using chainloading to improve the feature set of iPXE ===== If you have an old version of iPXE or gPXE burned into the ROM, or you have a non-iPXE PXE ROM, it is often quite useful to "upgrade" it to a version that has all the features you need during runtime. The example ISC DHCPD configuration at https://gist.github.com/robinsmidsrod/4008017 shows how you can do this and make sure the version of iPXE loaded has all the features you need. It also shows how to load a different binary of iPXE for legacy BIOS and UEFI environments. ===== Embedding a menu to choose which network adapter to boot from ===== The default Ctrl-B prompt you get at startup is not always the most user-friendly way to choose which network card should be booted. The example at https://gist.github.com/robinsmidsrod/3871687 shows how you can embed a script that will open up a menu that allows you to choose which network card to boot without having to type anything, while also allowing a sane default after a timeout value. ===== PXE dispatcher ===== Robin Smidsrød's [[https://github.com/robinsmidsrod/pxe-dispatcher|PXE dispatcher]] provides a reference implementation for pretty much anything you might want to try doing with iPXE menus, and also gives examples of loading a huge variety of operating systems. This specific piece of code has been superseded by a solution using only iPXE scripting mentioned above. ===== Building ipxelinux.0 ===== It seems quite common that people want to build undionly.kpxe and pxelinux.0 into one binary. It was previously called gpxelinux.0. If you look at https://coderwall.com/p/0sq9gg you'll find a detailed description of how to build this binary from scratch using iPXE embedding. ===== Booting from public mirrors using checksummed binaries ===== The boot system at http://boot.salstar.sk/ shows you how you can make iPXE boot only programs with matching checksums using the [[cmd/imgtrust|imgtrust]] command. It also boots directly from public mirrors, like SourceForge. There is also a sophisticated example duplicating the basic feature of lspci using iPXE scripting and the [[cmd/pciscan|pciscan]] command. ===== Menu example with authentication ===== The https://github.com/skunkie/ipxe-phpmenu repository shows a similar example to the text-based menu above, but implemented using PHP. It also includes an authentication feature.