| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563 |
- name: Build Script
- permissions:
- contents: write
- actions: write
- on:
- workflow_call:
- inputs:
- android_version:
- required: true
- type: string
- kernel_version:
- required: true
- type: string
- sub_level:
- required: true
- type: string
- os_patch_level:
- required: true
- type: string
- kernelsu_variant:
- required: true
- type: string
- kernelsu_branch:
- required: true
- type: string
- kernelsu_branch_other:
- required: false
- type: string
- revision:
- required: false
- type: string
- jobs:
- build-gki:
- runs-on: ubuntu-latest
- timeout-minutes: 120
- env:
- CCACHE_COMPILERCHECK: "%compiler% -dumpmachine; %compiler% -dumpversion"
- CCACHE_NOHASHDIR: "true"
- CCACHE_HARDLINK: "true"
- steps:
- - name: Maximize Build Space
- uses: AdityaGarg8/remove-unwanted-software@v5
- with:
- remove-dotnet: 'true' # Frees ~2 GB
- remove-android: 'true' # Frees ~9 GB
- remove-haskell: 'true' # Frees ~5.2 GB
- remove-codeql: 'true' # Frees ~5.4 GB
- remove-docker-images: 'true' # Frees ~3.2 GB
- remove-large-packages: 'true' # Frees ~3.1 GB
- remove-swapfile: 'true' # Frees ~4 GB
- remove-cached-tools: 'false' # Avoid unless confirmed safe
- verbose: 'true' # Enable detailed logging
-
- - name: Set CONFIG Environment Variable
- run: |
- # Set CONFIG dynamically based on inputs values
- CONFIG="${{ inputs.android_version }}-${{ inputs.kernel_version }}-${{ inputs.sub_level }}"
- # Set CONFIG as an environment variable for future steps
- echo "CONFIG=$CONFIG" >> $GITHUB_ENV
- echo "CONFIG set to: $CONFIG"
- - name: Install ccache
- run: sudo apt update && sudo apt install -y ccache
- - name: Set up ccache
- run: |
- mkdir -p ~/.cache/bazel
- ccache --version
- ccache --max-size=2G
- ccache --set-config=compression=true
- echo "CCACHE_DIR=$HOME/.ccache" >> $GITHUB_ENV
- - name: Download toolchain
- run: |
- AOSP_MIRROR=https://android.googlesource.com
- BRANCH=main-kernel-build-2024
- git clone $AOSP_MIRROR/kernel/prebuilts/build-tools -b $BRANCH --depth 1 kernel-build-tools
- git clone $AOSP_MIRROR/platform/system/tools/mkbootimg -b $BRANCH --depth 1 mkbootimg
- - name: Set environment variables
- run: |
- echo "AVBTOOL=$GITHUB_WORKSPACE/kernel-build-tools/linux-x86/bin/avbtool" >> $GITHUB_ENV
- echo "MKBOOTIMG=$GITHUB_WORKSPACE/mkbootimg/mkbootimg.py" >> $GITHUB_ENV
- echo "UNPACK_BOOTIMG=$GITHUB_WORKSPACE/mkbootimg/unpack_bootimg.py" >> $GITHUB_ENV
- - name: Set boot sign key
- env:
- BOOT_SIGN_KEY: ${{ secrets.BOOT_SIGN_KEY }}
- run: |
- if [ ! -z "$BOOT_SIGN_KEY" ]; then
- echo "$BOOT_SIGN_KEY" > ./kernel-build-tools/linux-x86/share/avb/testkey_rsa2048.pem
- echo "BOOT_SIGN_KEY_PATH=$GITHUB_WORKSPACE/kernel-build-tools/linux-x86/share/avb/testkey_rsa2048.pem" >> $GITHUB_ENV
- else
- echo "BOOT_SIGN_KEY is not set. Using AOSP sign key..."
- echo "BOOT_SIGN_KEY_PATH=$GITHUB_WORKSPACE/kernel-build-tools/linux-x86/share/avb/testkey_rsa2048.pem" >> $GITHUB_ENV
- fi
- - name: Install Repo
- run: |
- mkdir -p ./git-repo
- echo "Downloading repo tool..."
- curl https://storage.googleapis.com/git-repo-downloads/repo > ./git-repo/repo
- chmod a+rx ./git-repo/repo
- echo "REPO=$GITHUB_WORKSPACE/./git-repo/repo" >> $GITHUB_ENV
- - name: Clone AnyKernel3 and Other Dependencies
- run: |
- echo "Cloning AnyKernel3 and other dependencies..."
- ANYKERNEL_BRANCH="gki-2.0"
- SUSFS_BRANCH="gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}"
- echo "Using branch for AnyKernel3: $ANYKERNEL_BRANCH"
- echo "Using branch for SUSFS: $SUSFS_BRANCH"
- git clone https://github.com/WildPlusKernel/AnyKernel3.git -b "$ANYKERNEL_BRANCH"
- git clone https://gitlab.com/simonpunk/susfs4ksu.git -b "$SUSFS_BRANCH"
- git clone https://github.com/WildPlusKernel/kernel_patches.git
- - name: Initialize and Sync Kernel Source
- run: |
- echo "Creating folder for configuration: $CONFIG..."
- mkdir -p "$CONFIG"
- cd "$CONFIG"
- echo "Initializing and syncing kernel source..."
- FORMATTED_BRANCH="${{ inputs.android_version }}-${{ inputs.kernel_version }}-${{ inputs.os_patch_level }}"
- $REPO init --depth=1 --u https://android.googlesource.com/kernel/manifest -b common-${FORMATTED_BRANCH} --repo-rev=v2.16
- REMOTE_BRANCH=$(git ls-remote https://android.googlesource.com/kernel/common ${FORMATTED_BRANCH})
- DEFAULT_MANIFEST_PATH=.repo/manifests/default.xml
- if grep -q deprecated <<< $REMOTE_BRANCH; then
- echo "Found deprecated branch: $FORMATTED_BRANCH"
- sed -i "s/\"${FORMATTED_BRANCH}\"/\"deprecated\/${FORMATTED_BRANCH}\"/g" $DEFAULT_MANIFEST_PATH
- fi
- $REPO --version
- $REPO --trace sync -c -j$(nproc --all) --no-tags --fail-fast
- - name: Fix Less Then 6.6.50 Builds
- run: |
- cd "$CONFIG/common"
- if [ "${{ inputs.android_version }}" = "android15" ] && [ "${{ inputs.kernel_version }}" = "6.6" ]; then
- if ! grep -qxF '#include <trace/hooks/fs.h>' ./fs/namespace.c; then
- sed -i '/#include <trace\/hooks\/blk.h>/a #include <trace\/hooks\/fs.h>' ./fs/namespace.c
- else
- echo "Line already present. Skipping insert."
- fi
- fi
- - name: Determine the branch for KernelSU
- run: |
- case "${{ inputs.kernelsu_branch }}" in
- "Stable")
- echo "BRANCH=-" >> $GITHUB_ENV
- ;;
- "Dev")
- if [[ "${{ inputs.kernelsu_variant }}" =~ ^(KSU|MKSU)$ ]]; then
- echo "BRANCH=-s main" >> $GITHUB_ENV
- elif [[ "${{ inputs.kernelsu_variant }}" == "NEXT" ]]; then
- echo "BRANCH=-s next" >> $GITHUB_ENV
- elif [[ "${{ inputs.kernelsu_variant }}" == "WILD" ]]; then
- echo "BRANCH=-s wild" >> $GITHUB_ENV
- fi
- ;;
- "Other")
- if [[ -n "${{ inputs.kernelsu_branch_other }}" ]]; then
- echo "BRANCH=-s ${{ inputs.kernelsu_branch_other }}" >> $GITHUB_ENV
- else
- echo "Error: Custom branch not provided for 'Other'" >&2
- exit 1
- fi
- ;;
- esac
-
- - name: Add KernelSU
- run: |
- echo "Changing to configuration directory: $CONFIG..."
- cd "$CONFIG"
-
- case "${{ inputs.kernelsu_variant }}" in
- "WILD")
- echo "Adding Wild KSU..."
- curl -LSs "https://raw.githubusercontent.com/WildKernels/Wild_KSU/wild/kernel/setup.sh" | bash ${{ env.BRANCH }}
- ;;
- "KSU")
- echo "Adding KernelSU Official..."
- curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash ${{ env.BRANCH }}
- ;;
- "NEXT")
- echo "Adding KernelSU Next..."
- curl -LSs "https://raw.githubusercontent.com/KernelSU-Next/KernelSU-Next/next/kernel/setup.sh" | bash ${{ env.BRANCH }}
- ;;
- "MKSU")
- echo "Adding KernelSU MKSU..."
- curl -LSs "https://raw.githubusercontent.com/5ec1cff/KernelSU/main/kernel/setup.sh" | bash ${{ env.BRANCH }}
- ;;
- esac
-
- - name: Apply SUSFS Patches for KernelSU Variants
- run: |
- echo "Changing to configuration directory: $CONFIG..."
- cd "$CONFIG"
-
- echo "Applying SUSFS patches..."
-
- # Copy SUSFS patches
- cp ../susfs4ksu/kernel_patches/50_add_susfs_in_gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}.patch ./common/
- cd common
- patch -p1 --forward < 50_add_susfs_in_gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}.patch
- cd ..
- cp ../susfs4ksu/kernel_patches/fs/* ./common/fs/
- cp ../susfs4ksu/kernel_patches/include/linux/* ./common/include/linux/
-
- case "${{ inputs.kernelsu_variant }}" in
- "WILD")
- echo "Applying SUSFS patches for Official KernelSU..."
- cd ./Wild_KSU
- ;;
- "KSU")
- echo "Applying SUSFS patches for Official KernelSU..."
- cd ./KernelSU
- cp ../../susfs4ksu/kernel_patches/KernelSU/10_enable_susfs_for_ksu.patch ./
- patch -p1 --forward < 10_enable_susfs_for_ksu.patch
- ;;
- "NEXT")
- echo "Applying SUSFS patches for KernelSU Next..."
- cd ./KernelSU-Next
- cp ../../susfs4ksu/kernel_patches/KernelSU/10_enable_susfs_for_ksu.patch ./
- patch -p1 --forward < 10_enable_susfs_for_ksu.patch || true
-
- cp ../../kernel_patches/next/susfs_fix_patches/v1.5.9/fix_apk_sign.c.patch ./
- patch -p1 --forward < fix_apk_sign.c.patch
-
- cp ../../kernel_patches/next/susfs_fix_patches/v1.5.9/fix_core_hook.c.patch ./
- patch -p1 --forward --fuzz=3 < fix_core_hook.c.patch
-
- cp ../../kernel_patches/next/susfs_fix_patches/v1.5.9/fix_selinux.c.patch ./
- patch -p1 --forward < fix_selinux.c.patch
-
- cp ../../kernel_patches/next/susfs_fix_patches/v1.5.9/fix_ksud.c.patch ./
- patch -p1 --forward < fix_ksud.c.patch
- cp ../../kernel_patches/next/susfs_fix_patches/v1.5.9/fix_rules.c.patch ./
- patch -p1 --forward < fix_rules.c.patch
- cp ../../kernel_patches/next/susfs_fix_patches/v1.5.9/fix_sucompat.c.patch ./
- patch -p1 --forward < fix_sucompat.c.patch
- cp ../../kernel_patches/next/susfs_fix_patches/v1.5.9/fix_kernel_compat.c.patch ./
- patch -p1 --forward < fix_kernel_compat.c.patch
- ;;
- "MKSU")
- echo "Applying SUSFS patches for MKSU..."
- cd ./KernelS
- ;;
- esac
- - name: Getting KernelSU Version
- run: |
- echo "Changing to configuration directory: $CONFIG..."
- cd "$CONFIG"
-
- case "${{ inputs.kernelsu_variant }}" in
- "WILD")
- echo "Applying SUSFS patches for Official KernelSU..."
- cd ./Wild_KSU
- BASE_VERSION=10200
- ;;
- "KSU")
- echo "Applying SUSFS patches for Official KernelSU..."
- cd ./KernelSU
- BASE_VERSION=10200
- ;;
- "NEXT")
- cd ./KernelSU-Next
- BASE_VERSION=10200
- ;;
- "MKSU")
- ;;
- esac
-
- cd ./kernel
- KSU_VERSION=$(expr $(/usr/bin/git rev-list --count HEAD) "+" $BASE_VERSION)
- echo "KSUVER=$KSU_VERSION" >> $GITHUB_ENV
-
- - name: Apply Hooks Patches
- run: |
- echo "Changing to configuration directory: $CONFIG..."
- cd "$CONFIG/common"
-
- if [ "${{ inputs.kernelsu_variant }}" == "NEXT" ]; then
- echo "Applying hooks for KernelSU-Next..."
- cp ../../kernel_patches/next/scope_min_manual_hooks_v1.4.patch ./
- patch -p1 --forward -F 3 < scope_min_manual_hooks_v1.4.patch
- elif [ "${{ inputs.kernelsu_variant }}" == "WILD" ]; then
- echo "Applying hooks for Wild KSU..."
- cp ../../kernel_patches/wild/syscall_hooks.patch ./
- patch -p1 --forward -F 3 < syscall_hooks.patch
- fi
- - name: Apply Hide Stuff Patches
- run: |
- echo "Changing to configuration directory: $CONFIG..."
- cd "$CONFIG/common"
- cp ../../kernel_patches/69_hide_stuff.patch ./
- patch -p1 --forward -F 3 < 69_hide_stuff.patch
- - name: Fix WiFi and Bluetooth on Samsung 6.6 GKI devices
- if: ${{ ( inputs.kernel_version == '6.6' ) }}
- run: |
- echo "[+] Adding Samsung KDP exported symbols to abi_gki_aarch64_galaxy"
- SYMBOL_LIST=$CONFIG/common/android/abi_gki_aarch64_galaxy
- echo "kdp_set_cred_non_rcu" >> $SYMBOL_LIST
- echo "kdp_usecount_dec_and_test" >> $SYMBOL_LIST
- echo "kdp_usecount_inc" >> $SYMBOL_LIST
- echo "[+] Adding Samsung KDP exported symbols definition to abi_gki_aarch64.stg"
- cd $CONFIG/common
- PATCH="../../kernel_patches/samsung/min_kdp/add-min_kdp-symbols.patch"
- if patch -p1 --dry-run < $PATCH; then
- echo "[+] Successfully added Samsung KDP exported symbols definition to abi_gki_aarch64.stg"
- patch -p1 --no-backup-if-mismatch < $PATCH
- fi
- echo "[+] Adding Samsung minimal KDP driver"
- cd drivers
- cp "../../../kernel_patches/samsung/min_kdp/min_kdp.c" min_kdp.c
- echo "obj-y += min_kdp.o" >> Makefile
- - name: Add Configuration Settings
- run: |
- echo "Changing to configuration directory: $CONFIG..."
- cd "$CONFIG"
- echo "Adding configuration settings to gki_defconfig..."
- # Add KSU configuration settings
- echo "CONFIG_KSU=y" >> ./common/arch/arm64/configs/gki_defconfig
-
- if [ "${{ inputs.kernelsu_variant }}" == "NEXT" ] || [ "${{ inputs.kernelsu_variant }}" == "WILD" ]; then
- echo "CONFIG_KSU_KPROBES_HOOK=n" >> ./common/arch/arm64/configs/gki_defconfig
- fi
-
- # Add additional tmpfs config setting
- echo "CONFIG_TMPFS_XATTR=y" >> ./common/arch/arm64/configs/gki_defconfig
- echo "CONFIG_TMPFS_POSIX_ACL=y" >> ./common/arch/arm64/configs/gki_defconfig
- # Add additional config setting
- echo "CONFIG_IP_NF_TARGET_TTL=y" >> ./common/arch/arm64/configs/gki_defconfig
- echo "CONFIG_IP6_NF_TARGET_HL=y" >> ./common/arch/arm64/configs/gki_defconfig
- echo "CONFIG_IP6_NF_MATCH_HL=y" >> ./common/arch/arm64/configs/gki_defconfig
- # Add BBR Config
- echo "CONFIG_TCP_CONG_ADVANCED=y" >> ./common/arch/arm64/configs/gki_defconfig
- echo "CONFIG_TCP_CONG_BBR=y" >> ./common/arch/arm64/configs/gki_defconfig
- echo "CONFIG_NET_SCH_FQ=y" >> ./common/arch/arm64/configs/gki_defconfig
- echo "CONFIG_TCP_CONG_BIC=n" >> ./common/arch/arm64/configs/gki_defconfig
- echo "CONFIG_TCP_CONG_WESTWOOD=n" >> ./common/arch/arm64/configs/gki_defconfig
- echo "CONFIG_TCP_CONG_HTCP=n" >> ./common/arch/arm64/configs/gki_defconfig
- # Remove check_defconfig
- sed -i 's/check_defconfig//' ./common/build.config.gki
- - name: Add SUSFS Configuration Settings
- run: |
- echo "Changing to configuration directory: $CONFIG..."
- cd "$CONFIG"
- # Add SUSFS configuration settings
- echo "CONFIG_KSU_SUSFS=y" >> ./common/arch/arm64/configs/gki_defconfig
- echo "CONFIG_KSU_SUSFS_HAS_MAGIC_MOUNT=y" >> ./common/arch/arm64/configs/gki_defconfig
- echo "CONFIG_KSU_SUSFS_SUS_PATH=y" >> ./common/arch/arm64/configs/gki_defconfig
- echo "CONFIG_KSU_SUSFS_SUS_MOUNT=y" >> ./common/arch/arm64/configs/gki_defconfig
- echo "CONFIG_KSU_SUSFS_AUTO_ADD_SUS_KSU_DEFAULT_MOUNT=y" >> ./common/arch/arm64/configs/gki_defconfig
- echo "CONFIG_KSU_SUSFS_AUTO_ADD_SUS_BIND_MOUNT=y" >> ./common/arch/arm64/configs/gki_defconfig
- echo "CONFIG_KSU_SUSFS_SUS_KSTAT=y" >> ./common/arch/arm64/configs/gki_defconfig
- echo "CONFIG_KSU_SUSFS_SUS_OVERLAYFS=n" >> ./common/arch/arm64/configs/gki_defconfig
- echo "CONFIG_KSU_SUSFS_TRY_UMOUNT=y" >> ./common/arch/arm64/configs/gki_defconfig
- echo "CONFIG_KSU_SUSFS_AUTO_ADD_TRY_UMOUNT_FOR_BIND_MOUNT=y" >> ./common/arch/arm64/configs/gki_defconfig
- echo "CONFIG_KSU_SUSFS_SPOOF_UNAME=y" >> ./common/arch/arm64/configs/gki_defconfig
- echo "CONFIG_KSU_SUSFS_ENABLE_LOG=y" >> ./common/arch/arm64/configs/gki_defconfig
- echo "CONFIG_KSU_SUSFS_HIDE_KSU_SUSFS_SYMBOLS=y" >> ./common/arch/arm64/configs/gki_defconfig
- echo "CONFIG_KSU_SUSFS_SPOOF_CMDLINE_OR_BOOTCONFIG=y" >> ./common/arch/arm64/configs/gki_defconfig
- echo "CONFIG_KSU_SUSFS_OPEN_REDIRECT=y" >> ./common/arch/arm64/configs/gki_defconfig
- if [ "${{ inputs.kernelsu_variant }}" == "NEXT" ] || [ "${{ inputs.kernelsu_variant }}" == "WILD" ]; then
- echo "CONFIG_KSU_SUSFS_SUS_SU=n" >> ./common/arch/arm64/configs/gki_defconfig
- else
- echo "CONFIG_KSU_SUSFS_SUS_SU=y" >> ./common/arch/arm64/configs/gki_defconfig
- fi
- - name: Change Kernel Name
- run: |
- cd "$CONFIG"
- if [ -f "build/build.sh" ]; then
- perl -pi -e 's/-dirty//' ./common/scripts/setlocalversion
- perl -0777 -pi -e 's/(.*)(echo "\$res")/$1echo "\$res-Next-v\$KSUVER-SUSFS-v1.5.9-Wild"/s' ./common/scripts/setlocalversion
- perl -pi -e 's{UTS_VERSION="\$\(echo \$UTS_VERSION \$CONFIG_FLAGS \$TIMESTAMP \| cut -b -\$UTS_LEN\)"}{UTS_VERSION="#1 SMP PREEMPT Sun Apr 20 04:20:00 UTC 2025"}' ./common/scripts/mkcompile_h
- else
- #Remove -maybe-dirty
- perl -pi -e 's/-maybe-dirty//g' ./build/kernel/kleaf/impl/stamp.bzl
-
- #Set Kernel Name
- echo "CONFIG_LOCALVERSION=\"-NEXT-v$KSUVER-SUSFS-v1.5.9-Wild\"" >> ./common/arch/arm64/configs/gki_defconfig
- #Set Kernel Timestamp
- perl -pi -e 's/build-timestamp = \$\(or \$\(KBUILD_BUILD_TIMESTAMP\), \$\(build-timestamp-auto\)\)/build-timestamp = "Sun Apr 20 04:20:00 UTC 2025"/' ./common/init/Makefile
- #Remove Abi Exports and Error
- rm -rf ./common/android/abi_gki_protected_exports_*
- perl -pi -e 's/^\s*"protected_exports_list"\s*:\s*"android\/abi_gki_protected_exports_aarch64",\s*$//;' ./common/BUILD.bazel
- fi
- - name: Build
- run : |
- set -e
- set -x
- cd "$CONFIG"
- echo "Building the kernel..."
- if [ -f "build/build.sh" ]; then
- LTO=thin BUILD_CONFIG=common/build.config.gki.aarch64 build/build.sh CC="/usr/bin/ccache clang" || exit 1
- else
- tools/bazel build --disk_cache=/home/runner/.cache/bazel --config=fast --lto=thin //common:kernel_aarch64_dist || exit 1
- fi
- ccache --show-stats
- - name: Create Bootimgs Folder and Copy Images for Android 12/13
- if: ${{ inputs.android_version == 'android12' || inputs.android_version == 'android13' }}
- run: |
- mkdir bootimgs
- echo "Creating bootimgs folder and copying images..."
- cp ./$CONFIG/out/${{ inputs.android_version }}-${{ inputs.kernel_version }}/dist/Image ./bootimgs
- cp ./$CONFIG/out/${{ inputs.android_version }}-${{ inputs.kernel_version }}/dist/Image.lz4 ./bootimgs
- cp ./$CONFIG/out/${{ inputs.android_version }}-${{ inputs.kernel_version }}/dist/Image ./
- cp ./$CONFIG/out/${{ inputs.android_version }}-${{ inputs.kernel_version }}/dist/Image.lz4 ./
- # Create gzip of the Image file
- gzip -n -k -f -9 ./Image > ./Image.gz
- - name: Create Bootimgs Folder and Copy Images for Android 14/15
- if: ${{ inputs.android_version == 'android14' || inputs.android_version == 'android15' }}
- run: |
- mkdir bootimgs
- echo "Creating bootimgs folder and copying images..."
- cp ./$CONFIG/bazel-bin/common/kernel_aarch64/Image ./bootimgs
- cp ./$CONFIG/bazel-bin/common/kernel_aarch64/Image.lz4 ./bootimgs
- cp ./$CONFIG/bazel-bin/common/kernel_aarch64/Image ./
- cp ./$CONFIG/bazel-bin/common/kernel_aarch64/Image.lz4 ./
- # Create gzip of the Image file
- gzip -n -k -f -9 ./Image > ./Image.gz
- - name: Create ZIP Files for Different Formats
- run: |
- echo "Creating zip files for all formats..."
- cd ./AnyKernel3
-
- # Create and upload zip for each format
- ZIP_NAME="${{ inputs.kernelsu_variant }}-$KSUVER-${{ inputs.android_version }}-${{ inputs.kernel_version }}.${{ inputs.sub_level }}-${{ inputs.os_patch_level }}-AnyKernel3.zip"
- echo "Creating zip file: $ZIP_NAME..."
- mv ../Image ./Image
- zip -r "../$ZIP_NAME" ./*
- rm ./Image
-
- ZIP_NAME="${{ inputs.kernelsu_variant }}-$KSUVER-${{ inputs.android_version }}-${{ inputs.kernel_version }}.${{ inputs.sub_level }}-${{ inputs.os_patch_level }}-AnyKernel3-lz4.zip"
- echo "Creating zip file: $ZIP_NAME..."
- mv ../Image.lz4 ./Image.lz4
- zip -r "../$ZIP_NAME" ./*
- rm ./Image.lz4
-
- ZIP_NAME="${{ inputs.kernelsu_variant }}-$KSUVER-${{ inputs.android_version }}-${{ inputs.kernel_version }}.${{ inputs.sub_level }}-${{ inputs.os_patch_level }}-AnyKernel3-gz.zip"
- echo "Creating zip file: $ZIP_NAME..."
- mv ../Image.gz ./Image.gz
- zip -r "../$ZIP_NAME" ./*
- rm ./Image.gz
- - name: Android 12 boot image build script
- if: ${{ inputs.android_version == 'android12' }}
- run: |
- echo "Changing to configuration directory: $CONFIG..."
- cd bootimgs
-
- GKI_URL=https://dl.google.com/android/gki/gki-certified-boot-android12-5.10-"${{ inputs.os_patch_level }}"_"${{ inputs.revision }}".zip
- FALLBACK_URL=https://dl.google.com/android/gki/gki-certified-boot-android12-5.10-2023-01_r1.zip
-
- # Check if the GKI URL is available
- echo "Checking if GKI kernel URL is reachable: $GKI_URL"
- status=$(curl -sL -w "%{http_code}" "$GKI_URL" -o /dev/null)
-
- if [ "$status" = "200" ]; then
- echo "[+] Downloading from GKI_URL"
- curl -Lo gki-kernel.zip "$GKI_URL"
- else
- echo "[+] $GKI_URL not found, using $FALLBACK_URL"
- curl -Lo gki-kernel.zip "$FALLBACK_URL"
- fi
-
- # Unzip the downloaded kernel and remove the zip
- echo "Unzipping the downloaded kernel..."
- unzip gki-kernel.zip && rm gki-kernel.zip
-
- echo "Unpacking boot.img..."
- FULL_PATH=$(pwd)/boot-5.10.img
- echo "Unpacking using: $FULL_PATH"
-
- echo "Running unpack_bootimg.py..."
- $UNPACK_BOOTIMG --boot_img="$FULL_PATH"
-
- # Create gzip of the Image file
- gzip -n -k -f -9 ./Image > ./Image.gz
-
- echo "Building boot.img"
- $MKBOOTIMG --header_version 4 --kernel Image --output boot.img --ramdisk out/ramdisk --os_version 12.0.0 --os_patch_level "${{ inputs.os_patch_level }}"
- $AVBTOOL add_hash_footer --partition_name boot --partition_size $((64 * 1024 * 1024)) --image boot.img --algorithm SHA256_RSA2048 --key $BOOT_SIGN_KEY_PATH
- cp ./boot.img ../${{ inputs.kernelsu_variant }}-$KSUVER-${{ inputs.android_version }}-${{ inputs.kernel_version }}.${{ inputs.sub_level }}-${{ inputs.os_patch_level }}-boot.img
-
- echo "Building boot-gz.img"
- $MKBOOTIMG --header_version 4 --kernel Image.gz --output boot-gz.img --ramdisk out/ramdisk --os_version 12.0.0 --os_patch_level "${{ inputs.os_patch_level }}"
- $AVBTOOL add_hash_footer --partition_name boot --partition_size $((64 * 1024 * 1024)) --image boot-gz.img --algorithm SHA256_RSA2048 --key $BOOT_SIGN_KEY_PATH
- cp ./boot-gz.img ../${{ inputs.kernelsu_variant }}-$KSUVER-${{ inputs.android_version }}-${{ inputs.kernel_version }}.${{ inputs.sub_level }}-${{ inputs.os_patch_level }}-boot-gz.img
-
- echo "Building boot-lz4.img"
- $MKBOOTIMG --header_version 4 --kernel Image.lz4 --output boot-lz4.img --ramdisk out/ramdisk --os_version 12.0.0 --os_patch_level "${{ inputs.os_patch_level }}"
- $AVBTOOL add_hash_footer --partition_name boot --partition_size $((64 * 1024 * 1024)) --image boot-lz4.img --algorithm SHA256_RSA2048 --key $BOOT_SIGN_KEY_PATH
- cp ./boot-lz4.img ../${{ inputs.kernelsu_variant }}-$KSUVER-${{ inputs.android_version }}-${{ inputs.kernel_version }}.${{ inputs.sub_level }}-${{ inputs.os_patch_level }}-boot-lz4.img
- - name: Android 13/14/15 boot image build script
- if: ${{ inputs.android_version == 'android13' || inputs.android_version == 'android14' || inputs.android_version == 'android15' }}
- run: |
- cd bootimgs
- # Create gzip of the Image file
- gzip -n -k -f -9 ./Image > ./Image.gz
-
- echo "Building boot.img"
- $MKBOOTIMG --header_version 4 --kernel Image --output boot.img
- $AVBTOOL add_hash_footer --partition_name boot --partition_size $((64 * 1024 * 1024)) --image boot.img --algorithm SHA256_RSA2048 --key $BOOT_SIGN_KEY_PATH
- cp ./boot.img ../${{ inputs.kernelsu_variant }}-$KSUVER-${{ inputs.android_version }}-${{ inputs.kernel_version }}.${{ inputs.sub_level }}-${{ inputs.os_patch_level }}-boot.img
-
- echo "Building boot-gz.img"
- $MKBOOTIMG --header_version 4 --kernel Image.gz --output boot-gz.img
- $AVBTOOL add_hash_footer --partition_name boot --partition_size $((64 * 1024 * 1024)) --image boot-gz.img --algorithm SHA256_RSA2048 --key $BOOT_SIGN_KEY_PATH
- cp ./boot-gz.img ../${{ inputs.kernelsu_variant }}-$KSUVER-${{ inputs.android_version }}-${{ inputs.kernel_version }}.${{ inputs.sub_level }}-${{ inputs.os_patch_level }}-boot-gz.img
-
- echo "Building boot-lz4.img"
- $MKBOOTIMG --header_version 4 --kernel Image.lz4 --output boot-lz4.img
- $AVBTOOL add_hash_footer --partition_name boot --partition_size $((64 * 1024 * 1024)) --image boot-lz4.img --algorithm SHA256_RSA2048 --key $BOOT_SIGN_KEY_PATH
- cp ./boot-lz4.img ../${{ inputs.kernelsu_variant }}-$KSUVER-${{ inputs.android_version }}-${{ inputs.kernel_version }}.${{ inputs.sub_level }}-${{ inputs.os_patch_level }}-boot-lz4.img
-
- - name: Compress all img files with gzip
- run: |
- for image in *.img; do
- gzip -vnf9 "$image"
- done
-
- - name: Upload Build Artifacts
- uses: actions/upload-artifact@v4
- with:
- name: ${{ inputs.kernelsu_variant }}-kernel-${{ env.CONFIG }}
- path: |
- *.zip
- *.img.gz
- *Image*
|