| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666 |
- name: Kernel Build Process
- permissions:
- contents: write
- actions: write
- on:
- workflow_call:
- inputs:
- branch:
- required: true
- type: string
- android_version:
- required: true
- type: string
- kernel_version:
- required: true
- type: string
- susfs:
- required: true
- type: string
- bbg:
- required: true
- type: string
- unicodefix:
- required: true
- type: string
- zeromount:
- required: true
- type: string
- wksu:
- required: true
- type: string
- droidspace:
- required: true
- type: string
- ntsync:
- required: true
- type: string
- optimizations:
- required: true
- type: string
- jobs:
- build-samsung-gki:
- name: "${{ inputs.branch }}-${{ inputs.kernel_version }}-${{ inputs.android_version }}"
- runs-on: ubuntu-latest
- strategy:
- fail-fast: false
- steps:
- - name: Free Disk Space
- if: true
- uses: endersonmenezes/free-disk-space@v3 # Use @main for latest, @v3 for stable
- with:
- remove_android: true
- remove_dotnet: true
- remove_haskell: true
- remove_tool_cache: true
- remove_swap: true
- remove_packages: "azure-cli google-cloud-cli microsoft-edge-stable google-chrome-stable firefox postgresql* temurin-* *llvm* mysql* dotnet-sdk-*"
- remove_packages_one_command: true
- remove_folders: "/usr/share/swift /usr/share/miniconda /usr/share/az* /usr/local/lib/node_modules /usr/local/share/chromium /usr/local/share/powershell /usr/local/julia /usr/local/aws-cli /usr/local/aws-sam-cli /usr/share/gradle"
- rm_cmd: "rmz" # Use 'rmz' for faster deletion (default: 'rm')
- rmz_version: "3.1.1" # Required when rm_cmd is 'rmz'
- testing: false
- - name: Setup more Swap (for LTO)
- uses: thejerrybao/setup-swap-space@v1 # or pierotofy/set-swap-space
- with:
- swap-size-gb: 25 # 10-24 GB is common for heavy LTO
- # swap-space-path: /mnt/swapfile # optional
-
- - name: Set CONFIG Environment Variable
- run: |
- # Set CONFIG dynamically based on inputs values
- CONFIG="${{ inputs.branch }}-${{ inputs.android_version }}-${{ inputs.kernel_version }}"
- # Set CONFIG as an environment variable for future steps
- echo "CONFIG=$CONFIG" >> $GITHUB_ENV
- - name: dependencies
- uses: ./.github/actions/dependencies
- with:
- zeromount: ${{ inputs.zeromount }}
- susfs: ${{ inputs.susfs }}
- android_version: ${{ inputs.android_version }}
- kernel_version: ${{ inputs.kernel_version }}
-
- - name: Download Kernel
- uses: ./.github/actions/clone-kernel
- with:
- branch: ${{ inputs.branch }}
-
- - name: Set Path Environment Variables
- run: |
- ROOT="$GITHUB_WORKSPACE"
- if [[ ${{ inputs.susfs }} == 'true' ]]; then
- SUSFS4KSU="$ROOT/susfs4ksu"
- KERNEL_PATCHES="$ROOT/kernel_patches"
- echo "SUSFS4KSU=$SUSFS4KSU" >> $GITHUB_ENV
- echo "KERNEL_PATCHES=$KERNEL_PATCHES" >> $GITHUB_ENV
- fi
- ANYKERNEL3="$ROOT/AnyKernel3"
- if [[ ${{ inputs.zeromount }} == 'true' ]]; then
- ZEROMOUNT="$ROOT/Super-Builders"
- echo "ZEROMOUNT=$ZEROMOUNT" >> $GITHUB_ENV
- fi
-
- if [[ ${{ inputs.branch }} == SM-A546* || "${{ inputs.branch }}" == "SM-M146B-Oneui7-ADYJ2" || "${{ inputs.branch }}" == "SM-S908B-Oneui8-bitK" ]]; then
- COMMON="$CONFIG"
- elif [[ "${{ inputs.branch }}" == "SM-A566B" || ${{ inputs.branch }} == SM-A055* ]]; then
- COMMON="$CONFIG/kernel-6.6"
- elif [[ "${{ inputs.branch }}" == "SM-S926B-Oneui8" || ${{ inputs.branch }} == SM-A556* ]]; then
- COMMON="$CONFIG/kernel"
- else
- COMMON="$CONFIG/kernel_platform/common"
- fi
- if [[ "${{ inputs.branch }}" == "SM-A546B-Oneui7" || "${{ inputs.branch }}" == "SM-A546B-Oneui8" ]]; then
- GKI_DEFCONFIG="$COMMON/arch/arm64/configs/s5e8835-a54xnaxx_defconfig"
- elif [[ "${{ inputs.branch }}" == "SM-A546E-Oneui7" || "${{ inputs.branch }}" == "SM-A546E-Oneui8" ]]; then
- GKI_DEFCONFIG="$COMMON/arch/arm64/configs/s5e8835-a54xnsxx_defconfig"
- elif [[ "${{ inputs.branch }}" == "SM-M146B-Oneui7-ADYJ2" ]]; then
- GKI_DEFCONFIG="$COMMON/arch/arm64/configs/s5e8535-m14xnsxx_defconfig"
- elif [[ "${{ inputs.branch }}" == "SM-S908B-Oneui8-bitK" ]]; then
- GKI_DEFCONFIG="$COMMON/arch/arm64/configs/s5e9925-b0sxxx_defconfig"
- else
- GKI_DEFCONFIG="$COMMON/arch/arm64/configs/gki_defconfig"
- fi
- echo "ROOT=$ROOT" >> $GITHUB_ENV
- echo "ANYKERNEL3=$ANYKERNEL3" >> $GITHUB_ENV
- echo "COMMON=$COMMON" >> $GITHUB_ENV
- echo "GKI_DEFCONFIG=$GKI_DEFCONFIG" >> $GITHUB_ENV
-
- - name: Extract all tar.xz files and delete them
- run: |
- cd "$CONFIG"
- find . -type f -name '*.tar.xz' -print0 | while IFS= read -r -d '' file; do
- echo "Extracting $file"
- tar -xf "$file"
- rm "$file"
- done
- - name: Add KernelSU-Next
- if: inputs.wksu == 'true'
- uses: ./.github/actions/ksun
- # - name: Getting KernelSU-Next Version
- # if: inputs.wksu == 'true'
- # run: |
- # cd "$COMMON/KernelSU-Next/kernel"
- #
- # KSU_DIR=$(pwd)
- # KBUILD="Kbuild"
- # BASE_VERSION=30000
- #if [ -d "$KSU_DIR/.git" ]; then
- # echo "✔ Git repo detected"
- # # Unshallow if needed
- # if [ -f "$KSU_DIR/.git/shallow" ]; then
- # git -C "$KSU_DIR" fetch --unshallow || true
- # fi
- # Get commit count
- # KSU_GIT_VERSION=$(git -C "$KSU_DIR" rev-list --count HEAD)
- # Calculate version
- # KSU_VERSION=$((BASE_VERSION + KSU_GIT_VERSION))
- # Get latest tag (safe)
- # KSU_GIT_TAG=$(git -C "$KSU_DIR" describe --tags --abbrev=0 2>/dev/null || echo "v0.0.1")
- # else
- # echo "⚠ Not a git repo, using defaults"
- # KSU_VERSION=33129
- # KSU_GIT_TAG="v3.2.0"
- # fi
- # echo "Computed version: $KSU_VERSION"
- # echo "Computed tag: $KSU_GIT_TAG"
- # Export for CI (optional)
- # echo "KSU_VERSION=$KSU_VERSION" >> $GITHUB_ENV
- # echo "KSU_VERSION_TAG=$KSU_GIT_TAG" >> $GITHUB_ENV
- # --- Update Kbuild fallback values ---
- # Update numeric fallback
- # sed -i "s/KSU_VERSION_FALLBACK := [0-9]\+/KSU_VERSION_FALLBACK := ${KSU_VERSION}/" "$KBUILD"
- # Update tag fallback
- # sed -i "s/KSU_VERSION_TAG_FALLBACK := .*/KSU_VERSION_TAG_FALLBACK := ${KSU_GIT_TAG}/" "$KBUILD"
- # echo "✅ Updated fallback values in $KBUILD"
- - name: Download susfs and kernel patches
- if: inputs.susfs == 'true'
- uses: ./.github/actions/susfs-clone
- with:
- android_version: ${{ inputs.android_version }}
- kernel_version: ${{ inputs.kernel_version }}
-
- - name: Apply SUSFS Patches
- if: inputs.susfs == 'true'
- uses: ./.github/actions/susfs-patches
- with:
- android_version: ${{ inputs.android_version }}
- kernel_version: ${{ inputs.kernel_version }}
- - name: Apply zeromount Patches
- if: inputs.susfs == 'true' && inputs.zeromount == 'true'
- uses: ./.github/actions/zeromount
- with:
- android_version: ${{ inputs.android_version }}
- kernel_version: ${{ inputs.kernel_version }}
- - name: Fix WiFi and Bluetooth on Samsung 6.6 GKI devices
- if: inputs.kernel_version == '6.6'
- uses: ./.github/actions/6.6-fix
- with:
- kernel_version: ${{ inputs.kernel_version }}
- - name: Add BBG
- if: inputs.bbg == 'true'
- run: |
- cd "$COMMON"
- echo "Adding BBG..."
- curl -LSs https://github.com/vc-teahouse/Baseband-guard/raw/main/setup.sh | bash
- echo "CONFIG_BBG=y" >> arch/arm64/configs/gki_defconfig
- sed -i '/^config LSM$/,/^help$/{ /^[[:space:]]*default/ { /baseband_guard/! s/selinux/selinux,baseband_guard/ } }' security/Kconfig
- cd "$GITHUB_WORKSPACE"
- sed -i '/^CONFIG_LSM=/ s/"$/,baseband_guard"/' "$GKI_DEFCONFIG"
- - name: temp fix for m55 bootloop maybe
- if: inputs.branch == 'SM-M556B-Oneui8'
- run: |
- cd "$COMMON"
- curl -L -s https://raw.githubusercontent.com/jimsterino98/Android-Kernel-Tutorials/refs/heads/main/patches/010.Disable-CRC-Checks.patch | patch -p1 --forward
- cd "$GITHUB_WORKSPACE"
- cat >> "$GKI_DEFCONFIG" << 'EOF'
- #Force Load Kernel Modules
- CONFIG_MODULES=y
- CONFIG_MODULE_FORCE_LOAD=y
- CONFIG_MODULE_UNLOAD=y
- CONFIG_MODULE_FORCE_UNLOAD=y
- CONFIG_MODVERSIONS=y
- CONFIG_MODULE_SRCVERSION_ALL=n
- CONFIG_MODULE_SIG=n
- CONFIG_MODULE_COMPRESS=n
- CONFIG_TRIM_UNUSED_KSYMS=n
-
- #Add btrfs user request
- CONFIG_BTRFS_FS=y
- EOF
- - name: Add unicodefix
- if: inputs.unicodefix == 'true'
- run: |
- cd "$COMMON"
- echo "detected kernel version: ${{ inputs.kernel_version }}"
- if [[ ${{ inputs.kernel_version }} == 6.* ]]; then
- cp "$KERNEL_PATCHES/common/unicode_bypass_fix_6.1+.patch" .
- patch -p1 < unicode_bypass_fix_6.1+.patch
- else
- cp "$KERNEL_PATCHES/common/unicode_bypass_fix_6.1-.patch" .
- patch -p1 < unicode_bypass_fix_6.1-.patch
- fi
- - name: Add droidspace support
- if: inputs.droidspace == 'true'
- run: |
- cd "$COMMON"
- # ABI: use ABI padding for SYSVIPC This commit allows us to enable CONFIG_SYSVIPC in defconfig without breaking kernel ABI
- curl -Ls https://github.com/nullptr-t-oss/android_kernel_common_oneplus_sm8550/commit/769a5cfdc17b98d8e0bd491d45f5651180e42196.patch | patch -p1 --forward
- cd "$GITHUB_WORKSPACE"
- cat >> "$GKI_DEFCONFIG" << 'EOF'
- # IPC
- CONFIG_SYSVIPC=y
- CONFIG_POSIX_MQUEUE=y
- # Namespaces
- CONFIG_IPC_NC=y
- CONFIG_PID_NS=y
- # HW Access Support
- CONFIG_DEVTMPFS=y
- # Below configs are optional
- # Docker NAT
- CONFIG_NETFILTER_XT_MATCH_ADDRTYPE=y
- # UFW
- CONFIG_NETFILTER_XT_TARGET_REJECT=y
- CONFIG_NETFILTER_XT_TARGET_LOG=y
- CONFIG_NETFILTER_XT_MATCH_RECENT
- # Fail2Ban
- CONFIG_IP_SET=y
- CONFIG_IP_SET_HASH_IP=y
- CONFIG_IP_SET_HASH_NET=y
- CONFIG_NETFILTER_XT_SET=y
- EOF
-
- - name: Set Kernel Configuration Variables
- if: inputs.wksu == 'true'
- run: |
-
- echo "Initializing kernel configuration..."
- cat >> "$GKI_DEFCONFIG" << 'EOF'
- # Mountify Support
- CONFIG_OVERLAY_FS=y
- CONFIG_TMPFS_XATTR=y
- CONFIG_TMPFS_POSIX_ACL=y
- # increase log buffer size to show bbg version in wksu homepage
- CONFIG_LOG_BUF_SHIFT=20
- EOF
- if [[ "${{ inputs.branch }}" == "SM-S938B-Oneui7" || "${{ inputs.branch }}" == "SM-S931B-Oneui8" ]]; then
- echo "nothing to see here moving on"
-
- elif [[ "${{ inputs.branch }}" == "SM-S926B-Oneui8" ]]; then
- cat >> "$COMMON/arch/arm64/configs/s5e9945-bazel_defconfig" << 'EOF'
- # nuke root protection
- CONFIG_UH=n
- CONFIG_UH_RKP=n
- CONFIG_UH_LKMAUTH=n
- CONFIG_UH_LKM_BLOCK=n
- CONFIG_RKP_CFP_JOPP=n
- CONFIG_RKP_CFP=n
- CONFIG_SECURITY_DEFEX=n
- CONFIG_PROCA=n
- CONFIG_FIVE=n
- CONFIG_RKP=n
- CONFIG_KDP_NS=n
- CONFIG_KDP=n
- EOF
- elif [[ ${{ inputs.branch }} == SM-A556* ]]; then
- cat >> "$COMMON/arch/arm64/configs/s5e8845-bazel_defconfig" << 'EOF'
- # nuke root protection
- CONFIG_UH=n
- CONFIG_UH_RKP=n
- CONFIG_UH_LKMAUTH=n
- CONFIG_UH_LKM_BLOCK=n
- CONFIG_RKP_CFP_JOPP=n
- CONFIG_RKP_CFP=n
- CONFIG_SECURITY_DEFEX=n
- CONFIG_PROCA=n
- CONFIG_FIVE=n
- CONFIG_RKP=n
- CONFIG_KDP_NS=n
- CONFIG_KDP=n
- EOF
- else
- cat >> "$GKI_DEFCONFIG" << 'EOF'
- # nuke root protection
- CONFIG_UH=n
- CONFIG_UH_RKP=n
- CONFIG_UH_LKMAUTH=n
- CONFIG_UH_LKM_BLOCK=n
- CONFIG_RKP_CFP_JOPP=n
- CONFIG_RKP_CFP=n
- CONFIG_SECURITY_DEFEX=n
- CONFIG_PROCA=n
- CONFIG_FIVE=n
- CONFIG_RKP=n
- CONFIG_KDP_NS=n
- CONFIG_KDP=n
- EOF
- fi
-
- cd "$COMMON"
- # Remove check_defconfig
- sed -i 's/check_defconfig//' ./build.config.gki
- - name: Add optimizations from kernel patches/common
- if: inputs.optimizations == 'true'
- run: |
- cd "$COMMON"
- echo "Optimizing Kernel..."
- cp "$KERNEL_PATCHES/common/"*.patch ./
- rm -rf unicode_bypass_fix_6.1+.patch
- rm -rf unicode_bypass_fix_6.1-.patch
- rm -rf IPv6_NAT_FIX.patch
- for p in *.patch; do
- if patch -p1 --dry-run < "$p"; then
- echo "patch is OK, applying $p"
- patch -p1 < "$p"
- rm -f "$p"
- else
- echo "$p failed, skipping patch"
- fi
- done
- echo "Kernel Optimized, hehe"
- - name: Add ntsync
- if: inputs.ntsync == 'true'
- run: |
- cd "$COMMON"
- echo "applying ntsync patches"
- cp "$KERNEL_PATCHES/common/ntsync/ntsync_base.patch" .
- cp "$KERNEL_PATCHES/common/ntsync/ntsync_compat_${{ inputs.android_version }}-${{ inputs.kernel_version }}.patch" .
- patch -p1 < ntsync_base.patch || true
- patch -p1 < ntsync_compat_${{ inputs.android_version }}-${{ inputs.kernel_version }}.patch
- cd "$GITHUB_WORKSPACE"
- cat >> "$GKI_DEFCONFIG" << 'EOF'
- CONFIG_NTSYNC=y
- EOF
- - name: Change Kernel Name and remove protected exports
- run: |
- cd "$COMMON"
- #Add Wild to Kernel Version
- sed -i '$s|echo "\$res"|echo "\$res-Wild"|' ./scripts/setlocalversion
- #Set Kernel Timestamp
- #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"}' ./scripts/mkcompile_h
-
- #Remove Abi Exports and Error
- rm -rf ./android/abi_gki_protected_exports_*
- perl -pi -e 's/^\s*"protected_exports_list"\s*:\s*"android\/abi_gki_protected_exports_aarch64",\s*$//;' ./BUILD.bazel
-
- - name: Clean Dirty Flags
- run: |
- # remove dirty
- sed -i 's/-dirty//' "./$COMMON/scripts/setlocalversion"
-
- - name: Set file name
- if: inputs.wksu == 'true'
- run: |
- ARTIFACT_BASE="${{ inputs.branch }}-${{ inputs.kernel_version }}-${{ inputs.android_version }}"
-
- # This gives: KSUxxxxx-branch-xxx-xxx
- FILE_NAME="KSU${KSU_VERSION}-${ARTIFACT_BASE}"
-
- echo "ARTIFACT_BASE=$ARTIFACT_BASE" >> $GITHUB_ENV
- echo "FILE_NAME=$FILE_NAME" >> $GITHUB_ENV
-
- echo "✅ Final artifact name: $FILE_NAME"
- - name: Build
- run : |
- set -e
- set -x
- cd "$CONFIG"
- echo "Building the kernel..."
- if [[ ${{ inputs.branch }} == SM-S928B* || "${{ inputs.branch }}" == "SM-S938B-Oneui7" || "${{ inputs.branch }}" == "SM-S931B-Oneui8" || "${{ inputs.branch }}" == "SM-F741B-Oneui8" ]]; then
- chmod +x build_kernel_GKI.sh
- ./build_kernel_GKI.sh || true
- elif [[ "${{ inputs.branch }}" == "SM-X916B" || "${{ inputs.branch }}" == "SM-F946N-Oneui7" || "${{ inputs.branch }}" == "SM-S916B-Oneui8" || "${{ inputs.branch }}" == "SM-S918B-Oneui8" || "${{ inputs.branch }}" == "SM-F946B-Oneui8" || "${{ inputs.branch }}" == "SM-S901E-Oneui8" || "${{ inputs.branch }}" == "SM-X800-Oneui8" || "${{ inputs.branch }}" == "SM-S911B-Oneui8-bit8" || "${{ inputs.branch }}" == "SM-M556B-Oneui8" ]]; then
- chmod +x build_kernel_GKI.sh
- #LTO=thin ./build_kernel_GKI.sh || true
- ./build_kernel_GKI.sh || true
- elif [[ ${{ inputs.branch }} == SM-A546* || "${{ inputs.branch }}" == "SM-M146B-Oneui7-ADYJ2" || "${{ inputs.branch }}" == "SM-S908B-Oneui8-bitK" ]]; then
- sudo apt update
- sudo apt-get install -y libyaml-dev
- chmod +x build_kernel.sh
- #LTO=thin ./build_kernel.sh || true
- ./build_kernel.sh || true
- elif [[ "${{ inputs.branch }}" == "SM-A566B" ]]; then
- chmod +x build_script.sh
- touch ./kernel-6.6/abi_symbollist.raw
- touch ./kernel-6.6/abi_symbollist
- ./build_script.sh || true
- elif [[ "${{ inputs.branch }}" == "SM-S926B-Oneui8" ]]; then
- tools/bazel run --nocheck_bzl_visibility --config=stamp --sandbox_debug --verbose_failures --debug_make_verbosity=I //projects/s5e9945:s5e9945_user_dist
- elif [[ ${{ inputs.branch }} == SM-A556* ]]; then
- tools/bazel run --nocheck_bzl_visibility --config=stamp --sandbox_debug --verbose_failures --debug_make_verbosity=I //projects/s5e8845:s5e8845_user_dist
- elif [[ ${{ inputs.branch }} == SM-A055* ]]; then
- chmod +x build_kernel.sh
- ./build_kernel.sh
- else
- #temporarily using this until i can figure out the other phones build script issues
- cd kernel_platform
- tools/bazel build --config=fast --lto=thin //common:kernel_aarch64_dist || exit 1
- fi
-
- - name: Prepare AnyKernel3
- run: |
- cd "$CONFIG"
- # Copy Image from normal build locations
- #if [ -f "./$CONFIG/out/${{ inputs.android_version }}-${{ inputs.kernel_version }}/dist/Image" ]; then
- # cp ./$CONFIG/out/${{ inputs.android_version }}-${{ inputs.kernel_version }}/dist/Image AnyKernel3/Image
- #elif [ -f "./$CONFIG/bazel-bin/common/kernel_aarch64/Image" ]; then
- # cp ./$CONFIG/bazel-bin/common/kernel_aarch64/Image AnyKernel3/Image
- #else
- # echo "Error: Image file not found in any expected location"
- # exit 1
- #fi
-
- if [[ "${{ inputs.branch }}" == "SM-S928B-Oneui7" || "${{ inputs.branch }}" == "SM-S928B-Oneui8-bit4" || "${{ inputs.branch }}" == "SM-S928B-Oneui8-bit5" || "${{ inputs.branch }}" == "SM-F741B-Oneui8" ]]; then
- cp ./kernel_platform/sec/dist/Image "$ANYKERNEL3/Image"
- elif [[ "${{ inputs.branch }}" == "SM-S928B-Oneui6.1" ]]; then
- cp ./out/msm-pineapple-pineapple-gki/dist/Image "$ANYKERNEL3/Image"
- elif [[ "${{ inputs.branch }}" == "SM-S938B-Oneui7" || "${{ inputs.branch }}" == "SM-S931B-Oneui8" || "${{ inputs.branch }}" == "SM-M556B-Oneui8" ]]; then
- cp ./kernel_platform/gki/dist/Image "$ANYKERNEL3/Image"
- elif [[ -f ./$CONFIG/bazel-bin/common/kernel_aarch64/Image ]]; then
- cp ./$CONFIG/bazel-bin/common/kernel_aarch64/Image "$ANYKERNEL3/Image"
- elif [[ "${{ inputs.branch }}" == "SM-X916B" || "${{ inputs.branch }}" == "SM-F946N-Oneui7" || "${{ inputs.branch }}" == "SM-F946B-Oneui8" || "${{ inputs.branch }}" == "SM-S916B-Oneui8" || "${{ inputs.branch }}" == "SM-S918B-Oneui8" || "${{ inputs.branch }}" == "SM-S911B-Oneui8-bit8" ]]; then
- cp ./out/msm-kalama-kalama-gki/dist/Image "$ANYKERNEL3/Image"
- elif [[ ${{ inputs.branch }} == SM-A546* || "${{ inputs.branch }}" == "SM-M146B-Oneui7-ADYJ2" || "${{ inputs.branch }}" == "SM-S908B-Oneui8-bitK" ]]; then
- cp ./arch/arm64/boot/Image "$ANYKERNEL3/Image"
- elif [[ "${{ inputs.branch }}" == "SM-A566B" ]]; then
- cp ./kernel-6.6/out/arch/arm64/boot/Image "$ANYKERNEL3/Image"
- elif [[ "${{ inputs.branch }}" == "SM-S926B-Oneui8" ]]; then
- cp ./out/s5e9945_user/dist/Image "$ANYKERNEL3/Image"
- elif [[ ${{ inputs.branch }} == SM-A556* ]]; then
- cp ./out/s5e8845_user/dist/Image "$ANYKERNEL3/Image"
- elif [[ "${{ inputs.branch }}" == "SM-S901E-Oneui8" || "${{ inputs.branch }}" == "SM-X800-Oneui8" ]]; then
- cp ./out/msm-waipio-waipio-gki/dist/Image "$ANYKERNEL3/Image"
- elif [[ ${{ inputs.branch }} == SM-A055* ]]; then
- cp ./out/target/product/a05m/obj/KLEAF_OBJ/dist/kernel_device_modules-6.6/mgk_64_k66_kernel_aarch64.user/Image.gz "$ANYKERNEL3/Image.gz"
- else
- echo "Error: Image file not found in any expected location"
- exit 1
- fi
- - name: Upload AnyKernel3 Artifacts
- id: upload_ak3
- uses: actions/upload-artifact@v6
- with:
- name: ${{ env.FILE_NAME }}-AnyKernel3
- path: |
- ./AnyKernel3/**
- compression-level: 9
-
- - name: Scan and collect patch rejects
- if: ${{ always() }}
- run: |
- set -e
- CONFIG_DIR="$CONFIG"
- REJECTS_DIR="$GITHUB_WORKSPACE/patch-rejects"
- mkdir -p "$REJECTS_DIR"
- # Find all .rej files under the configuration directory
- mapfile -t REJS < <(find "$CONFIG_DIR" -type f -name '*.rej')
- REJ_COUNT=${#REJS[@]}
- echo "Found $REJ_COUNT .rej files under $CONFIG_DIR"
- echo "REJ_COUNT=$REJ_COUNT" >> $GITHUB_ENV
- if [ "$REJ_COUNT" -gt 0 ]; then
- for REJ in "${REJS[@]}"; do
- # Relative path from $CONFIG
- REL="${REJ#"$CONFIG_DIR"/}"
- DEST="$REJECTS_DIR/$REL"
- mkdir -p "$(dirname "$DEST")"
- cp "$REJ" "$DEST"
- # Copy the associated original file alongside the .rej
- ORIG="${REJ%.rej}"
- if [ -f "$ORIG" ]; then
- ORIG_DEST="$REJECTS_DIR/${REL%.rej}"
- mkdir -p "$(dirname "$ORIG_DEST")"
- cp "$ORIG" "$ORIG_DEST"
- fi
- echo "$REL" >> "$REJECTS_DIR/index.txt"
- done
- fi
- - name: Generate Build Summary
- if: ${{ always() }}
- run: |
- # Create build summary file for inclusion in Misc artifact
- echo "# Kernel Build Summary" > build_summary.md
-
- # Add build variant header
- echo "## ${{ env.FILE_NAME }}" >> build_summary.md
-
- # Add build info
- echo "## Build Information" >> build_summary.md
- echo "- **Android Version**: ${{ inputs.android_version }}" >> build_summary.md
- echo "- **Kernel Version**: ${{ inputs.kernel_version }}.${{ inputs.sub_level }}" >> build_summary.md
- echo "- **BBG**: Installed" >> build_summary.md
- echo "- **Bypass Mode**: ${{ matrix.apply_bypass }}" >> build_summary.md
- echo "" >> build_summary.md
- # Get KernelSU-Next commit
- if [ -d "$CONFIG/KernelSU-Next" ]; then
- cd "$CONFIG/KernelSU-Next"
- KSUN_COMMIT=$(git rev-parse HEAD)
- KSUN_URL="https://github.com/WildKernels/KernelSU-Next/commit/$KSUN_COMMIT"
- echo "- **KernelSU-Next**: [$KSUN_COMMIT]($KSUN_URL)" >> "$GITHUB_WORKSPACE/build_summary.md"
- cd "$GITHUB_WORKSPACE"
- else
- echo "- **KernelSU-Next**: not present" >> build_summary.md
- fi
-
- # Get Baseband-guard commit
- if [ -d "$CONFIG/Baseband-guard" ]; then
- cd "$CONFIG/Baseband-guard"
- BBG_COMMIT=$(git rev-parse HEAD)
- BBG_URL="https://github.com/vc-teahouse/Baseband-guard/commit/$BBG_COMMIT"
- echo "- **Baseband-guard**: [$BBG_COMMIT]($BBG_URL)" >> "$GITHUB_WORKSPACE/build_summary.md"
- cd "$GITHUB_WORKSPACE"
- else
- echo "- **Baseband-guard**: not present" >> build_summary.md
- fi
-
- # Get SUSFS4KSU commit
- if [ -d "$GITHUB_WORKSPACE/susfs4ksu" ]; then
- cd "$GITHUB_WORKSPACE/susfs4ksu"
- SUSFS_COMMIT=$(git rev-parse HEAD)
- SUSFS_URL="https://gitlab.com/simonpunk/susfs4ksu/-/commit/$SUSFS_COMMIT"
- echo "- **SUSFS4KSU (v2.1.0)**: [$SUSFS_COMMIT]($SUSFS_URL)" >> "$GITHUB_WORKSPACE/build_summary.md"
- cd "$GITHUB_WORKSPACE"
- else
- echo "- **SUSFS4KSU (v2.1.0)**: not present" >> build_summary.md
- fi
- echo "" >> build_summary.md
-
- # Add artifact summary with presence verification
- echo "## Build Artifacts" >> build_summary.md
- # Verify AnyKernel3 contents - check if kernel Image was actually copied (indicates successful build)
- if [ -d "AnyKernel3" ] && [ -f "AnyKernel3/Image" ]; then
- AK3_STATUS="✅"
- else
- AK3_STATUS="❌"
- fi
- echo "- **AnyKernel3**: $AK3_STATUS ${{ env.FILE_NAME }}-AnyKernel3" >> build_summary.md
- echo "### Misc (uploaded files)" >> build_summary.md
- FILES_PRESENT=0
- for f in "${{ env.FILE_NAME }}-Image" "${{ env.FILE_NAME }}-Image.gz" "${{ env.FILE_NAME }}-Image.lz4" "${{ env.FILE_NAME }}-boot.img" "${{ env.FILE_NAME }}-boot-gz.img" "${{ env.FILE_NAME }}-boot-lz4.img"; do
- if [ -f "$f" ]; then FILES_PRESENT=$((FILES_PRESENT+1)); fi
- done
- if [ "$FILES_PRESENT" -gt 0 ]; then
- MISC_STATUS="✅"
- else
- MISC_STATUS="❌"
- fi
- echo "- **Set**: $MISC_STATUS ${{ env.FILE_NAME }}-Misc" >> build_summary.md
- if [ "$MISC_STATUS" = "✅" ]; then
- echo " Included:" >> build_summary.md
- for f in "${{ env.FILE_NAME }}-Image" "${{ env.FILE_NAME }}-Image.gz" "${{ env.FILE_NAME }}-Image.lz4" "${{ env.FILE_NAME }}-boot.img" "${{ env.FILE_NAME }}-boot-gz.img" "${{ env.FILE_NAME }}-boot-lz4.img"; do
- if [ -f "$f" ]; then
- echo " - $f" >> build_summary.md
- fi
- done
- fi
- echo "### Diagnostics" >> build_summary.md
- echo "- **Rejected Patches**: ${{ env.FILE_NAME }}-Rejected-Patches" >> build_summary.md
- if [ -f patch-rejects/index.txt ]; then
- if [ -s patch-rejects/index.txt ]; then
- echo " Rejected files:" >> build_summary.md
- while IFS= read -r line; do
- echo " - $line" >> build_summary.md
- done < patch-rejects/index.txt
- else
- echo " Rejected file list is empty." >> build_summary.md
- fi
- else
- echo " No rejected patches found." >> build_summary.md
- fi
|