msm8916-mainline / lk2nd

Custom bootloader for Qualcomm MSM8916/MSM8226/MSM8974/... devices
Other
349 stars 309 forks source link
bootloader firmware hacktoberfest lk1st lk2nd msm8226 msm8916 msm8939 msm8974 qualcomm

An image of multiple devices showing lk2nd menu

lk2nd

lk2nd is a custom bootloader for many different devices based on Qualcomm system-on-chips (SoCs), including smartphones, tablets, smartwatches and a few single board computers (SBCs). It simplifies booting standard operating systems by providing:

There are two different configurations:

This repository is a fork of the original open-source bootloader from Qualcomm, which is a heavily modified version of the Little Kernel Embedded Operating System.

Supported SoCs and devices

lk2nd supports a significan amount of devices. See devices.md for a comperhensive list.

Installation

  1. Download lk2nd.img (available in Releases)
  2. Flash lk2nd.img using the stock flashing interface:
    • Fastboot: fastboot flash boot lk2nd.img
    • Samsung: heimdall flash --BOOT lk2nd.img

If you get fastboot: error: Couldn't parse partition size '0x' try one of the following workarounds:

Usage

lk2nd provides the standard Android fastboot protocol for flashing/booting Android boot images.

Press Volume Down while booting to enter Fastboot mode. Press Volume Up while booting to boot into Recovery mode.

[!TIP] If your stock bootloader uses the same key combinations, you need to wait a bit before pressing the volume keys. Usually, waiting until the screen turns on and/or the device vibrates should be enough to make the stock bootloader ignore the keys.

fastboot flash lk2nd lk2nd.img can be used to update lk2nd directly from its fastboot interface.

[!IMPORTANT] fastboot flash boot boot.img will flash the actual boot image with 512 KiB offset into the boot partition. This is done to avoid replacing lk2nd (since it is also booted from the boot partition).

Other fastboot commands work normally.

Troubleshooting

If the device shows up via fastboot you can get a log file from lk2nd using fastboot oem log && fastboot get_staged <output-file>, where <output-file> is either some text file to write to (e.g. output.txt) or /dev/stdout to write the log to standard output.

Building

Generally, this should be enough to build lk2nd:

$ make TOOLCHAIN_PREFIX=arm-none-eabi- lk2nd-msmXXXX

See building.md for more info.

Contact

Ask on #lk2nd:postmarketos.org (#lk2nd on irc.oftc.net).