Skip to content

Latest commit

 

History

11 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kernel-Foundry

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 lightweight container environments, Kernel-Foundry allows you to compile device-specific kernels in an isolated environment with only the necessary toolchains and sources.


Prerequisites

Before getting started, ensure your host system has the following dependencies installed:

  • adb – To communicate with the target device and pull kernel/boot files.
  • podman – To build and run containerized kernel environments.
  • fzf – Required for the interactive device selection menu in run.sh.
  • Flashing tool – At least one of fastboot or heimdall must be installed on the host.

Supported Devices

Device Model Code-name Status
Motorola Edge 2021 XT2141-2 berlna Stable
OnePlus 13 CPH2655 dodge Stable
Samsung Galaxy Tab A7 SM-T500 gta4lwifi Stable

General Workflow

While each device has its own specific README.md inside its folder, the general workflow remains consistent:

  1. Automated Extraction & Environment Launch: Connect your target device via USB (with ADB and root/su enabled) and run the orchestration script from the repository root:
./run.sh

This script automatically:

  • Checks host dependencies (adb, podman, fastboot/heimdall).
  • Opens an interactive menu (fzf) to select your target device.
  • Downloads and extracts magiskboot.
  • Pulls /proc/config.gz and the active slot's boot.img directly from the connected device.
  • Organizes acquired files into devices/<selected-device>/.
  • Builds or reuses the master kernel-foundry-env Podman image.
  • Spawns an interactive shell inside the container, landing directly in /workspace/<selected-device>.
  1. Setup & Build (Inside the Container): Once dropped into the container environment:
  • Run ./setup_env.sh (once) to download device-specific toolchains and kernel sources.
  • Run source restore_env.sh (every session) to set required compiler variables.
  • Modify your kernel configuration as needed and compile with make.

Command Line Options

run.sh accepts optional flags to manage your Podman container and image lifecycle:

Command Description
./run.sh Default run. Reuses existing container state and attaches to it.
./run.sh --replace container Force-deletes the target device's Podman container and spawns a fresh one.
./run.sh --replace image Force-deletes the existing container and the master kernel-foundry-env image, rebuilding it from the root Containerfile.

Contribution & Expansion

This project is designed to grow. If you have successfully decoupled a kernel from a vendor build system and verified it on physical hardware:

  1. Create a new directory under devices/.
  2. Provide a setup_env.sh script to clone necessary repositories and toolchains.
  3. Provide a restore_env.sh script to set up host exports and toolchain PATHs.
  4. Include any necessary standalone_fixes.patch files required for the build to succeed outside of AOSP.

License

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.

About

No description, website, or topics provided.

Resources

Stars

7 stars

Watchers

0 watching

Forks

Contributors

Languages