Wiki source code of Legacy Boot
Last modified by Sabrina V. on 2026/02/02 11:34
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | {{aagon.floatingbox/}} | ||
| 2 | |||
| 3 | The classic legacy boot, also known as BIOS boot, is the traditional system start procedure for older systems and differs fundamentally from modern UEFI implementations. With legacy boot, the system still starts up according to the classic BIOS principle, which does not use a cryptographic verification procedure such as Secure Boot. Instead, a boot sector is loaded directly from a data carrier or via the network and executed. | ||
| 4 | In contrast to the UEFI model, legacy boot works with a fixed memory address and 16-bit initialisation of the CPU. This makes the boot process simpler, but also less flexible and secure. There is no signature verification of boot loaders or kernels, because the BIOS simply executes the code located in the boot sector or in the file loaded via PXE. | ||
| 5 | |||
| 6 | = PXE boot process in legacy mode = | ||
| 7 | |||
| 8 | When PXE starts via BIOS, the network adapter's PXE ROM is initialised first. It requests an IP address via DHCP and, in the same process, receives info about the boot server and the name of the boot file to be loaded (e.g. pxeboot.n12). | ||
| 9 | |||
| 10 | The continuing process typically proceeds as follows: | ||
| 11 | |||
| 12 | * **BIOS initialisation**: The system initialises the hardware and transfers control to the network interface with the PXE ROM activated. | ||
| 13 | * **DHCP request**: The PXE client sends a DHCPDISCOVER request to obtain an IP address and boot parameters. | ||
| 14 | * TFTP download: After successful DHCP exchange, the client loads the specified boot file (e.g. pxeboot.n12) from the Server via the TFTP protocol. | ||
| 15 | * Bootloader execution: The BIOS transfers control to the loaded bootloader, which then loads additional components (e.g. kernel, initrd, menu files). | ||
| 16 | * System start: The bootloader starts the operating system based on the parameters specified in the configuration (e.g. pxelinux.cfg/default). | ||
| 17 | |||
| 18 | (% class="box infomessage" %) | ||
| 19 | ((( | ||
| 20 | [[image:https://doc.aagon.com/bin/download/XWiki/Aagon Infobox/WebHome/Information.svg||alt="Hinweis" height="32" width="32"]] **Hinweis: ** | ||
| 21 | |||
| 22 | Bootloaders such as SYSLINUX or PXELINUX are typically used in legacy mode. These load the kernel and initrd files via simple configuration files (e.g. pxelinux.cfg/default). The menu structure is text-based and is interpreted by the bootloader without checking signatures or certificates. | ||
| 23 | ))) | ||
| 24 | |||
| 25 | = Preparation of the bootloader = | ||
| 26 | |||
| 27 | First, download the current version from the official SYSLINUX project website: | ||
| 28 | [[https:~~/~~/wiki.syslinux.org/wiki/index.php?title=SYSLINUX>>url:https://wiki.syslinux.org/wiki/index.php?title=SYSLINUX]] | ||
| 29 | |||
| 30 | Unzip the archive. From this ZIP file, you will need the following files, which you should copy to the root directory of your PXE folder: | ||
| 31 | |||
| 32 | * pxelinux.0 (in the path bios/core/pxelinux.0 relative to the unzipped ZIP) – this is the main boot loader for Legacy BIOS + PXE. This file must be renamed to pxeboot.n12. | ||
| 33 | * ldlinux.c32 (in the path bios/com32/elflink/ldlinux/ldlinux.c32) – a core module (COM32) from SYSLINUX that supports the loading of additional modules or extensions. | ||
| 34 | * libutil.c32 (in the path bios/com32/libutil/libutil.c32) - a library/utility module file within the COM32 modules that provides general utility functions for other modules. | ||
| 35 | * menu.c32 (in the path bios/com32/menu/menu.c32) - a module for displaying a text menu during boot; if, for example, DEFAULT menu.c32 is set in the configuration file, this menu module is started. | ||
| 36 | |||
| 37 | Place these files directly in the root directory of your PXE folder. This ensures that the boot loader and modules are correctly accessible via TFTP during the PXE boot process. A note on this is [[in the official documentation>>url:https://docs.oracle.com/cd/E20815_01/html/E20821/gjqeh.html]]. | ||
| 38 | |||
| 39 | {{code language="bash"}} | ||
| 40 | /tftpboot/ | ||
| 41 | ├── pxeboot.n12 | ||
| 42 | ├── ldlinux.c32 | ||
| 43 | ├── libutil.c32 | ||
| 44 | └── menu.c32 | ||
| 45 | {{/code}} | ||
| 46 | |||
| 47 | |||
| 48 | |||
| 49 | = Creating the configuration folder = | ||
| 50 | |||
| 51 | Next, create a subfolder named ##pxelinux.cfg## in the PXE folder. The boot configuration files for PXELINUX will later be stored in the ##pxelinux.cfg ##directory. Typically, this directory is created directly under the TFTP root or in the directory where the## pxeboot.n12## file is located. | ||
| 52 | |||
| 53 | |||
| 54 | |||
| 55 | |||
| 56 | = Structure of the boot configuration files = | ||
| 57 | |||
| 58 | Create the boot configuration files in the pxelinux.cfg folder. A specific naming and search logic applies here, which controls the behaviour of your PXE boot server: | ||
| 59 | |||
| 60 | * **default**: This is the standard configuration file. If no more specific file is found for a Client (e.g. based on MAC or IP), this file is used. Usually stored as pxelinux.cfg/default. | ||
| 61 | * **01-<MAC address>**: A file for exactly one specific Client, identified by its MAC address. The naming convention begins with 01-, followed by the MAC address in lower case letters, with hyphens instead of colons. Example: 01-23-45-67-89-AB. This allows a single machine to be assigned its own boot configuration. | ||
| 62 | * **<IP-Hex>**: A file based on the Client's IP address. The IP address is used in hexadecimal form (e.g. for 192.168.1.1 → C0A80101). This variant allows configuration based on IP address or subnet ([[hpc.temple.edu>>url:https://www.hpc.temple.edu/mhpc/hpc-technology/exercise2/pxelinux.html]]). | ||
| 63 | |||
| 64 | * **<IP-TeilHex>**: Shorter variants of the IP hex address. If no file with the full IP hex is found, PXELINUX attempts to evaluate shorter versions (e.g. only the upper bytes) of the IP in hexadecimal form. This enables a type of ‘subnet configuration’ via the file names ([[hpc.temple.edu>>url:https://www.hpc.temple.edu/mhpc/hpc-technology/exercise2/pxelinux.html]]). | ||
| 65 | |||
| 66 | |||
| 67 | |||
| 68 | == Order of the search process == | ||
| 69 | |||
| 70 | When a client boots, PXELINUX searches the pxelinux.cfg directory for configuration files in the following order: | ||
| 71 | |||
| 72 | 1. File based on the MAC address (i.e. 01-<MAC>) | ||
| 73 | 1. File based on the full IP in hexadecimal form (<IP-Hex>) | ||
| 74 | 1. File based on abbreviated IP in hex (e.g. only the upper bytes <IP-partHex>) | ||
| 75 | 1. Default file | ||
| 76 | |||
| 77 | This order ensures that the most specific configuration is used first. If no suitable file is found, the default configuration is used ([[hpc.temple.edu>>url:http://hpc.temple.edu/]]). | ||
| 78 | |||
| 79 | |||
| 80 | |||
| 81 | == Purpose of the mechanisms == | ||
| 82 | |||
| 83 | * The file containing the MAC address enables an individual boot configuration to be assigned precisely to a specific piece of hardware. | ||
| 84 | * The file containing the IP address (or parts thereof) allows group configurations or assignments according to network or subnet. | ||
| 85 | * The default file ensures that each client receives at least one boot configuration if no specialised file is available. | ||
| 86 | * By combining these mechanisms, certain Clients can be treated differently in a flexible manner, while others fall back on a generic configuration. | ||
| 87 | * For most simple scenarios, it is sufficient to create a single default file. This provides a uniform configuration for all Clients. | ||
| 88 | |||
| 89 | |||
| 90 | |||
| 91 | = Example configuration (standard variant) = | ||
| 92 | |||
| 93 | In a simplified setup, a single configuration file called default is used to distribute a general boot configuration for all Clients. Create a file called default in the pxelinux.cfg directory and enter the following basic structure, for example: | ||
| 94 | |||
| 95 | {{code language="bash"}} | ||
| 96 | DEFAULT menu.c32 | ||
| 97 | MENU TITLE Netzwerk-Boot | ||
| 98 | TIMEOUT 50 | ||
| 99 | PROMPT 0 | ||
| 100 | |||
| 101 | LABEL local | ||
| 102 | MENU LABEL Boot von lokale Festplatte | ||
| 103 | LOCALBOOT 0xffff | ||
| 104 | {{/code}} | ||
| 105 | |||
| 106 | This structure displays a simple menu that uses the menu.c32 module (‘DEFAULT menu.c32’) and defines local booting as the default entry. You can extend this template with additional items, kernel, Init-RD and other options. If you now start from this configuration, you will see the following screen and the boot would start automatically from the local disk after 5 seconds. | ||
| 107 | |||
| 108 | [[Legacy Boot boot screen>>image:Legacy Boot_Bootscreen.png||alt="Legacy Boot_Bootscreen"]] |

