| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686 |
- 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
- crc:
- 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: 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: Clone AnyKernel3 and Other Dependencies
- run: |
- ANYKERNEL_BRANCH="gki-2.0"
- SUSFS_BRANCH="gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}"
-
- git clone https://github.com/WildKernels/AnyKernel3.git -b "$ANYKERNEL_BRANCH"
- git clone https://github.com/WildKernels/kernel_patches.git
- git clone https://gitlab.com/simonpunk/susfs4ksu.git -b "$SUSFS_BRANCH"
- git clone https://github.com/jimsterino98/Super-Builders.git
-
- - name: Clone Kernel Source
- run: |
- git clone --depth 1 -b ${{ inputs.branch }} --single-branch https://github.com/WildKernels/Samsung_Kernels.git $CONFIG
-
- - name: Set Path Environment Variables
- run: |
- ROOT="$GITHUB_WORKSPACE"
- SUSFS4KSU="$ROOT/susfs4ksu"
- KERNEL_PATCHES="$ROOT/kernel_patches"
- ANYKERNEL3="$ROOT/AnyKernel3"
- ZEROMOUNT="$ROOT/Super-Builders"
- if [[ ${{ inputs.branch }} == SM-A546* || "${{ inputs.branch }}" == "SM-M146B-Oneui7-ADYJ2" ]]; then
- COMMON="$CONFIG"
- elif [[ "${{ inputs.branch }}" == "SM-A566B" ]]; then
- COMMON="$CONFIG/kernel-6.6"
- elif [[ "${{ inputs.branch }}" == "SM-S926B-Oneui8" ]]; then
- COMMON="$CONFIG/kernel"
- else
- COMMON="$CONFIG/kernel_platform/common"
- fi
- if [[ "${{ inputs.branch }}" == "SM-A546B-Oneui7" || "${{ inputs.branch }}" == "SM-A546B-Oneui8" ]]; then
- DEFCONFIG="$COMMON/arch/arm64/configs/s5e8835-a54xnaxx_defconfig"
- elif [[ "${{ inputs.branch }}" == "SM-A546E-Oneui7" || "${{ inputs.branch }}" == "SM-A546E-Oneui8" ]]; then
- DEFCONFIG="$COMMON/arch/arm64/configs/s5e8835-a54xnsxx_defconfig"
- elif [[ "${{ inputs.branch }}" == "SM-M146B-Oneui7-ADYJ2" ]]; then
- DEFCONFIG="$COMMON/arch/arm64/configs/s5e8535-m14xnsxx_defconfig"
- else
- DEFCONFIG="$COMMON/arch/arm64/configs/gki_defconfig"
- fi
- echo "ROOT=$ROOT" >> $GITHUB_ENV
- echo "SUSFS4KSU=$SUSFS4KSU" >> $GITHUB_ENV
- echo "KERNEL_PATCHES=$KERNEL_PATCHES" >> $GITHUB_ENV
- echo "ANYKERNEL3=$ANYKERNEL3" >> $GITHUB_ENV
- echo "COMMON=$COMMON" >> $GITHUB_ENV
- echo "DEFCONFIG=$DEFCONFIG" >> $GITHUB_ENV
- echo "ZEROMOUNT=$ZEROMOUNT" >> $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 Wild_KSU
- if: inputs.wksu == 'true'
- run: |
- cd "$COMMON"
- curl -LSs "https://raw.githubusercontent.com/WildKernels/Wild_KSU/wild/kernel/setup.sh" | bash -s canary
- cd "$GITHUB_WORKSPACE"
- cat >> "$DEFCONFIG" << 'EOF'
- # KernelSU Configuration
- CONFIG_KSU=y
- EOF
- - name: Getting Wild_KSU Version
- if: inputs.wksu == 'true'
- run: |
- cd "$COMMON/Wild_KSU/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=33219
- KSU_GIT_TAG="v3.1.2"
- 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: Apply SUSFS Patches
- if: inputs.susfs == 'true'
- run: |
- cd "$COMMON"
- # Apply compatibility fixes
- SUSFS_VERSION="2.1.0"
-
- cp "$SUSFS4KSU/kernel_patches/fs/"* ./fs/
- cp "$SUSFS4KSU/kernel_patches/include/linux/"* ./include/linux/
- cp "$SUSFS4KSU/kernel_patches/50_add_susfs_in_gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}.patch" ./
- #Prepare open.c for susfs patching
- sed -i '/#ifdef CONFIG_SECURITY_DEFEX/,/^#endif/d' fs/open.c
- #Prepare namespace.c for susfs patching
- sed -i '/copy_flags = CL_COPY_UNBINDABLE | CL_EXPIRE;/,/#endif/ {
- /#ifdef CONFIG_KDP_NS/,/#endif/ {
- /#else/,/#endif/!d
- /#else/d
- /#endif/d
- }
- }' fs/namespace.c
-
- # Apply SUSFS core patch
- patch -p1 < 50_add_susfs_in_gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}.patch || true
- rm -rf 50_add_susfs_in_gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}.patch
-
- if [ -d "$KERNEL_PATCHES/samsung/${{ inputs.branch }}" ]; then
- echo "Directory exists, applying fixes"
- cp "$KERNEL_PATCHES/samsung/${{ inputs.branch }}/"*.patch ./
-
- if [ "${{ inputs.crc }}" == "false" ]; then
- rm -rf Disable_CRC.patch
- fi
- # Fix SUSFS rejects
- shopt -s nullglob
- for p in *.patch; do
- patch -p1 < "$p"
- rm -f "$p"
- done
- shopt -u nullglob
- else
- echo "No directory found, skipping"
- fi
-
- cd "$GITHUB_WORKSPACE"
- cat >> "$DEFCONFIG" << 'EOF'
- # SUSFS Configuration
- CONFIG_KSU_SUSFS=y
- EOF
-
- if [[ ${{ inputs.zeromount }} == 'true' ]]; then
- echo "adding zeromount..."
-
- cd "$COMMON"
- cp "$ZEROMOUNT/${{ inputs.android_version }}-${{ inputs.kernel_version }}/WildKSU/patches/60_zeromount-${{ inputs.android_version }}-${{ inputs.kernel_version }}.patch" .
- #patch -p1 < 51_enhanced_susfs_gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}.patch || true
- patch -p1 < 60_zeromount-${{ inputs.android_version }}-${{ inputs.kernel_version }}.patch || true
- rm -rf 60_zeromount-${{ inputs.android_version }}-${{ inputs.kernel_version }}.patch
- if [ -f fs/proc/task_mmu.c ]; then
- echo "Fixing task_mmu.c..."
- sed -i '/pgoff = ((loff_t)vma->vm_pgoff) << PAGE_SHIFT;/a\
- #ifdef CONFIG_ZEROMOUNT\
- \tzeromount_spoof_mmap_metadata(inode, \&dev, \&ino);\
- #endif' fs/proc/task_mmu.c
- fi
- if [ -f fs/stat.c.rej ]; then
- echo "fixing stat.c."
- if ! grep -q 'zeromount_stat_hook(dfd, filename, stat, request_mask, flags)' fs/stat.c; then
- perl -0pi -e 's@(static int vfs_statx\(.*?\)\s*\{.*?orig_flow:\n#endif\n)@$1\n#ifdef CONFIG_ZEROMOUNT\n\tif (filename) {\n\t\tint zm_ret = zeromount_stat_hook(dfd, filename, stat, request_mask, flags);\n\t\tif (zm_ret != -ENOENT)\n\t\t\treturn zm_ret;\n\t}\n#endif\n\n@s' fs/stat.c
- fi
- fi
- if [ -f fs/Kconfig.rej ]; then
- echo "Applying Kconfig zeromount fix..."
- if ! grep -q '^config ZEROMOUNT$' fs/Kconfig; then
- perl -0pi -e 's@(config IO_WQ\n\tbool\n)@\1\nconfig ZEROMOUNT\n\tbool "ZeroMount Path Redirection Subsystem"\n\tdefault y\n\thelp\n\t ZeroMount allows path redirection and virtual file injection\n\t without mounting filesystems. Useful for systemless modifications.\n\n@' fs/Kconfig
- fi
- fi
- #patch -p1 < 70_ksu_safety-wksu-${{ inputs.kernel_version }}.patch || true
- cd "$GITHUB_WORKSPACE"
- cat >> "$DEFCONFIG" << 'EOF'
- # Zeromount Configuration
- CONFIG_ZEROMOUNT=y
- EOF
- fi
-
- - name: Fix WiFi and Bluetooth on Samsung 6.6 GKI devices
- if: ${{ inputs.kernel_version == '6.6' }}
- run: |
- cd "$COMMON"
-
- SYMBOL_LIST=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
- if [[ "${{ inputs.branch }}" == "SM-S931B-Oneui8" ]]; then
- echo "snd_soc_find_dai" >> $SYMBOL_LIST
- sed -i '
- /"kernel_aarch64": {/,/},/ {
- s/"kmi_symbol_list_strict_mode": True/"kmi_symbol_list_strict_mode": False/
- s/"trim_nonlisted_kmi": True/"trim_nonlisted_kmi": False/
- }
- /"kernel_aarch64_16k": {/,/},/ {
- s/"kmi_symbol_list_strict_mode": True/"kmi_symbol_list_strict_mode": False/
- s/"trim_nonlisted_kmi": True/"trim_nonlisted_kmi": False/
- }
- ' BUILD.bazel
- fi
- cp "$KERNEL_PATCHES/samsung/min_kdp/min_kdp.c" drivers/min_kdp.c
- echo "obj-y += min_kdp.o" >> drivers/Makefile
- - 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=/ {
- /baseband_guard/! s/"\([^"]*\)"/"baseband_guard,\1"/
- }' "$DEFCONFIG"
- # if [ -d "$KERNEL_PATCHES/samsung/${{ inputs.branch }}/bbg" ]; then
- # echo "Directory exists, adding bbg in configLSM"
- # cp "$KERNEL_PATCHES/samsung/${{ inputs.branch }}/bbg/"* ./
- # # patch for adding bbg in configLSM for some devices
- # for p in *.patch; do
- # patch -p1 < "$p"
- # rm -f "$p"
- # done
- # else
- # echo "BBG already enabled"
- # fi
- # if grep -qxF $'\t\tconst char* symlink_target_link = inode->i_op->get_link(dentry, inode, NULL);' ./Baseband-guard/baseband_guard.c; then
- # echo "Applying BBG get_link fix"
- # patch -p1 --forward < "$KERNEL_PATCHES/experimental/bbg/bbg_fix_get_link.patch"
- # fi
- - 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 >> "$DEFCONFIG" <<EOF
- CONFIG_SYSVIPC=y
- CONFIG_DEVTMPFS=y
- CONFIG_PID_NS=y
- CONFIG_POSIX_MQUEUE=y
- EOF
-
- - name: Set Kernel Configuration Variables
- if: inputs.wksu == 'true'
- run: |
-
- echo "Initializing kernel configuration..."
- cat >> "$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
- else
- cat >> "$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: Force load module configs
- if: inputs.crc == 'true'
- run: |
- if [[ ${{ inputs.branch }} == SM-A546* || "${{ inputs.branch }}" == "SM-M146B-Oneui7-ADYJ2" ]]; then
- cat >> "$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
- EOF
- else
- echo "kernel_platform devices don't need these, so moving on"
- fi
- - name: Change Kernel Name and remove protected exports
- run: |
- cd "$COMMON"
- if [[ "${{ inputs.wksu }}" == "true" ]]; then
- #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
- fi
-
- #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: KSU33208-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
- elif [[ ${{ inputs.branch }} == SM-A546* || "${{ inputs.branch }}" == "SM-M146B-Oneui7-ADYJ2" ]]; then
- sudo apt update
- sudo apt-get install -y libyaml-dev
- LTO=thin ./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
- 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-A546B-Oneui7" || "${{ inputs.branch }}" == "SM-A546E-Oneui7" || "${{ inputs.branch }}" == "SM-M146B-Oneui7-ADYJ2" || "${{ inputs.branch }}" == "SM-A546E-Oneui8" || "${{ inputs.branch }}" == "SM-A546B-Oneui8" ]]; 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-S901E-Oneui8" || "${{ inputs.branch }}" == "SM-X800-Oneui8" ]]; then
- cp ./out/msm-waipio-waipio-gki/dist/Image "$ANYKERNEL3/Image"
- 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 Wild_KSU commit
- if [ -d "$CONFIG/Wild_KSU" ]; then
- cd "$CONFIG/Wild_KSU"
- WKSU_COMMIT=$(git rev-parse HEAD)
- WKSU_URL="https://github.com/WildKernels/Wild_KSU/commit/$WKSU_COMMIT"
- echo "- **Wild_KSU**: [$WKSU_COMMIT]($WKSU_URL)" >> "$GITHUB_WORKSPACE/build_summary.md"
- cd "$GITHUB_WORKSPACE"
- else
- echo "- **Wild_KSU**: 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
|