Introduction to KernelForge
Relevant source files
The following files were used as context for generating this wiki page:
KernelForge is a mobile application that automates Android custom kernel development and packaging. It provides a visual dashboard for modders to configure, patch, and build kernels directly on ARM64 Android devices without manual terminal interaction.
The application integrates kernel source management, automated patching for security and root frameworks, and AI-driven log analysis to assist in debugging build failures. It generates flashable AnyKernel3 ZIP files ready for installation via custom recovery.
Sources: README.md:3-12, src/app/page.tsx:88-120
System Architecture
KernelForge employs a mobile-native architecture using a Next.js 15 frontend wrapped by Capacitor 6. This hybrid approach allows the application to run as a standalone Android APK while maintaining a modern web-based user interface.
The diagram shows the relationship between the web framework, the native bridge, and the Android operating system.
Sources: README.md:14-18, package.json:34-36
Core Modules and Features
Kernel Configuration and Setup
You define the kernel source, target device, and toolchain in the Setup module. The application tracks specific hardware details such as the Device Model Name, Codename, and GKI/KMI versions to ensure compatibility.
| Feature | Description | File Reference |
|---|---|---|
| Source Management | Tracks Git URL and branch for kernel sources. | src/app/page.tsx |
| GKI/KMI Targeting | Selects Android GKI versions (e.g., 5.10, 5.15). | src/app/page.tsx |
| Toolchain Selection | Chooses between Clang 17.0.4, GCC 13.2, or Proton Clang. | src/app/page.tsx |
| Sources: src/app/page.tsx:280-340 |
Automated Patching System
The application automates the integration of external patches into the kernel source. You toggle specific modules to modify kernel behavior before compilation.
- KernelSU: Integrates kernel-level root access (Official or Next variants).
- SUSFS: Implements advanced filesystem hiding to bypass security detections.
- NoMount: Applies hooks to
fs/namespace.cto prevent detection of modified filesystems. - TCP BBR v3: Enables specific congestion control optimizations in the network stack.
Sources: src/app/page.tsx:355-400, README.md:7-9
AI-Powered Troubleshooting
The AI Troubleshooter scans build logs to identify KMI compatibility issues and failed patch hooks. It provides a summary of errors and suggested solutions.
The sequence diagram illustrates the data flow for log analysis. Currently, the application uses a mock response for static APK exports.
Sources: src/components/dashboard/AITroubleshooter.tsx:21-30, src/ai/flows/ai-build-troubleshooting-assistant.ts:32-49
Build and Deployment Pipeline
KernelForge uses GitHub Actions to automate the creation of releases. When you push a version tag, the pipeline executes the following steps:
- Static Export: Compiles the Next.js static payload.
- Capacitor Sync: Injects the payload into the Android wrapper.
- APK Build: Compiles and signs the
arm64-v8aAPK. - Release: Publishes the APK to the repository's Releases page.
Sources: README.md:23-30, package.json:7-13
Technical Implementation Details
The application utilizes a set of standardized schemas for internal data handling and build orchestration.
// Example of the AI assistant input schema
export const AiBuildTroubleshootingAssistantInputSchema = {
buildLog: 'string',
deviceInfo: 'object',
};
export type AiBuildTroubleshootingAssistantInput = {
buildLog: string;
deviceInfo?: {
model?: string;
codename?: string;
gkiVersion?: string;
kmiVersion?: string;
};
};
Sources: src/ai/flows/ai-build-troubleshooting-assistant.ts:5-20
KernelForge acts as a visual bridge between complex Android kernel source code and the final flashable output. By automating patching and packaging, it reduces the manual overhead required for modern kernel development on mobile platforms.