80.1. limine-12.9.0
BIOS and UEFI bootloader and boot manager
| Version | 12.9.0, release 1 |
| Shelf | boot — Everything before userspace: the kernel, microcode, firmware for the host, bootloader and EFI tooling |
| Phase | 41_system (System), 219 of 1047 in build order |
| Licence | BSD-2-Clause |
| Homepage | https://limine-bootloader.org/ |
| Build time | 0.4 SBU |
| Installed size | 3.2 MiB in 16 files |
| Recipe | ports/core/boot/limine/kpkgbuild |
About
Limine is the boot loader, and the only one KDOS has. One build serves both firmwares: the same menu and the same limine.conf start the system on a BIOS machine and on a UEFI one, so what a machine shows at power-on does not depend on how it started. The port installs Limine’s boot files in /usr/share/limine and the limine host program, which writes the BIOS boot code into a disk’s first sector and, on a GPT disk, Limine’s stage into a BIOS boot partition (limine bios-install <disk> [<partition number>]; kinstall lays out partition 2 for it).
Two programs read /usr/share/limine. script/phases/70_image/110_iso.sh copies the boot files onto the ISO and writes its menu, and kinstall copies them onto an installed disk’s EFI system partition. How the boot works on each firmware is in Limine and the kernel command line, and what the installer writes in What the bootloader step writes.
Limine is freestanding code that runs under the firmware with no C library. Its configure uses clang, ld.lld and the llvm- binary tools for that code by default, whatever the host compiler is, and assembles its BIOS and UEFI entry code with nasm; that is why clang, llvm, lld and nasm are in depends.
Sources
limine-12.9.0.tar.xz(539.0 KiB)
sha25686107e8754365124b1871479f766697461f16ce9d847b3c23bb269335588c565
upstream: https://github.com/limine-bootloader/limine/releases/download/v12.9.0/limine-12.9.0.tar.xz
archive copy: sources-1/boot--limine-12.9.0.tar.xz
Dependencies
Depends on: clang, llvm, lld, nasm, mtools.
Required by: no port names it.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install limine'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/boot/limine.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/boot/limine
echo '86107e8754365124b1871479f766697461f16ce9d847b3c23bb269335588c565 limine-12.9.0.tar.xz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/limine
SRC=$SRC_ROOT/limine-12.9.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf limine-12.9.0.tar.xz -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
./configure --prefix=/usr \
--enable-bios \
--enable-bios-cd \
--enable-uefi-x86-64 \
--enable-uefi-ia32 \
--enable-uefi-cd
make
make install DESTDIR="$PKG"
The switches, and why each is set:
--enable-bios— Builds the BIOS port:limine-bios.sys, the second stage the BIOS boot code finds by name on a volume and loads, and that boot code itself, which is compiled into thelimineprogram forlimine bios-installto write. It also turns on, by default, the BIOS CD image and the PXE image,limine-bios-pxe.bin, which is installed and which nothing in KDOS uses.--enable-bios-cd— Buildslimine-bios-cd.bin, the El Torito image a BIOS boots the ISO from.--enable-uefi-x86-64— BuildsBOOTX64.EFI, the loader 64-bit UEFI firmware runs.--enable-uefi-ia32— BuildsBOOTIA32.EFI, the loader for 32-bit UEFI firmware on a 64-bit processor, as on early Atom tablets. The ISO and an installed disk carry it besideBOOTX64.EFIinEFI/BOOT/, and the firmware runs whichever of the two it can execute.--enable-uefi-cd— Buildslimine-uefi-cd.bin, the UEFI El Torito image of the ISO, a small FAT image holding the EFI loaders that were built. configure needsmcopyto make it, which is why mtools is independs.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/limine, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf limine-12.9.0-1.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/limine, and runs the triggers its paths call for.
Contents
Installed programs: limine.
Installed directories: /usr/share/doc/limine, /usr/share/licenses/limine, /usr/share/limine.
Short descriptions
limine |
Multiplexer to several Limine-related utilities. |
Notes
The menu is not this port’s: 110_iso.sh writes the ISO’s limine.conf, its font and its wallpaper, and kinstall writes an installed disk’s. 110_iso.sh copies limine-bios.sys, limine-bios-cd.bin, limine-uefi-cd.bin, BOOTX64.EFI and BOOTIA32.EFI by name under set -e, and every target is off unless a switch turns it on, so a build that drops one of the UEFI switches leaves a file missing from /usr/share/limine and the image phase stops. The two BIOS switches cover for each other: configure turns the CD image on by default when the BIOS port is on, and the BIOS port on when the CD image is asked for, so only dropping both loses limine-bios.sys and limine-bios-cd.bin.