AnyKernel3 Packaging
Relevant source files
The following files were used as context for generating this wiki page:
AnyKernel3 Packaging automates the bundling of compiled Android kernel images into flashable ZIP files. This system eliminates manual file management by outputting packages ready for custom recovery installation directly from the mobile application.
The module integrates the kernel image with generic recovery scripts using the AnyKernel3 template. It supports specific device configurations, including kernel module interface (KMI) compatibility and Generic Kernel Image (GKI) versions.
Sources: README.md:9-11, src/app/page.tsx:556-559
System Architecture
The packaging system operates within the KernelcrafterDashboard component. It relies on the successful completion of the kernel compilation process before enabling the generation of a flashable ZIP.
Workflow Logic
The application follows a linear state progression where packaging is gated by the buildProgress state.
The workflow ensures that only verified kernel images are included in the final package. The createFlashableZip function simulates the packaging of the kernel with the AnyKernel3 template, including metadata about device codename and applied patches.
Sources: src/app/page.tsx:135-139, src/app/page.tsx:561-591
Packaging Configuration
Users configure the ZIP package through the "Flashable" interface. The system captures specific metadata to ensure the installer targets the correct device environment.
Configuration Parameters
| Parameter | Type | Description |
|---|---|---|
kernelUrl | String | Source repository for the kernel code. |
deviceCodename | String | Unique identifier (e.g., "kalama") used in the ZIP filename. |
gkiVersion | String | Target Android GKI version (e.g., android13-5.15). |
ksuVariant | String | Included KernelSU type (Official or Next). |
zipFilename | String | Custom format for the output file naming. |
Sources: src/app/page.tsx:44-51, src/app/page.tsx:569-583
Template Selection
The system defaults to AnyKernel3 (v3.0.x). This universal installer acts as a generic recovery script provider, allowing the kernel to be flashed across different recovery environments.
Sources: src/app/page.tsx:564-570
Implementation Details
The packaging logic is triggered by the createFlashableZip function. This function constructs a Blob with a application/zip MIME type to simulate the generated package.
const createFlashableZip = () => {
if (buildProgress < 100) return;
addLog("Packaging kernel with AnyKernel3 template...", "info");
const dummyZipContent = `AnyKernel3 ZIP Package for ${deviceModel}\nDevice: ${deviceCodename}\nKernel Image: Image-${deviceCodename}.lz4-dtb\nCreated with K-CRAFTER\nIncluded Patches: KSU-${ksuVariant}, SUSFS, NoMount`;
const blob = new Blob([dummyZipContent], { type: "application/zip" });
const url = URL.createObjectURL(blob);
const link = document.createElement("a");
link.href = url;
link.download = `AnyKernel3-Lineage-${deviceCodename}.zip`;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
setTimeout(() => URL.revokeObjectURL(url), 100);
addLog("Generating AnyKernel3 zip: AnyKernel3-Lineage-" + deviceCodename + ".zip", "success");
};
Sources: src/app/page.tsx:135-156
Data Flow for ZIP Generation
The system includes specific blobs such as DTB/DTBO if selected by the user, ensuring the flashable package contains all necessary components for boot.
Sources: src/app/page.tsx:140-153, src/app/page.tsx:585-588
Build Logs and Verification
The packaging process reports its status to the KernelLogs component. This provides a technical audit trail for the zipping process.
- Initialization: Logs the start of the AnyKernel3 template application.
- Success: Confirms the filename and completion of the ZIP generation.
- Error Prevention: The button is disabled unless
buildProgressreaches 100%.
Sources: src/components/dashboard/KernelLogs.tsx:39-65, src/app/page.tsx:594-604
Summary
AnyKernel3 Packaging provides an automated method to convert raw kernel images into recovery-ready installers. By integrating device metadata and build state, the system ensures that the generated ZIP files are compatible with the target Android environment and include all necessary patches and blobs.