Kernel-Foundry is a collection of containerized, standalone, and 100% reproducible Android kernel build environments.
The primary goal of this project is to decouple Android kernel development from the massive AOSP/LineageOS source trees (300GB+). By using Podman and pinned Git commits, Kernel-Foundry allows you to compile device-specific kernels in a lightweight, isolated environment with only the necessary toolchains and sources.
- AOSP-Free: Build kernels without downloading the entire Android operating system source.
- Reproducible: Every environment uses specific Commit SHAs for kernels and toolchains to ensure "it builds on my machine" means "it builds on yours."
- Containerized: Built around Podman to keep your host system clean and dependencies isolated.
- Patch-Ready: Includes specific patches to bridge the gap between internal Android build systems and standalone GNU Make/Kbuild.
The project is organized by device manufacturer and codename to allow for easy scaling as more environments are added.
.
βββ devices/
β βββ motorola-berlna/ # Motorola Edge 2021 (XT2141-2 / sm7325)
β βββ Containerfile # Build environment definition
β βββ setup_env.sh # Clones and pins sources/toolchains
β βββ restore_env.sh # Sets environment variables
β βββ standalone_fixes.patch
β βββ README.md # Device-specific build instructions
βββ README.md # This file
| Device | Model | Code-name | Status |
|---|---|---|---|
| Motorola Edge 2021 | XT2141-2 | berlna | β Stable |
While each device has its own specific README.md inside its folder, the general workflow remains consistent:
- Enter the Device Directory:
cd devices/your-device-name - Build the Environment:
podman build -t kernel-builder-name . - Run the Container:
podman run -it --rm -v $(pwd):/workspace kernel-builder-name - Setup & Build:
Inside the container, run the
setup_env.sh(once) andsource restore_env.sh(every session) before runningmake.
This project is designed to grow. If you have successfully decoupled a kernel from a vendor build system and verified it on physical hardware:
- Create a new directory under
devices/. - Include a
Containerfilethat provides the necessary build tools. - Provide a
setup_env.shthat pins the exact commits you used. - Include any necessary
standalone_fixes.patchfiles required for the build to succeed outside of AOSP.
All kernel sources and toolchains are subject to their respective upstream licenses (GPLv2, Apache 2.0, etc.). The scripts and configuration files in this repository are provided "as-is" for the purpose of hardware experimentation and development.