Android Kernel Builder - v1 : MizKernel #41
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is for Building the Android Kernel | |
# Builder v0.1 Made for MizKernel | |
# Note that the kernel is only Image and not Image.gz-dtb because samsung and the gz-dtb wont work on samsung | |
name: "Android Kernel Builder - v1 : MizKernel" | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: "What forked version you want from MizKernel" | |
required: true | |
default: "stable" | |
type: choice | |
options: | |
- "stable" | |
- "unstable" | |
- "testing" | |
apatch: | |
description: "Apply APatch to the Kernel" | |
required: true | |
default: "false" | |
type: boolean | |
apatch_password: | |
description: "Password for APatch, don't forget the password or else you're locked out from root access lol" | |
required: true | |
default: "A12345678" | |
type: string | |
notify_telegram_channel: | |
description: "Notify the Telegram Channel (Make sure you set up the secrets with variable named: TELEGRAM_BOT_TOKEN, TELEGRAM_CHAT_ID)" | |
required: true | |
default: "false" | |
type: boolean | |
permissions: | |
contents: write | |
jobs: | |
build: | |
name: "Build MizKernel" | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: "Checkout" | |
uses: actions/checkout@v2 | |
- name: "Set up Timezone" | |
run: | | |
# Only set time to Asia/Manila and NEVER ANY TZ | |
sudo timedatectl set-timezone Asia/Manila | |
- name: "Clean up Bloated Actions" | |
uses: rokibhasansagar/slimhub_actions@main | |
with: | |
retain: "docker_imgcache,docker_buildkit,container_tools,nodejs_npm,toolcache_node" | |
- name: "Set up dependencies" | |
run: | | |
sudo apt update | |
sudo apt upgrade -y | |
sudo apt install aria2 libncurses5 git python-is-python3 python2 python3 wget curl libc6-dev tar -y | |
sudo apt install cpio default-jdk git-core gnupg flex bison gperf build-essential zip curl aria2 libc6-dev libncurses5-dev x11proto-core-dev libx11-dev libreadline6-dev libgl1-mesa-glx libgl1-mesa-dev python3 make sudo gcc g++ bc grep tofrodos python3-markdown libxml2-utils xsltproc zlib1g-dev -y | |
git clone https://github.com/Mizumo-prjkt/clang-r383902 | |
git clone https://github.com/Mizumo-prjkt/aarch64-linux-android-4.9-llvm | |
- name: "Clone the Kernel" | |
run: | | |
git clone https://github.com/MizProject/MizKernel-GalaxyA12s MizKernel | |
cd MizKernel | |
git checkout ${{ github.event.inputs.version }} | |
cd .. | |
- name: "Move the toolchains" | |
run: | | |
mv clang-r383902 MizKernel/clang-r383902 | |
mv aarch64-linux-android-4.9-llvm MizKernel/aarch64-linux-android-4.9-llvm | |
- name: "Build the kernel" | |
run: | | |
cd MizKernel | |
./build_kernel.sh | |
cd .. | |
- name: "Pull Finished Kernel" | |
run: | | |
mkdir processing | |
cp MizKernel/arch/arm64/boot/Image processing/Image-${{github.run_id}} | |
mkdir out | |
- name: "Pull Image-gz-dtb (if present) to out" | |
run: | | |
echo "Pulling Image-gzdtb" | |
echo "If this session fails, either, it's not config in defconfig or idk where, probably in the shadow realm" | |
cp MizKernel/arch/arm64/boot/Image.gz-dtb out/Image.gz-dtb | |
continue-on-error: true | |
# Variable fetching is disabled because it's not working | |
# - name: "Variable fetching" | |
# run: | | |
# echo "IDENTIFIER=$(curl -s https://raw.githubusercontent.com/MizProject/MizKernel-GalaxyA12s/refs/heads/${{github.event.inputs.version}}/CHANGELOG | cat | tr -d '\n\r')" >> $GITHUB_ENV | |
# echo "CHANGELOG=$(curl -s https://raw.githubusercontent.com/MizProject/MizKernel-GalaxyA12s/refs/heads/${{github.event.inputs.version}}/IDENTIFIER | cat | tr -d '\n\r')" >> $GITHUB_ENV | |
# echo "DEBUG IDENT: ${{ env.IDENTIFIER }}" | |
# echo "DEBUG CLOG: ${{ env.CHANGELOG }}" | |
- name: "Patch with APatch" | |
if: ${{ github.event.inputs.apatch == 'true' }} | |
run: | | |
aria2c -x 10 https://magojohnji.github.io/magiskboot-linux/x86_64/magiskboot | |
chmod +x magiskboot | |
aria2c -x 10 https://github.com/bmax121/KernelPatch/releases/download/0.10.7/kptools-linux | |
chmod +x kptools-linux | |
# The aria2c is for downloading the boot.img from Galaxy A12s, if you want to use your own boot.img, edit the link | |
aria2c -x 10 https://github.com/MizProject/MizKernel-GalaxyA12s/releases/download/apatch-template/boot.img | |
mv boot.img processing/boot.img | |
aria2c -x 10 https://github.com/bmax121/KernelPatch/releases/download/0.10.7/kpimg-android | |
sudo mv magiskboot /usr/bin/magiskboot | |
sudo mv kptools-linux /usr/bin/kptools-linux | |
sudo chmod +x /usr/bin/magiskboot | |
sudo chmod +x /usr/bin/kptools-linux | |
mv kpimg-android processing/kpimg-android | |
cd processing | |
magiskboot unpack boot.img | |
rm -rf kernel | |
kptools-linux -p --image Image-${{github.run_id}} --skey ${{ github.event.inputs.apatch_password }} --kpimg kpimg-android --out kernel | |
magiskboot repack boot.img | |
mv new-boot.img ../out/boot.img | |
cp -rf kernel ../out/Image | |
cd .. | |
- name: "Patch Boot Img (Non-Apatch)" | |
if: ${{ github.event.inputs.apatch == 'false' }} | |
run: | | |
aria2c -x 10 https://magojohnji.github.io/magiskboot-linux/x86_64/magiskboot | |
chmod +x magiskboot | |
sudo mv magiskboot /usr/bin/magiskboot | |
sudo chmod +x /usr/bin/magiskboot | |
aria2c -x 10 https://github.com/MizProject/MizKernel-GalaxyA12s/releases/download/apatch-template/boot.img | |
mv boot.img processing/boot.img | |
cd processing | |
magiskboot unpack boot.img | |
rm -rf kernel | |
cp Image-${{github.run_id}} kernel | |
magiskboot repack boot.img | |
mv new-boot.img ../out/boot.img | |
cd .. | |
- name: "Zip it" | |
run: | | |
aria2c -x 10 https://github.com/MizProject/MizKernel-GalaxyA12s/releases/download/zi-template/AnyKernel-TEMPLATE.zip | |
mkdir AnyKernel | |
mv AnyKernel-TEMPLATE.zip AnyKernel | |
cd AnyKernel | |
unzip AnyKernel-TEMPLATE.zip | |
rm -rf AnyKernel-TEMPLATE.zip | |
rm -rf Image | |
cd .. | |
if [ ${{ github.event.inputs.apatch }} == 'true' ]; then | |
cp processing/kernel AnyKernel/Image | |
else | |
cp processing/kernel AnyKernel/Image | |
fi | |
rm -rf AnyKernel/version | |
if [ ${{ github.event.inputs.apatch }} == 'true' ]; then | |
EXTRMSG=" APatch is applied" | |
fi | |
echo "MizKernel-${{github.run_id}}" - Type: ${{github.event.inputs.version}} >> AnyKernel/version | |
echo "Autogen by Github Actions" >> AnyKernel/version | |
echo "Build Date: $(date)" >> AnyKernel/version | |
echo "See the changelog for more info" >> AnyKernel/version | |
echo "Link: https://raw.githubusercontent.com/MizProject/MizKernel-GalaxyA12s/refs/heads/${{github.event.inputs.version}}/CHANGELOG" >> AnyKernel/version | |
cd AnyKernel | |
zip -r MizKernel-${{github.run_id}}-twrp.zip ./* | |
cd .. | |
mv AnyKernel/MizKernel-${{github.run_id}}-twrp.zip out/MizKernel-${{github.run_id}}-twrp.zip | |
- name: "To Github Artifact" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "MizKernel-${{github.run_id}}-artifacts" | |
path: | | |
out/boot.img | |
out/Image | |
out/MizKernel-${{github.run_id}}-twrp.zip | |
continue-on-error: true | |
- name: "Deploy to Github Release" | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: | | |
out/* | |
name: "MizKernel - ${{github.run_id}} - ${{ github.event.inputs.version }}" | |
tag_name: "${{ github.run_id }}" | |
body: | | |
### This is latest build of MizKernel under type: ${{ github.event.inputs.version }}<br> | |
The source code kernel is available at: https://github.com/MizProject/MizKernel-GalaxyA12s<br> | |
Apatch was used? : ${{ github.event.inputs.apatch }}<br> | |
APatch Password: ${{ github.event.inputs.apatch_password }}<br> | |
(Note that if Apatch is set to true, the kernel is patched with APatch, if false, the kernel is not patched with APatch) | |
The Boot Image is advisable to be flashed using Odin or Heimdall<br> | |
The Kernel Image is a raw kernel, you can install it using dd via twrp if you know where to put the kernel in the partition<br> | |
The Zip File is a flashable zip for TWRP | |
Changelog: https://raw.githubusercontent.com/MizProject/MizKernel-GalaxyA12s/refs/heads/${{ github.event.inputs.version }}/CHANGELOG | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_FALLBACK_TOKEN }} | |
- name: "Notify Telegram Channel" | |
if: ${{ github.event.inputs.notify_telegram_channel == 'true' }} | |
uses: appleboy/telegram-action@master | |
with: | |
to: ${{ secrets.TELEGRAM_CHAT_ID }} | |
token: ${{ secrets.TELEGRAM_BOT_TOKEN }} | |
message: | | |
π MizKernel Build Completed π | |
Action ID: ${{ github.run_id }} | |
Apatch: ${{ github.event.inputs.apatch }} | |
Release type: ${{ github.event.inputs.version }} | |
Apatch Password: ${{ github.event.inputs.apatch_password }} | |
If Apatch is set to true, that means the kernel is patched with APatch | |
If false, the kernel is not patched with APatch, thus ignore the Apatch Password | |
For A12s using APatch already, trying to apply an update, i suggest using the zip variant instead, no need to reflash boot partition. | |
Link: https://github.com/MizProject/MizKernel-Kitchen/releases/tag/${{ github.run_id }} | |
Changelog: https://raw.githubusercontent.com/MizProject/MizKernel-GalaxyA12s/refs/heads/${{ github.event.inputs.version }}/CHANGELOG | |
- name: "Notify Telegram Channel - Exynos 850 Chat" | |
if: ${{ github.event.inputs.notify_telegram_channel == 'true' }} | |
uses: appleboy/telegram-action@master | |
with: | |
to: ${{ secrets.TELEGRAM_EXYNOS_CHAT_ID }} | |
token: ${{ secrets.TELEGRAM_BOT_TOKEN }} | |
message: | | |
π MizKernel Build Completed π | |
Action ID: ${{ github.run_id }} | |
Apatch: ${{ github.event.inputs.apatch }} | |
Release type: ${{ github.event.inputs.version }} | |
Apatch Password: ${{ github.event.inputs.apatch_password }} | |
If Apatch is set to true, that means the kernel is patched with APatch | |
If false, the kernel is not patched with APatch, thus ignore the Apatch Password | |
For A12s using APatch already, trying to apply an update, i suggest using the zip variant instead, no need to reflash boot partition. | |
Link: https://github.com/MizProject/MizKernel-Kitchen/releases/tag/${{ github.run_id }} | |