{"id":13613551,"url":"https://github.com/msm8916-mainline/lk2nd","last_synced_at":"2025-04-13T15:33:31.643Z","repository":{"id":37927079,"uuid":"177200401","full_name":"msm8916-mainline/lk2nd","owner":"msm8916-mainline","description":"Custom bootloader for Qualcomm MSM8916/MSM8226/MSM8974/... devices","archived":false,"fork":false,"pushed_at":"2025-04-11T11:49:24.000Z","size":15959,"stargazers_count":447,"open_issues_count":55,"forks_count":368,"subscribers_count":22,"default_branch":"main","last_synced_at":"2025-04-11T13:16:49.459Z","etag":null,"topics":["bootloader","firmware","hacktoberfest","lk1st","lk2nd","msm8226","msm8916","msm8939","msm8974","qualcomm"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/msm8916-mainline.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-03-22T19:46:07.000Z","updated_at":"2025-04-11T11:49:29.000Z","dependencies_parsed_at":"2023-09-23T10:06:40.717Z","dependency_job_id":"64664bfd-2e55-4273-8b9f-b119daa27f9f","html_url":"https://github.com/msm8916-mainline/lk2nd","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msm8916-mainline%2Flk2nd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msm8916-mainline%2Flk2nd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msm8916-mainline%2Flk2nd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msm8916-mainline%2Flk2nd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/msm8916-mainline","download_url":"https://codeload.github.com/msm8916-mainline/lk2nd/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248736290,"owners_count":21153569,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bootloader","firmware","hacktoberfest","lk1st","lk2nd","msm8226","msm8916","msm8939","msm8974","qualcomm"],"created_at":"2024-08-01T20:00:50.089Z","updated_at":"2025-04-13T15:33:26.632Z","avatar_url":"https://github.com/msm8916-mainline.png","language":"C","funding_links":[],"categories":["Projects"],"sub_categories":[],"readme":"![An image of multiple devices showing lk2nd menu](Documentation/.assets/header.jpg)\n\n# lk2nd\nlk2nd is a custom bootloader for many different devices based on Qualcomm\nsystem-on-chips (SoCs), including smartphones, tablets, smartwatches and a few\nsingle board computers (SBCs). It simplifies booting standard operating systems\nby providing:\n\n  - **A unified boot and flashing interface** (Android Fastboot), independent of\n    device-specific modifications made to the boot chain (e.g. the proprietary\n    flashing interface on Samsung devices)\n  - **Automatic device and hardware detection** (e.g. display panels, batteries, ...)\n  - **Additional bootloader features** (e.g. file system boot, booting from SD card)\n  - **Additional firmware features** (e.g. booting secondary CPU cores if the firmware\n    lacks [PSCI] support)\n  - **Workarounds for various device-specific issues** (e.g. USB on some Samsung\n    devices, modem on Motorola smartphones, ...)\n  - **Various debugging commands** that allow better understanding of the hardware\n    for research and development purposes\n\nThere are two different configurations:\n\n  - **lk2nd:** \"secondary\" bootloader intended for devices where existing\n    firmware cannot be replaced easily (most smartphones and tablets). In this\n    configuration, lk2nd does **not** replace the stock bootloader. Instead, it\n    is packed into an Android boot image, which is then loaded by the stock\n    bootloader just like the original Android image.\n    The real operating system can be placed in the boot partition with 512 KiB\n    offset or stored in a ext2 file system. It does not have to be Android or\n    even Linux, any kind of kernel can be packed into an Android boot image.\n\n  - **lk1st:** primary bootloader intended for single-board computers (SBCs)\n    and expert users. In this case, it is the \"first\" bootloader responsible for\n    loading the main operating system.\n\nThis repository is a fork of the [original open-source bootloader from Qualcomm](https://git.codelinaro.org/clo/la/kernel/lk/-/tree/lk.lnx.1.0.r54-rel),\nwhich is a heavily modified version of the [Little Kernel Embedded Operating System].\n\n## Supported SoCs and devices\n\nlk2nd supports a significan amount of devices. See [devices.md](Documentation/devices.md) for a comperhensive list.\n\n## Installation\n1. Download `lk2nd.img` (available in [Releases](https://github.com/msm8916-mainline/lk2nd/releases))\n2. Flash `lk2nd.img` using the stock flashing interface:\n    - Fastboot: `fastboot flash boot lk2nd.img`\n    - Samsung: `heimdall flash --BOOT lk2nd.img`\n\nIf you get `fastboot: error: Couldn't parse partition size '0x'` try one of the following workarounds:\n\n- `fastboot flash:raw boot lk2nd.img`\n- `fastboot boot lk2nd.img`, then `fastboot flash lk2nd lk2nd.img`\n\n## Usage\nlk2nd provides the standard Android fastboot protocol for flashing/booting Android boot images.\n\nPress `Volume Down` while booting to enter Fastboot mode.\nPress `Volume Up` while booting to boot into Recovery mode.\n\n\u003e [!TIP]\n\u003e If your stock bootloader uses the same key combinations, you need to wait a bit before\n\u003e pressing the volume keys. Usually, waiting until the screen turns on and/or the device vibrates\n\u003e should be enough to make the stock bootloader ignore the keys.\n\n`fastboot flash lk2nd lk2nd.img` can be used to update lk2nd directly from its\nfastboot interface.\n\n\u003e [!IMPORTANT]\n\u003e `fastboot flash boot boot.img` will flash the actual boot image with 512 KiB offset\n\u003e into the boot partition. This is done to avoid replacing lk2nd (since it is also booted from\n\u003e the boot partition).\n\nOther fastboot commands work normally.\n\n### Troubleshooting\nIf the device shows up via fastboot you can get a log file from lk2nd using\n`fastboot oem log \u0026\u0026 fastboot get_staged \u003coutput-file\u003e`, where `\u003coutput-file\u003e`\nis either some text file to write to (e.g. `output.txt`) or `/dev/stdout` to\nwrite the log to standard output.\n\n## Building\n\nGenerally, this should be enough to build lk2nd:\n\n```\n$ make TOOLCHAIN_PREFIX=arm-none-eabi- lk2nd-msmXXXX\n```\n\nSee [building.md](Documentation/building.md) for more info.\n\n## Contact\nAsk on [`#lk2nd:postmarketos.org`](https://matrix.to/#/#lk2nd:postmarketos.org) (`#lk2nd` on [irc.oftc.net](https://www.oftc.net/)).\n\n[PSCI]: https://developer.arm.com/architectures/system-architectures/software-standards/psci\n[Little Kernel Embedded Operating System]: https://github.com/littlekernel/lk\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmsm8916-mainline%2Flk2nd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmsm8916-mainline%2Flk2nd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmsm8916-mainline%2Flk2nd/lists"}