Repository navigation
Bootloaders lk2nd
Second-stage LK bootloader for msm8916 mainline Linux.
| Type | OS bootloader (type2) |
| Upstream | https://github.com/msm8916-mainline/lk2nd |
| CVEs attributed | 0 |
| Vulnerability-fixing commits | 4 naming a CVE, 92 keyword-matched |
| CVEs with a linked fix | 0 |
Loads from the stock aboot and boots mainline Linux with a proper device tree.
Type 2: explicitly a second stage that prepares an OS.
See Boot-Stages for the eight-stage model these phases map onto.
- stock bootloader -- The device's own LK or ABL loads lk2nd as if it were an Android boot image.
- hardware detection -- Identifies the board, display panel and battery from the SMEM and device tree information the firmware left.
- device tree fixup -- Patches or selects a device tree matching what it detected.
- menu and boot -- Offers Fastboot and a menu, then boots a kernel from a partition, a filesystem or an SD card.
lk2nd is a second-stage bootloader: it is installed where the vendor expects a kernel, so its input is the Android boot image format, and its job is to undo the vendor's assumptions before the real kernel sees them. The important state is what the proprietary firmware left in SMEM -- board ID, panel ID, charger status -- which lk2nd reads and translates into a device tree and command line a mainline kernel can use.
It boots a kernel with the standard ARM protocol, passing the fixed-up device tree it assembled. Because it re-implements Fastboot, it also gives devices with a hostile or crippled vendor bootloader a consistent flashing interface, which is the practical reason postmarketOS uses it.
Detected in its build configuration and source:
- encryption
- rollback protection
- secure boot
- signature verification
See Security-Mechanisms for how these are detected and what a detection does and does not prove.
git -C oss-bootloaders submodule update --init type2/lk2nd
./scripts/analysis/run-tool.sh codeql lk2ndSee Tools for what each tool applies to.
Home · OS bootloader · Tools