Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Auto detect text files and perform LF normalization
* text=auto eol=lf

# Force bash scripts and metadata to always use LF to prevent recovery shell syntax errors
*.sh text eol=lf
banner text eol=lf
META-INF/com/google/android/updater-script text eol=lf
META-INF/com/google/android/update-binary binary

# Explicitly declare binary tools
tools/magiskboot binary
tools/busybox binary
tools/fec binary
tools/httools_static binary
tools/lptools_static binary
tools/magiskpolicy binary
tools/snapshotupdater_static binary
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: AnyKernel3 CI Validation

on:
push:
branches: [ "main", "master", "Target", "Testing" ]
pull_request:
branches: [ "main", "master", "Target" ]

jobs:
validate:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Ensure Shell Scripts are Executable
run: chmod +x scripts/validate.sh build-release.sh

- name: Run Integrity & Syntax Validation
run: bash scripts/validate.sh

- name: Dry Run Packaging Test
run: bash build-release.sh

- name: Verify Archive Generated
run: |
if [ ! -f WildKernels-AnyKernel3-*.zip ] || [ ! -f WildKernels-AnyKernel3-*.zip.sha256 ]; then
echo "Error: Release artifacts missing!"
exit 1
fi
echo "Release architecture generated successfully."
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Changelog

All notable changes to the Wild Kernels flashing utility will be documented in this file.

## [Unreleased]
### Added
- GitHub Actions CI to strictly enforce `LF` line endings and shell script integrity.
- Automated release generation script `build-release.sh` with sha256 checksumming capabilities.
- Added comprehensive documentation (`README.md`, `CHANGELOG.md`, `upstream_sync_checklist.md`).
- Centralized GKI Array Allowlist mapping (`SUPPORTED_GKI_VERSIONS`).
- Comprehensive parameter configurations in `anykernel.sh` for fine-tuning dynamic validations.

### Fixed
- Fixed trailing quote character in the updater `banner` resolving broken telegram links.
- Normalized existing binaries, shell codes, and config maps from CRLF environments to pristine LF mapping.
- Hardened abort routines checking specifically for major kernel trees instead of raw string failures.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# SakFi OP Kernels - AnyKernel3.1

This repository serves as the official kernel deployment package for **SakFi OP Kernels**. It is an automated, hardened flashing utility designed to deliver GKI-compatible Android kernels seamlessly.

## Features & Highlights
- **Universal GKI Support:** Dynamically queries and supports major GKI kernel versions before flashing (`5.1.*`, `6.1.*`, `6.6.*`), preventing incompatible cross-flashing algorithms.
- **KernelSU Next & SUSFS Native Integration:** Built-in hooks and execution paths structured for advanced root delivery and detection-hiding metrics.
- **Robust CI Automation:** Includes built-in GitHub Action workflows mapped to standard `scripts/validate.sh` verifications to mandate correct shell executions, syntactical accuracy, and LF line-ending hygiene across thousands of device matrices.
- **Upstream Resilience:** Safely isolates user customizations from core `ak3-core.sh` updates, maintaining synchronization sanity with original authors.

## Installation (Custom Recovery/Flasher)
1. Download the latest release `.zip` artifact from the linked repository releases.
2. Boot your device into your designated custom recovery (e.g., TWRP, OrangeFox) or utilize a Kernel Flasher application natively.
3. Flash the `.zip` archive.
*The installer automatically handles ramdisk extraction, KernelSU injection, boot repacking, and environment cleanup!*
4. Reboot into the updated Android System.

## Packaging & Releases
Instead of tedious manual labor, repository maintainers can generate guaranteed release zip artifacts directly.
```bash
./build-release.sh
```
Executes local testing suites and deterministically compiles the `WildKernels-AnyKernel3-[Version].zip` with a matching `.sha256` artifact.

## Credits & Acknowledgements
This repository would not exist without the dedication of the underlying developers.
- **osm0sis**: Original creator of the expansive [AnyKernel3 backend](https://github.com/osm0sis/AnyKernel3).
- **TheWildJames / Morgan Weedman**: Core custom [Wild Kernels packaging logic](https://github.com/TheWildJames/AnyKernel3).
- **fatalcoder524**: OnePlus KernelSU & SUSFS workflow integrations.
- **sidex15 and simonpunk**: Creators of the SUSFS modules modifying native filesystem hooks.
41 changes: 30 additions & 11 deletions anykernel.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
### AnyKernel3 Ramdisk Mod Script
## osm0sis @ xda-developers

### AnyKernel setup
# AnyKernel setup
# global properties
properties() { '
kernel.string=Wild Kernels by TheWildJames aka Morgan Weedman
# Set do.devicecheck=1 to enable device validation. Requires device.nameX configs below.
do.devicecheck=0
do.modules=0
do.systemless=0
do.cleanup=1
do.cleanuponabort=0
do.cleanuponabort=1
# Add supported device codenames here when do.devicecheck=1 (e.g. device.name1=OnePlus12)
device.name1=
device.name2=
device.name3=
device.name4=
device.name5=
# Add OS ranges when strict checking is needed (e.g. supported.versions=11.0.0-14.0.0)
supported.versions=
supported.patchlevels=
supported.vendorpatchlevels=
Expand All @@ -32,16 +35,32 @@ no_magisk_check=1
# import functions/variables and setup patching - see for reference (DO NOT REMOVE)
. tools/ak3-core.sh

kernel_version=$(cat /proc/version | awk -F '-' '{print $1}' | awk '{print $3}')
case $kernel_version in
5.1*) ksu_supported=true ;;
6.1*) ksu_supported=true ;;
6.6*) ksu_supported=true ;;
*) ksu_supported=false ;;
esac
# --- Wild Kernels Custom GKI Compatibility Logic ---
SUPPORTED_GKI_VERSIONS=("5.1.*" "6.1.*" "6.6.*")

check_gki_compatibility() {
local current_kernel_ver=$(cat /proc/version | awk -F '-' '{print $1}' | awk '{print $3}')
local is_supported=false

for supported_ver in "${SUPPORTED_GKI_VERSIONS[@]}"; do
# Use bash pattern matching against the wildcard string
if [[ "$current_kernel_ver" == $supported_ver ]]; then
is_supported=true
break
fi
done

ui_print " " " -> Wild Kernels Supported: $is_supported"

if [ "$is_supported" = false ]; then
local allowed_list="${SUPPORTED_GKI_VERSIONS[*]}"
abort " -> Unsupported kernel version ($current_kernel_ver). This GKI build requires: $allowed_list. Aborting."
fi
}

# Run the compatibility check
check_gki_compatibility

ui_print " " " -> Wild Kernels Supported: $ksu_supported"
$ksu_supported || abort " -> Non-GKI device, abort."

# boot install
split_boot
Expand Down
2 changes: 1 addition & 1 deletion banner
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

WildKernels Telegram Channel:
https://t.me/WildKernels"
https://t.me/WildKernels

WildKernels Website:
https://wildkernels.dev
Expand Down
32 changes: 32 additions & 0 deletions build-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
# build-release.sh
# Deterministic zip creation for AnyKernel3 releases

set -e

# Version calculation
DATE_STR=$(date +%Y%m%d_%H%M)
ZIP_NAME="WildKernels-AnyKernel3-${DATE_STR}.zip"

echo "Building Release: $ZIP_NAME"

# 1. Validate environment before building
if [ -f "scripts/validate.sh" ]; then
bash scripts/validate.sh
else
echo "Warning: Validation script missing, skipping pre-checks."
fi

# 2. Package Creation
# We exclude git, documentation, scripts/ and the zip itself.
echo "Zipping contents..."
zip -r9 "$ZIP_NAME" . -x \*.git\* \*README.md \*CHANGELOG.md \*upstream_sync_checklist.md \*.gitattributes \*scripts/\* \*build-release.sh \*.zip \*.tgz

# 3. Checksum Generation
echo "Generating SHA256 checksum..."
sha256sum "$ZIP_NAME" > "${ZIP_NAME}.sha256"

echo "Build Complete!"
echo "Artifact: $ZIP_NAME"
echo "Checksum: $(cat "${ZIP_NAME}.sha256")"
exit 0
38 changes: 38 additions & 0 deletions scripts/validate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash
# scripts/validate.sh
# Validates line endings, bash syntax, and binary execution bits

set -e

echo "Starting AnyKernel3 validation..."

# 1. CRLF Detection
echo "Checking for CRLF line endings in critical scripts..."
if grep -qU $'\x0D' anykernel.sh tools/ak3-core.sh banner META-INF/com/google/android/updater-script META-INF/com/google/android/update-binary; then
echo "ERROR: CRLF line endings detected in critical text files!"
echo "Please normalize to LF before releasing."
exit 1
else
echo "✓ Line endings look clean (LF)."
fi

# 2. Syntax Check
echo "Running bash syntax checks..."
if bash -n anykernel.sh && bash -n tools/ak3-core.sh; then
echo "✓ Bash syntax tests passed."
else
echo "ERROR: Bash syntax error detected!"
exit 1
fi

# 3. Executable Bits Check (Optional in Git if preserved, but good practice)
echo "Checking execution permissions..."
if ! [ -x "tools/magiskboot" ] || ! [ -x "tools/busybox" ]; then
echo "WARNING: Core binaries in tools/ might not have executable permissions (+x)."
echo "Ensure permissions are preserved during packaging."
else
echo "✓ Binary execution permissions detected."
fi

echo "Validation complete!"
exit 0
19 changes: 19 additions & 0 deletions upstream_sync_checklist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Upstream Sync Checklist

Because `AnyKernel3` is heavily templated, we aim to minimize drift from the core repository so that future updates from `osm0sis` (the original creator) remain easy to merge.

## Core "Vendor Upstream" Files
The following files should **NOT** have custom logic embedded within them unless strictly necessary. All custom kernel checks, device gating, or flash logic should be concentrated inside `anykernel.sh` natively.

- `tools/ak3-core.sh`: The core bash driver.
- `META-INF/com/google/android/update-binary`: The recovery execution script.

## Syncing Updates
When pulling updates from the original [AnyKernel3 upstream](https://github.com/osm0sis/AnyKernel3):

- [ ] Check `tools/ak3-core.sh` for conflict paths. Resolve them by keeping upstream logic.
- [ ] Check `META-INF/com/google/android/update-binary` for conflict paths.
- [ ] Check if `tools/magiskboot` or `tools/busybox` received binary updates. If so, pull the new static binaries.
- [ ] Run the local validation script `bash scripts/validate.sh` to ensure CRLF line endings didn't accidentally slip in with the upstream pull.
- [ ] Test a local Zip build using `./build-release.sh`.
- [ ] Perform a pre-release dry flash on a physical device.