build.yml 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850
  1. name: Kernel Build Process
  2. permissions:
  3. contents: write
  4. actions: write
  5. on:
  6. workflow_call:
  7. inputs:
  8. android_version:
  9. required: true
  10. type: string
  11. kernel_version:
  12. required: true
  13. type: string
  14. sub_level:
  15. required: true
  16. type: string
  17. os_patch_level:
  18. required: true
  19. type: string
  20. jobs:
  21. build-gki:
  22. runs-on: ubuntu-latest
  23. strategy:
  24. fail-fast: false
  25. matrix:
  26. apply_bypass: ["normal", "bypass"]
  27. steps:
  28. - name: Check Initial Disk Space
  29. run: |
  30. echo "===== Initial Total Disk Space in GB ====="
  31. df -BG
  32. - name: Download Apache Arrow's util_free_space.sh
  33. run: |
  34. curl -L -o util_free_space.sh https://raw.githubusercontent.com/apache/arrow/main/ci/scripts/util_free_space.sh
  35. chmod +x util_free_space.sh
  36. ./util_free_space.sh
  37. - name: Check Disk Space After Cleanup
  38. run: |
  39. echo "===== Total Disk Space After Cleanup in GB ====="
  40. df -BG
  41. - name: Set CONFIG Environment Variable
  42. run: |
  43. # Set CONFIG dynamically based on inputs values
  44. CONFIG="${{ inputs.android_version }}-${{ inputs.kernel_version }}-${{ inputs.sub_level }}"
  45. # Set CONFIG as an environment variable for future steps
  46. echo "CONFIG=$CONFIG" >> $GITHUB_ENV
  47. - name: Setup Build Environment
  48. run: |
  49. AOSP_MIRROR=https://android.googlesource.com
  50. BRANCH=main-kernel-2025
  51. git clone $AOSP_MIRROR/kernel/prebuilts/build-tools -b $BRANCH --depth 1 kernel-build-tools &
  52. git clone $AOSP_MIRROR/platform/system/tools/mkbootimg -b $BRANCH --depth 1 mkbootimg &
  53. wait
  54. echo "AVBTOOL=$GITHUB_WORKSPACE/kernel-build-tools/linux-x86/bin/avbtool" >> $GITHUB_ENV
  55. echo "MKBOOTIMG=$GITHUB_WORKSPACE/mkbootimg/mkbootimg.py" >> $GITHUB_ENV
  56. echo "UNPACK_BOOTIMG=$GITHUB_WORKSPACE/mkbootimg/unpack_bootimg.py" >> $GITHUB_ENV
  57. echo "BOOT_SIGN_KEY_PATH=$GITHUB_WORKSPACE/kernel-build-tools/linux-x86/share/avb/testkey_rsa2048.pem" >> $GITHUB_ENV
  58. echo "PATH=$GITHUB_WORKSPACE/kernel-build-tools/linux-x86/bin:$PATH" >> $GITHUB_ENV
  59. mkdir -p ./git-repo
  60. curl https://storage.googleapis.com/git-repo-downloads/repo > ./git-repo/repo
  61. chmod a+rx ./git-repo/repo
  62. echo "REPO=$GITHUB_WORKSPACE/./git-repo/repo" >> $GITHUB_ENV
  63. - name: Set boot sign key
  64. env:
  65. BOOT_SIGN_KEY: ${{ secrets.BOOT_SIGN_KEY }}
  66. run: |
  67. if [ ! -z "$BOOT_SIGN_KEY" ]; then
  68. echo "$BOOT_SIGN_KEY" > ./kernel-build-tools/linux-x86/share/avb/testkey_rsa2048.pem
  69. fi
  70. - name: Clone AnyKernel3 and Other Dependencies
  71. run: |
  72. ANYKERNEL_BRANCH="gki-2.0"
  73. SUSFS_BRANCH="gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}"
  74. git clone https://github.com/WildKernels/AnyKernel3.git -b "$ANYKERNEL_BRANCH"
  75. git clone https://github.com/WildKernels/kernel_patches.git
  76. git clone https://gitlab.com/simonpunk/susfs4ksu.git -b "$SUSFS_BRANCH"
  77. # Checkout specific commits for SUSFS v1.5.12
  78. #cd susfs4ksu
  79. #case "${{ inputs.android_version }}-${{ inputs.kernel_version }}" in
  80. # "android12-5.10")
  81. # git checkout ed19454a4b5905e6718c9a22fad769b906837931
  82. # ;;
  83. # "android13-5.10")
  84. # git checkout 8919927b63d95e62d33842452b9a60546187fb7b
  85. # ;;
  86. # "android13-5.15")
  87. # git checkout 700b9316b5a1cab174401b57f4198782a17154fb
  88. # ;;
  89. # "android14-5.15")
  90. # git checkout e1b1bba04b3cada700b8fd5bda4cfd4c59de07a2
  91. # ;;
  92. # "android14-6.1")
  93. # git checkout f16560ce8263fbfa9b2f259e9531f72d6fda4e3f
  94. # ;;
  95. # "android15-6.6")
  96. # git checkout c49b1dab205bbc4ef20b120e84c5b7530355961d
  97. # ;;
  98. #esac
  99. #cd ..
  100. - name: Initialize and Sync Kernel Source
  101. run: |
  102. mkdir -p "$CONFIG"
  103. cd "$CONFIG"
  104. FORMATTED_BRANCH="${{ inputs.android_version }}-${{ inputs.kernel_version }}-${{ inputs.os_patch_level }}"
  105. $REPO init --depth=1 --u https://android.googlesource.com/kernel/manifest -b common-${FORMATTED_BRANCH} --repo-rev=v2.16
  106. REMOTE_BRANCH=$(git ls-remote https://android.googlesource.com/kernel/common ${FORMATTED_BRANCH})
  107. DEFAULT_MANIFEST_PATH=.repo/manifests/default.xml
  108. if grep -q deprecated <<< $REMOTE_BRANCH; then
  109. sed -i "s/\"${FORMATTED_BRANCH}\"/\"deprecated\/${FORMATTED_BRANCH}\"/g" $DEFAULT_MANIFEST_PATH
  110. fi
  111. $REPO --trace sync -c -j$(nproc --all) --no-tags --fail-fast
  112. - name: Check Directory Space Usage
  113. run: |
  114. echo "===== Total Disk Space After Kernel Download in GB ====="
  115. df -BG
  116. echo "===== Directory Space Usage in GB ====="
  117. du -BG -d 1 | sort -nr
  118. echo "===== $CONFIG Directory Space Usage in GB ====="
  119. cd "$CONFIG"
  120. du -BG -d 2 | sort -nr
  121. - name: Extract Actual Sublevel for LTS Builds
  122. if: inputs.sub_level == 'X'
  123. run: |
  124. cd "$CONFIG/common"
  125. if [ -f "Makefile" ]; then
  126. ACTUAL_SUBLEVEL=$(grep '^SUBLEVEL = ' Makefile | awk '{print $3}')
  127. if [ -n "$ACTUAL_SUBLEVEL" ]; then
  128. OLD_CONFIG="$CONFIG"
  129. NEW_CONFIG="${{ inputs.android_version }}-${{ inputs.kernel_version }}-$ACTUAL_SUBLEVEL"
  130. echo "CONFIG=$NEW_CONFIG" >> $GITHUB_ENV
  131. echo "ACTUAL_SUBLEVEL=$ACTUAL_SUBLEVEL" >> $GITHUB_ENV
  132. cd ../..
  133. if [ -d "$OLD_CONFIG" ]; then
  134. echo "Renaming directory from $OLD_CONFIG to $NEW_CONFIG"
  135. mv "$OLD_CONFIG" "$NEW_CONFIG"
  136. if [ ! -d "$NEW_CONFIG" ]; then
  137. echo "Error: Directory rename failed, $NEW_CONFIG does not exist"
  138. exit 1
  139. fi
  140. echo "Directory successfully renamed to $NEW_CONFIG"
  141. else
  142. echo "Error: Source directory $OLD_CONFIG does not exist"
  143. exit 1
  144. fi
  145. fi
  146. fi
  147. - name: Apply glibc 2.38 Compatibility Fix
  148. run: |
  149. # Use ACTUAL_SUBLEVEL for LTS builds, otherwise use the input sub_level
  150. SUBLEVEL_TO_CHECK="${ACTUAL_SUBLEVEL:-${{ inputs.sub_level }}}"
  151. if ([[ "${{ inputs.android_version }}" == "android13" ]] && [[ "${{ inputs.kernel_version }}" == "5.10" ]] && (( $SUBLEVEL_TO_CHECK <= 186 ))) ||
  152. ([[ "${{ inputs.android_version }}" == "android13" ]] && [[ "${{ inputs.kernel_version }}" == "5.15" ]] && (( $SUBLEVEL_TO_CHECK <= 119 ))) ||
  153. ([[ "${{ inputs.android_version }}" == "android14" ]] && [[ "${{ inputs.kernel_version }}" == "5.15" ]] && (( $SUBLEVEL_TO_CHECK <= 110 ))) ||
  154. ([[ "${{ inputs.android_version }}" == "android14" ]] && [[ "${{ inputs.kernel_version }}" == "6.1" ]] && (( $SUBLEVEL_TO_CHECK <= 43 ))); then
  155. GLIBC_VERSION=$(ldd --version 2>/dev/null | head -n 1 | awk '{print $NF}')
  156. if [ "$(printf '%s\n' "2.38" "$GLIBC_VERSION" | sort -V | head -n1)" = "2.38" ]; then
  157. cd $CONFIG/common/
  158. sed -i '/\$(Q)\$(MAKE) -C \$(SUBCMD_SRC) OUTPUT=\$(abspath \$(dir \$@))\/ \$(abspath \$@)/s//$(Q)$(MAKE) -C $(SUBCMD_SRC) EXTRA_CFLAGS="$(CFLAGS)" OUTPUT=$(abspath $(dir $@))\/ $(abspath $@)/' tools/bpf/resolve_btfids/Makefile 2>/dev/null || true
  159. if ([[ "${{ inputs.android_version }}" == "android13" ]] && [[ "${{ inputs.kernel_version }}" == "5.10" ]] && (( $SUBLEVEL_TO_CHECK <= 186 ))) ||
  160. ([[ "${{ inputs.android_version }}" == "android13" ]] && [[ "${{ inputs.kernel_version }}" == "5.15" ]] && (( $SUBLEVEL_TO_CHECK <= 119 ))) ||
  161. ([[ "${{ inputs.android_version }}" == "android14" ]] && [[ "${{ inputs.kernel_version }}" == "5.15" ]] && (( $SUBLEVEL_TO_CHECK <= 110 ))); then
  162. sed -i '/char \*buf = NULL;/a int i;' tools/lib/subcmd/parse-options.c 2>/dev/null || true
  163. sed -i 's/for (int i = 0; subcommands\[i\]; i++) {/for (i = 0; subcommands[i]; i++) {/' tools/lib/subcmd/parse-options.c 2>/dev/null || true
  164. sed -i '/if (subcommands) {/a int i;' tools/lib/subcmd/parse-options.c 2>/dev/null || true
  165. sed -i 's/for (int i = 0; subcommands\[i\]; i++)/for (i = 0; subcommands[i]; i++)/' tools/lib/subcmd/parse-options.c 2>/dev/null || true
  166. fi
  167. fi
  168. fi
  169. - name: Fix Less Then 6.6.50 Builds
  170. if: inputs.android_version == 'android15' && inputs.kernel_version == '6.6'
  171. run: |
  172. cd "$CONFIG/common"
  173. if ! grep -qxF '#include <trace/hooks/fs.h>' ./fs/namespace.c; then
  174. sed -i '/#include <trace\/hooks\/blk.h>/a #include <trace\/hooks\/fs.h>' ./fs/namespace.c
  175. fi
  176. - name: Apply ptrace patch for older kernels
  177. if: fromJSON(inputs.kernel_version) < 5.16
  178. run: |
  179. cd "$CONFIG/common"
  180. patch -p1 -F 3 < "../../kernel_patches/gki_ptrace.patch"
  181. - name: Add KernelSU
  182. run: |
  183. cd "$CONFIG"
  184. curl -LSs "https://raw.githubusercontent.com/WildKernels/Wild_KSU/wild/kernel/setup.sh" | bash -s wild
  185. - name: Getting KernelSU Version
  186. run: |
  187. cd "$CONFIG/Wild_KSU/kernel"
  188. BASE_VERSION=10200
  189. COMMIT_COUNT=$(/usr/bin/git rev-list --count HEAD)
  190. KSU_VERSION=$(expr $COMMIT_COUNT "+" $BASE_VERSION)
  191. echo "KSUVER=$KSU_VERSION" >> $GITHUB_ENV
  192. - name: Apply SUSFS Patches for KernelSU Variants
  193. run: |
  194. cd "$CONFIG"
  195. # Apply compatibility fixes
  196. SUSFS_VERSION="1.5.12"
  197. cp ../susfs4ksu/kernel_patches/fs/* ./common/fs/
  198. cp ../susfs4ksu/kernel_patches/include/linux/* ./common/include/linux/
  199. # Apply core SUSFS patches
  200. cp ../susfs4ksu/kernel_patches/50_add_susfs_in_gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}.patch ./common/
  201. cd common
  202. patch -p1 < 50_add_susfs_in_gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}.patch || true
  203. # Apply additional SUSFS patches for Android 13 5.15 compatibility
  204. if [[ "${{ inputs.android_version }}" == "android13" ]] && [[ "${{ inputs.kernel_version }}" == "5.15" ]] && (( ${{ inputs.sub_level }} <= 41 )); then
  205. cp ../../kernel_patches/wild/susfs_fix_patches/v${SUSFS_VERSION}/fix_fdinfo.c.patch ./
  206. patch -p1 < fix_fdinfo.c.patch || true
  207. cp ../../kernel_patches/wild/susfs_fix_patches/v${SUSFS_VERSION}/fix_namespace.c.patch ./
  208. patch -p1 < fix_namespace.c.patch || true
  209. cp ../../kernel_patches/wild/susfs_fix_patches/v${SUSFS_VERSION}/fix_open.c.patch ./
  210. patch -p1 < fix_open.c.patch || true
  211. sed -i 's/i_uid_into_mnt(i_user_ns(inode), inode)/i_uid_into_mnt(inode->i_sb->s_user_ns, inode)/g' fs/susfs.c
  212. fi
  213. # Use ACTUAL_SUBLEVEL for LTS or actual kernel sublevel if available
  214. SUBLEVEL_TO_CHECK="${ACTUAL_SUBLEVEL:-${{ inputs.sub_level }}}"
  215. if ( [[ "${{ inputs.android_version }}" == "android14" ]] && [[ "${{ inputs.kernel_version }}" == "6.1" ]] && (( SUBLEVEL_TO_CHECK >= 145 )); } ) \
  216. || ( [[ "${{ inputs.android_version }}" == "android15" ]] && [[ "${{ inputs.kernel_version }}" == "6.6" ]] && (( SUBLEVEL_TO_CHECK >= 98 )); } ); then
  217. cp ../../kernel_patches/wild/susfs_fix_patches/v${SUSFS_VERSION}/fix_base.c.patch ./
  218. patch -p1 < 1_fix_base.c.patch || true
  219. fi
  220. if ( [[ "${{ inputs.android_version }}" == "android14" ]] && [[ "${{ inputs.kernel_version }}" == "6.1" ]] && (( SUBLEVEL_TO_CHECK >= 145 )); } ) \
  221. || ( [[ "${{ inputs.android_version }}" == "android15" ]] && [[ "${{ inputs.kernel_version }}" == "6.6" ]] (( SUBLEVEL_TO_CHECK >= 98 )); } ); then
  222. cp ../../kernel_patches/wild/susfs_fix_patches/v${SUSFS_VERSION}/fix_base.c.patch ./
  223. patch -p1 < 2_fix_base.c.patch || true
  224. fi
  225. if ( [[ "${{ inputs.android_version }}" == "android15" ]] && [[ "${{ inputs.kernel_version }}" == "6.6" ]] && (( SUBLEVEL_TO_CHECK <= 58 )); } ); then
  226. cp ../../kernel_patches/wild/susfs_fix_patches/v${SUSFS_VERSION}/fix_task_mmu.c.patch ./
  227. patch -p1 < fix_task_mmu.c.patch || true
  228. fi
  229. # Apply KSU integration patches
  230. cd ../Wild_KSU
  231. cp ../../susfs4ksu/kernel_patches/KernelSU/10_enable_susfs_for_ksu.patch .
  232. patch -p1 < 10_enable_susfs_for_ksu.patch || true
  233. cp ../../kernel_patches/wild/susfs_fix_patches/v${SUSFS_VERSION}/fix_core_hook.c.patch ./
  234. patch -p1 < fix_core_hook.c.patch
  235. cp ../../kernel_patches/wild/susfs_fix_patches/v${SUSFS_VERSION}/fix_sucompat.c.patch ./
  236. patch -p1 < fix_sucompat.c.patch
  237. cp ../../kernel_patches/wild/susfs_fix_patches/v${SUSFS_VERSION}/fix_kernel_compat.c.patch ./
  238. patch -p1 < fix_kernel_compat.c.patch
  239. - name: Apply Hooks Patches
  240. run: |
  241. cd "$CONFIG/common"
  242. cp ../../kernel_patches/wild/hooks/scope_min_manual_hooks_v1.4.patch ./
  243. patch -p1 -F 3 < scope_min_manual_hooks_v1.4.patch
  244. - name: Scan and collect patch rejects
  245. if: ${{ always() }}
  246. run: |
  247. set -e
  248. CONFIG_DIR="$CONFIG"
  249. REJECTS_DIR="$GITHUB_WORKSPACE/patch-rejects"
  250. mkdir -p "$REJECTS_DIR"
  251. # Find all .rej files under the configuration directory
  252. mapfile -t REJS < <(find "$CONFIG_DIR" -type f -name '*.rej')
  253. REJ_COUNT=${#REJS[@]}
  254. echo "Found $REJ_COUNT .rej files under $CONFIG_DIR"
  255. echo "REJ_COUNT=$REJ_COUNT" >> $GITHUB_ENV
  256. if [ "$REJ_COUNT" -gt 0 ]; then
  257. for REJ in "${REJS[@]}"; do
  258. # Relative path from $CONFIG
  259. REL="${REJ#"$CONFIG_DIR"/}"
  260. DEST="$REJECTS_DIR/$REL"
  261. mkdir -p "$(dirname "$DEST")"
  262. cp "$REJ" "$DEST"
  263. # Copy the associated original file alongside the .rej
  264. ORIG="${REJ%.rej}"
  265. if [ -f "$ORIG" ]; then
  266. ORIG_DEST="$REJECTS_DIR/${REL%.rej}"
  267. mkdir -p "$(dirname "$ORIG_DEST")"
  268. cp "$ORIG" "$ORIG_DEST"
  269. fi
  270. echo "$REL" >> "$REJECTS_DIR/index.txt"
  271. done
  272. fi
  273. - name: Add BBG
  274. run: |
  275. cd "$CONFIG"
  276. echo "Adding BBG..."
  277. wget -O- https://github.com/vc-teahouse/Baseband-guard/raw/main/setup.sh | bash
  278. echo "CONFIG_BBG=y" >> common/arch/arm64/configs/gki_defconfig
  279. sed -i '/^config LSM$/,/^help$/{ /^[[:space:]]*default/ { /baseband_guard/! s/lockdown/lockdown,baseband_guard/ } }' common/security/Kconfig
  280. - name: Apply Module Check Bypass
  281. if: ${{ matrix.apply_bypass == 'bypass' }}
  282. run: |
  283. if [[ "${{ inputs.kernel_version }}" == "6.1" || "${{ inputs.kernel_version }}" == "6.6" ]]; then
  284. cd "$CONFIG/common/kernel/module"
  285. sed -i '/bad_version:/{:a;n;/return 0;/{s/return 0;/return 1;/;b};ba}' version.c
  286. else
  287. cd "$CONFIG/common/kernel"
  288. sed -i '/bad_version:/{:a;n;/return 0;/{s/return 0;/return 1;/;b};ba}' module.c
  289. fi
  290. - name: Fix WiFi and Bluetooth on Samsung 6.6 GKI devices
  291. if: ${{ ( inputs.kernel_version == '6.6' ) }}
  292. run: |
  293. SYMBOL_LIST=$CONFIG/common/android/abi_gki_aarch64_galaxy
  294. echo "kdp_set_cred_non_rcu" >> $SYMBOL_LIST
  295. echo "kdp_usecount_dec_and_test" >> $SYMBOL_LIST
  296. echo "kdp_usecount_inc" >> $SYMBOL_LIST
  297. cd $CONFIG/common
  298. PATCH="../../kernel_patches/samsung/min_kdp/add-min_kdp-symbols.patch"
  299. if patch -p1 --dry-run < $PATCH; then
  300. patch -p1 --no-backup-if-mismatch < $PATCH
  301. fi
  302. cd drivers
  303. cp "../../../kernel_patches/samsung/min_kdp/min_kdp.c" min_kdp.c
  304. echo "obj-y += min_kdp.o" >> Makefile
  305. - name: Set Kernel Configuration Variables
  306. run: |
  307. cd "$CONFIG"
  308. echo "Initializing kernel configuration..."
  309. echo "DEFCONFIG=./common/arch/arm64/configs/gki_defconfig" >> $GITHUB_ENV
  310. # Remove check_defconfig
  311. sed -i 's/check_defconfig//' ./common/build.config.gki
  312. - name: Configure KernelSU Core
  313. run: |
  314. cd "$CONFIG"
  315. # KernelSU Configuration
  316. echo "# KernelSU Configuration" >> "${{ env.DEFCONFIG }}"
  317. echo "CONFIG_KSU=y" >> "${{ env.DEFCONFIG }}"
  318. echo "CONFIG_KSU_KPROBES_HOOK=n" >> "${{ env.DEFCONFIG }}"
  319. - name: Configure Mountify Support
  320. run: |
  321. cd "$CONFIG"
  322. # Mountify Support
  323. echo "# Mountify Support" >> "${{ env.DEFCONFIG }}"
  324. echo "CONFIG_TMPFS_XATTR=y" >> "${{ env.DEFCONFIG }}"
  325. echo "CONFIG_TMPFS_POSIX_ACL=y" >> "${{ env.DEFCONFIG }}"
  326. - name: Configure Networking
  327. run: |
  328. cd "$CONFIG"
  329. # Networking Configuration
  330. echo "# Networking Configuration" >> "${{ env.DEFCONFIG }}"
  331. echo "CONFIG_IP_NF_TARGET_TTL=y" >> "${{ env.DEFCONFIG }}"
  332. echo "CONFIG_IP6_NF_TARGET_HL=y" >> "${{ env.DEFCONFIG }}"
  333. echo "CONFIG_IP6_NF_MATCH_HL=y" >> "${{ env.DEFCONFIG }}"
  334. - name: Configure TCP Congestion Control
  335. run: |
  336. cd "$CONFIG"
  337. # BBR TCP Congestion Control
  338. echo "# BBR TCP Congestion Control" >> "${{ env.DEFCONFIG }}"
  339. echo "CONFIG_TCP_CONG_ADVANCED=y" >> "${{ env.DEFCONFIG }}"
  340. echo "CONFIG_TCP_CONG_BBR=y" >> "${{ env.DEFCONFIG }}"
  341. echo "CONFIG_NET_SCH_FQ=y" >> "${{ env.DEFCONFIG }}"
  342. echo "CONFIG_TCP_CONG_BIC=n" >> "${{ env.DEFCONFIG }}"
  343. echo "CONFIG_TCP_CONG_WESTWOOD=n" >> "${{ env.DEFCONFIG }}"
  344. echo "CONFIG_TCP_CONG_HTCP=n" >> "${{ env.DEFCONFIG }}"
  345. - name: Configure IPSet Support
  346. run: |
  347. cd "$CONFIG"
  348. # IPSet support
  349. echo "# IPSet Support" >> "${{ env.DEFCONFIG }}"
  350. echo "CONFIG_IP_SET=y" >> "${{ env.DEFCONFIG }}"
  351. echo "CONFIG_IP_SET_MAX=65534" >> "${{ env.DEFCONFIG }}"
  352. echo "CONFIG_IP_SET_BITMAP_IP=y" >> "${{ env.DEFCONFIG }}"
  353. echo "CONFIG_IP_SET_BITMAP_IPMAC=y" >> "${{ env.DEFCONFIG }}"
  354. echo "CONFIG_IP_SET_BITMAP_PORT=y" >> "${{ env.DEFCONFIG }}"
  355. echo "CONFIG_IP_SET_HASH_IP=y" >> "${{ env.DEFCONFIG }}"
  356. echo "CONFIG_IP_SET_HASH_IPMARK=y" >> "${{ env.DEFCONFIG }}"
  357. echo "CONFIG_IP_SET_HASH_IPPORT=y" >> "${{ env.DEFCONFIG }}"
  358. echo "CONFIG_IP_SET_HASH_IPPORTIP=y" >> "${{ env.DEFCONFIG }}"
  359. echo "CONFIG_IP_SET_HASH_IPPORTNET=y" >> "${{ env.DEFCONFIG }}"
  360. echo "CONFIG_IP_SET_HASH_IPMAC=y" >> "${{ env.DEFCONFIG }}"
  361. echo "CONFIG_IP_SET_HASH_MAC=y" >> "${{ env.DEFCONFIG }}"
  362. echo "CONFIG_IP_SET_HASH_NETPORTNET=y" >> "${{ env.DEFCONFIG }}"
  363. echo "CONFIG_IP_SET_HASH_NET=y" >> "${{ env.DEFCONFIG }}"
  364. echo "CONFIG_IP_SET_HASH_NETNET=y" >> "${{ env.DEFCONFIG }}"
  365. echo "CONFIG_IP_SET_HASH_NETPORT=y" >> "${{ env.DEFCONFIG }}"
  366. echo "CONFIG_IP_SET_HASH_NETIFACE=y" >> "${{ env.DEFCONFIG }}"
  367. echo "CONFIG_IP_SET_LIST_SET=y" >> "${{ env.DEFCONFIG }}"
  368. - name: Configure SUSFS
  369. run: |
  370. cd "$CONFIG"
  371. # SUSFS Configuration
  372. echo "# SUSFS Configuration" >> "${{ env.DEFCONFIG }}"
  373. echo "CONFIG_KSU_SUSFS=y" >> "${{ env.DEFCONFIG }}"
  374. echo "#CONFIG_KSU_SUSFS_HAS_MAGIC_MOUNT=y" >> "${{ env.DEFCONFIG }}"
  375. echo "CONFIG_KSU_SUSFS_SUS_PATH=y" >> "${{ env.DEFCONFIG }}"
  376. echo "CONFIG_KSU_SUSFS_SUS_MOUNT=y" >> "${{ env.DEFCONFIG }}"
  377. echo "CONFIG_KSU_SUSFS_TRY_UMOUNT=y" >> "${{ env.DEFCONFIG }}"
  378. echo "CONFIG_KSU_SUSFS_AUTO_ADD_SUS_KSU_DEFAULT_MOUNT=y" >> "${{ env.DEFCONFIG }}"
  379. echo "CONFIG_KSU_SUSFS_AUTO_ADD_SUS_BIND_MOUNT=y" >> "${{ env.DEFCONFIG }}"
  380. echo "CONFIG_KSU_SUSFS_AUTO_ADD_TRY_UMOUNT_FOR_BIND_MOUNT=y" >> "${{ env.DEFCONFIG }}"
  381. echo "CONFIG_KSU_SUSFS_SUS_KSTAT=y" >> "${{ env.DEFCONFIG }}"
  382. echo "CONFIG_KSU_SUSFS_SUS_OVERLAYFS=n" >> "${{ env.DEFCONFIG }}"
  383. echo "CONFIG_KSU_SUSFS_SPOOF_UNAME=y" >> "${{ env.DEFCONFIG }}"
  384. echo "CONFIG_KSU_SUSFS_SPOOF_CMDLINE_OR_BOOTCONFIG=y" >> "${{ env.DEFCONFIG }}"
  385. echo "CONFIG_KSU_SUSFS_OPEN_REDIRECT=y" >> "${{ env.DEFCONFIG }}"
  386. echo "CONFIG_KSU_SUSFS_ENABLE_LOG=y" >> "${{ env.DEFCONFIG }}"
  387. echo "CONFIG_KSU_SUSFS_HIDE_KSU_SUSFS_SYMBOLS=y" >> "${{ env.DEFCONFIG }}"
  388. echo "CONFIG_KSU_SUSFS_SUS_SU=n" >> "${{ env.DEFCONFIG }}"
  389. - name: Configure Sound
  390. if: false
  391. run: |
  392. cd "$CONFIG"
  393. # Sound Configuration
  394. echo "# Sound Configuration" >> "${{ env.DEFCONFIG }}"
  395. echo "CONFIG_SND=y" >> "${{ env.DEFCONFIG }}"
  396. echo "CONFIG_SND_DRIVERS=y" >> "${{ env.DEFCONFIG }}"
  397. echo "CONFIG_SND_PCM=y" >> "${{ env.DEFCONFIG }}"
  398. echo "CONFIG_SND_TIMER=y" >> "${{ env.DEFCONFIG }}"
  399. echo "CONFIG_SND_DYNAMIC_MINORS=y" >> "${{ env.DEFCONFIG }}"
  400. echo "CONFIG_SND_PROC_FS=y" >> "${{ env.DEFCONFIG }}"
  401. echo "CONFIG_SND_ALOOP=m" >> "${{ env.DEFCONFIG }}"
  402. # Add snd-aloop.ko to modules list
  403. if [ -f "build/build.sh" ]; then
  404. echo "sound/drivers/snd-aloop.ko" >> common/android/gki_aarch64_modules
  405. else
  406. sed -i '/_COMMON_GKI_MODULES_LIST = \\[/,/\\]/ s/\\]/ "sound\/drivers\/snd-aloop.ko",\\n&/' common/modules.bzl
  407. fi
  408. # Add symbols to abi_gki_aarch64
  409. SYMBOL_LIST=common/android/abi_gki_aarch64
  410. cat Wild_KSU/kernel/export_symbol.txt | awk '{sub("[ \t]+","");print " "$0}' >> $SYMBOL_LIST
  411. - name: Configure Build Optimization
  412. run: |
  413. cd "$CONFIG"
  414. # Build Optimization Configuration
  415. echo "# Build Optimization Configuration" >> "${{ env.DEFCONFIG }}"
  416. echo "CONFIG_LTO_CLANG_THIN=y" >> "${{ env.DEFCONFIG }}"
  417. echo "CONFIG_LTO_CLANG=y" >> "${{ env.DEFCONFIG }}"
  418. echo "CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y" >> "${{ env.DEFCONFIG }}"
  419. echo "CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3=n" >> "${{ env.DEFCONFIG }}"
  420. echo "CONFIG_OPTIMIZE_INLINING=y" >> "${{ env.DEFCONFIG }}"
  421. - name: Change Kernel Name
  422. run: |
  423. cd "$CONFIG"
  424. #Add Wild to Kernel Version
  425. sed -i '$s|echo "\$res"|echo "\$res-Wild"|' ./common/scripts/setlocalversion
  426. #Set Kernel Timestamp
  427. 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
  428. if [ -f "build/build.sh" ]; then
  429. #Remove Dirty Flag
  430. sed -i 's/-dirty//' ./common/scripts/setlocalversion
  431. else
  432. #Remove Dirty Flag
  433. sed -i "/stable_scmversion_cmd/s/-maybe-dirty//g" ./build/kernel/kleaf/impl/stamp.bzl
  434. #Remove Abi Exports and Error
  435. rm -rf ./common/android/abi_gki_protected_exports_*
  436. perl -pi -e 's/^\s*"protected_exports_list"\s*:\s*"android\/abi_gki_protected_exports_aarch64",\s*$//;' ./common/BUILD.bazel
  437. fi
  438. - name: Set file name
  439. run: |
  440. # Set artifact name base for consistent naming
  441. # Prepare sublevel for naming
  442. SUBLEVEL_FOR_NAME="${{ inputs.sub_level }}"
  443. if [ -n "$ACTUAL_SUBLEVEL" ]; then
  444. SUBLEVEL_FOR_NAME="$ACTUAL_SUBLEVEL"
  445. fi
  446. # Set artifact name base for consistent naming
  447. ARTIFACT_BASE="${{ inputs.android_version }}-${{ inputs.kernel_version }}.${SUBLEVEL_FOR_NAME}-${{ inputs.os_patch_level }}-${{ matrix.apply_bypass == 'bypass' && 'Bypass' || 'Normal' }}"
  448. echo "ARTIFACT_BASE=$ARTIFACT_BASE" >> $GITHUB_ENV
  449. echo "FILE_NAME=$ARTIFACT_BASE" >> $GITHUB_ENV
  450. - name: Build
  451. run : |
  452. set -e
  453. set -x
  454. cd "$CONFIG"
  455. echo "Building the kernel..."
  456. if [ -f "build/build.sh" ]; then
  457. LTO=thin BUILD_CONFIG=common/build.config.gki.aarch64 build/build.sh || exit 1
  458. else
  459. tools/bazel build --config=fast --lto=thin //common:kernel_aarch64_dist || exit 1
  460. fi
  461. - name: Prepare AnyKernel3
  462. run: |
  463. # Copy Image from normal build locations
  464. if [ -f "./$CONFIG/out/${{ inputs.android_version }}-${{ inputs.kernel_version }}/dist/Image" ]; then
  465. cp ./$CONFIG/out/${{ inputs.android_version }}-${{ inputs.kernel_version }}/dist/Image AnyKernel3/Image
  466. elif [ -f "./$CONFIG/bazel-bin/common/kernel_aarch64/Image" ]; then
  467. cp ./$CONFIG/bazel-bin/common/kernel_aarch64/Image AnyKernel3/Image
  468. else
  469. echo "Error: Image file not found in any expected location"
  470. exit 1
  471. fi
  472. - name: Search for Kernel Modules
  473. run: |
  474. echo "Searching for kernel modules (.ko files)..."
  475. # Function to scan for modules (search only)
  476. scan_modules() {
  477. local search_dir="$1"
  478. local module_count=0
  479. if [ -d "$search_dir" ]; then
  480. echo "Scanning directory: $search_dir"
  481. # Find all .ko files and report their locations
  482. while IFS= read -r -d '' module_file; do
  483. if [ -f "$module_file" ]; then
  484. module_name=$(basename "$module_file")
  485. echo "Found module: $module_name in $(dirname "$module_file")"
  486. ((module_count++))
  487. fi
  488. done < <(find "$search_dir" -name "*.ko" -type f -print0 2>/dev/null)
  489. fi
  490. return $module_count
  491. }
  492. # Scan common build output directories
  493. total_modules=0
  494. # Scan bazel-bin directory
  495. if scan_modules "./$CONFIG/bazel-bin"; then
  496. total_modules=$((total_modules + $?))
  497. fi
  498. # Scan out directory
  499. if scan_modules "./$CONFIG/out"; then
  500. total_modules=$((total_modules + $?))
  501. fi
  502. # Scan dist directory specifically
  503. if scan_modules "./$CONFIG/out/${{ inputs.android_version }}-${{ inputs.kernel_version }}/dist"; then
  504. total_modules=$((total_modules + $?))
  505. fi
  506. # Look for snd-aloop.ko specifically
  507. echo "Searching specifically for snd-aloop.ko..."
  508. snd_aloop_found=$(find ./$CONFIG -name "snd-aloop.ko" -type f 2>/dev/null | head -1)
  509. if [ -n "$snd_aloop_found" ]; then
  510. echo "Found snd-aloop.ko at: $snd_aloop_found"
  511. else
  512. echo "snd-aloop.ko not found"
  513. fi
  514. echo "Total kernel modules found: $total_modules"
  515. - name: Create Bootimgs Folder and Copy Images for Android 12/13
  516. if: ${{ inputs.android_version == 'android12' || inputs.android_version == 'android13' }}
  517. run: |
  518. mkdir bootimgs
  519. echo "Creating bootimgs folder and copying images..."
  520. cp ./$CONFIG/out/${{ inputs.android_version }}-${{ inputs.kernel_version }}/dist/Image ./bootimgs
  521. cp ./$CONFIG/out/${{ inputs.android_version }}-${{ inputs.kernel_version }}/dist/Image.lz4 ./bootimgs
  522. cp ./$CONFIG/out/${{ inputs.android_version }}-${{ inputs.kernel_version }}/dist/Image ./
  523. cp ./$CONFIG/out/${{ inputs.android_version }}-${{ inputs.kernel_version }}/dist/Image.lz4 ./
  524. # Create gzip of the Image file
  525. gzip -n -k -f -9 ./Image > ./Image.gz
  526. gzip -n -k -f -9 ./Image > ./bootimgs/Image.gz
  527. - name: Create Bootimgs Folder and Copy Images for Android 14/15
  528. if: ${{ inputs.android_version == 'android14' || inputs.android_version == 'android15' }}
  529. run: |
  530. mkdir bootimgs
  531. echo "Creating bootimgs folder and copying images..."
  532. cp ./$CONFIG/bazel-bin/common/kernel_aarch64/Image ./bootimgs
  533. cp ./$CONFIG/bazel-bin/common/kernel_aarch64/Image.lz4 ./bootimgs
  534. cp ./$CONFIG/bazel-bin/common/kernel_aarch64/Image ./
  535. cp ./$CONFIG/bazel-bin/common/kernel_aarch64/Image.lz4 ./
  536. # Create gzip of the Image file
  537. gzip -n -k -f -9 ./Image > ./Image.gz
  538. gzip -n -k -f -9 ./Image > ./bootimgs/Image.gz
  539. - name: Android 12 boot image build script
  540. if: ${{ inputs.android_version == 'android12' }}
  541. run: |
  542. echo "Changing to configuration directory: $CONFIG..."
  543. cd bootimgs
  544. GKI_URL=https://dl.google.com/android/gki/gki-certified-boot-android12-5.10-"${{ inputs.os_patch_level }}"_r1.zip
  545. FALLBACK_URL=https://dl.google.com/android/gki/gki-certified-boot-android12-5.10-2023-01_r1.zip
  546. # Check if the GKI URL is available
  547. echo "Checking if GKI kernel URL is reachable: $GKI_URL"
  548. status=$(curl -sL -w "%{http_code}" "$GKI_URL" -o /dev/null)
  549. if [ "$status" = "200" ]; then
  550. echo "[+] Downloading from GKI_URL"
  551. curl -Lo gki-kernel.zip "$GKI_URL"
  552. else
  553. echo "[+] $GKI_URL not found, using $FALLBACK_URL"
  554. curl -Lo gki-kernel.zip "$FALLBACK_URL"
  555. fi
  556. # Unzip the downloaded kernel and remove the zip
  557. echo "Unzipping the downloaded kernel..."
  558. unzip gki-kernel.zip && rm gki-kernel.zip
  559. echo "Unpacking boot.img..."
  560. FULL_PATH=$(pwd)/boot-5.10.img
  561. echo "Unpacking using: $FULL_PATH"
  562. echo "Running unpack_bootimg.py..."
  563. $UNPACK_BOOTIMG --boot_img="$FULL_PATH"
  564. echo "Building boot.img"
  565. $MKBOOTIMG --header_version 4 --kernel Image --output boot.img --ramdisk out/ramdisk --os_version 12.0.0 --os_patch_level "${{ inputs.os_patch_level }}"
  566. $AVBTOOL add_hash_footer --partition_name boot --partition_size $((64 * 1024 * 1024)) --image boot.img --algorithm SHA256_RSA2048 --key $BOOT_SIGN_KEY_PATH
  567. cp ./boot.img ../${{ env.FILE_NAME }}-boot.img
  568. echo "Building boot-gz.img"
  569. $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 }}"
  570. $AVBTOOL add_hash_footer --partition_name boot --partition_size $((64 * 1024 * 1024)) --image boot-gz.img --algorithm SHA256_RSA2048 --key $BOOT_SIGN_KEY_PATH
  571. cp ./boot-gz.img ../${{ env.FILE_NAME }}-boot-gz.img
  572. echo "Building boot-lz4.img"
  573. $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 }}"
  574. $AVBTOOL add_hash_footer --partition_name boot --partition_size $((64 * 1024 * 1024)) --image boot-lz4.img --algorithm SHA256_RSA2048 --key $BOOT_SIGN_KEY_PATH
  575. cp ./boot-lz4.img ../${{ env.FILE_NAME }}-boot-lz4.img
  576. - name: Android 13/14/15 boot image build script
  577. if: ${{ inputs.android_version == 'android13' || inputs.android_version == 'android14' || inputs.android_version == 'android15' }}
  578. run: |
  579. cd bootimgs
  580. echo "Building boot.img"
  581. $MKBOOTIMG --header_version 4 --kernel Image --output boot.img
  582. $AVBTOOL add_hash_footer --partition_name boot --partition_size $((64 * 1024 * 1024)) --image boot.img --algorithm SHA256_RSA2048 --key $BOOT_SIGN_KEY_PATH
  583. cp ./boot.img ../${{ env.FILE_NAME }}-boot.img
  584. echo "Building boot-gz.img"
  585. $MKBOOTIMG --header_version 4 --kernel Image.gz --output boot-gz.img
  586. $AVBTOOL add_hash_footer --partition_name boot --partition_size $((64 * 1024 * 1024)) --image boot-gz.img --algorithm SHA256_RSA2048 --key $BOOT_SIGN_KEY_PATH
  587. cp ./boot-gz.img ../${{ env.FILE_NAME }}-boot-gz.img
  588. echo "Building boot-lz4.img"
  589. $MKBOOTIMG --header_version 4 --kernel Image.lz4 --output boot-lz4.img
  590. $AVBTOOL add_hash_footer --partition_name boot --partition_size $((64 * 1024 * 1024)) --image boot-lz4.img --algorithm SHA256_RSA2048 --key $BOOT_SIGN_KEY_PATH
  591. cp ./boot-lz4.img ../${{ env.FILE_NAME }}-boot-lz4.img
  592. - name: Upload AnyKernel3 Artifacts
  593. uses: actions/upload-artifact@v4
  594. with:
  595. name: ${{ env.FILE_NAME }}-AnyKernel3
  596. path: |
  597. ./AnyKernel3/**
  598. compression-level: 9
  599. - name: Upload Boot Image
  600. uses: actions/upload-artifact@v4
  601. with:
  602. name: ${{ env.FILE_NAME }}-boot.img
  603. path: |
  604. *-boot.img
  605. compression-level: 9
  606. - name: Upload Boot Image (GZ)
  607. uses: actions/upload-artifact@v4
  608. with:
  609. name: ${{ env.FILE_NAME }}-boot-gz.img
  610. path: |
  611. *-boot-gz.img
  612. compression-level: 9
  613. - name: Upload Boot Image (LZ4)
  614. uses: actions/upload-artifact@v4
  615. with:
  616. name: ${{ env.FILE_NAME }}-boot-lz4.img
  617. path: |
  618. *-boot-lz4.img
  619. compression-level: 9
  620. - name: Upload Raw Image
  621. uses: actions/upload-artifact@v4
  622. with:
  623. name: ${{ env.FILE_NAME }}-Image
  624. path: |
  625. Image
  626. compression-level: 9
  627. - name: Upload Raw Image (GZ)
  628. uses: actions/upload-artifact@v4
  629. with:
  630. name: ${{ env.FILE_NAME }}-Image.gz
  631. path: |
  632. Image.gz
  633. compression-level: 9
  634. - name: Upload Raw Image (LZ4)
  635. uses: actions/upload-artifact@v4
  636. with:
  637. name: ${{ env.FILE_NAME }}-Image.lz4
  638. path: |
  639. Image.lz4
  640. compression-level: 9
  641. - name: Upload Build Diagnostics
  642. if: ${{ always() }}
  643. uses: actions/upload-artifact@v4
  644. with:
  645. name: ${{ env.FILE_NAME }}-Rejected-Patches
  646. path: patch-rejects
  647. compression-level: 9
  648. - name: Initialize Kernel Summary
  649. run: |
  650. echo "# Kernel Build Summary" >> $GITHUB_STEP_SUMMARY
  651. # Add build variant header
  652. echo "## ${{ env.FILE_NAME }}" >> $GITHUB_STEP_SUMMARY
  653. - name: Add Build Information
  654. run: |
  655. # Add build info
  656. echo "## Build Information" >> $GITHUB_STEP_SUMMARY
  657. echo "- **Android Version**: ${{ inputs.android_version }}" >> $GITHUB_STEP_SUMMARY
  658. echo "- **Kernel Version**: ${{ inputs.kernel_version }}.${{ inputs.sub_level }}" >> $GITHUB_STEP_SUMMARY
  659. echo "- **BBG**: Installed" >> $GITHUB_STEP_SUMMARY
  660. echo "- **Bypass Mode**: ${{ matrix.apply_bypass }}" >> $GITHUB_STEP_SUMMARY
  661. echo "" >> $GITHUB_STEP_SUMMARY
  662. - name: Add KSU Version
  663. run: |
  664. # Get Wild_KSU commit
  665. cd "$CONFIG/Wild_KSU"
  666. WKSU_COMMIT=$(git rev-parse HEAD)
  667. WKSU_URL="https://github.com/WildKernels/Wild_KSU/commit/$WKSU_COMMIT"
  668. echo "- **Wild_KSU**: [$WKSU_COMMIT]($WKSU_URL)" >> $GITHUB_STEP_SUMMARY
  669. - name: Add BBG Version
  670. run: |
  671. cd "$CONFIG/Baseband-guard"
  672. BBG_COMMIT=$(git rev-parse HEAD)
  673. BBG_URL="https://github.com/vc-teahouse/Baseband-guard/commit/$BBG_COMMIT"
  674. echo "- **Baseband-guard**: [$BBG_COMMIT]($BBG_URL)" >> $GITHUB_STEP_SUMMARY
  675. - name: Add SUSFS Version
  676. run: |
  677. # Get SUSFS4KSU commit
  678. cd "$GITHUB_WORKSPACE/susfs4ksu"
  679. SUSFS_COMMIT=$(git rev-parse HEAD)
  680. SUSFS_URL="https://gitlab.com/simonpunk/susfs4ksu/-/commit/$SUSFS_COMMIT"
  681. echo "- **SUSFS4KSU (v1.5.12)**: [$SUSFS_COMMIT]($SUSFS_URL)" >> $GITHUB_STEP_SUMMARY
  682. echo "" >> $GITHUB_STEP_SUMMARY
  683. - name: Add Build Artifacts
  684. if: ${{ always() }}
  685. run: |
  686. # Add artifact summary with presence verification
  687. echo "## Build Artifacts" >> $GITHUB_STEP_SUMMARY
  688. # Verify AnyKernel3 contents
  689. if [ -d "AnyKernel3" ] && [ "$(find AnyKernel3 -type f | wc -l)" -gt 0 ]; then
  690. AK3_STATUS="✅"
  691. else
  692. AK3_STATUS="❌"
  693. fi
  694. echo "- **AnyKernel3**: $AK3_STATUS ${{ env.FILE_NAME }}-AnyKernel3" >> $GITHUB_STEP_SUMMARY
  695. echo "### Boot Images" >> $GITHUB_STEP_SUMMARY
  696. for f in "${{ env.FILE_NAME }}-boot.img" "${{ env.FILE_NAME }}-boot-gz.img" "${{ env.FILE_NAME }}-boot-lz4.img"; do
  697. if [ -f "$f" ]; then status="✅"; else status="❌"; fi
  698. case "$f" in
  699. *boot.img) name="Boot Image (RAW)";;
  700. *boot-gz.img) name="Boot Image (GZ)";;
  701. *boot-lz4.img) name="Boot Image (LZ4)";;
  702. esac
  703. echo "- **$name**: $status $f" >> $GITHUB_STEP_SUMMARY
  704. done
  705. echo "### Kernel Images" >> $GITHUB_STEP_SUMMARY
  706. for f in "Image" "Image.gz" "Image.lz4"; do
  707. if [ -f "$f" ]; then status="✅"; else status="❌"; fi
  708. case "$f" in
  709. Image) name="Kernel Image (RAW)";;
  710. Image.gz) name="Kernel Image (GZ)";;
  711. Image.lz4) name="Kernel Image (LZ4)";;
  712. esac
  713. echo "- **$name**: $status $f" >> $GITHUB_STEP_SUMMARY
  714. done
  715. echo "### Diagnostics" >> $GITHUB_STEP_SUMMARY
  716. echo "- **Rejected Patches**: ${{ env.FILE_NAME }}-Rejected-Patches" >> $GITHUB_STEP_SUMMARY
  717. if [ -f patch-rejects/index.txt ]; then
  718. if [ -s patch-rejects/index.txt ]; then
  719. echo " Rejected files:" >> $GITHUB_STEP_SUMMARY
  720. while IFS= read -r line; do
  721. echo " - $line" >> $GITHUB_STEP_SUMMARY
  722. done < patch-rejects/index.txt
  723. else
  724. echo " Rejected file list is empty." >> $GITHUB_STEP_SUMMARY
  725. fi
  726. else
  727. echo " No rejected patches found." >> $GITHUB_STEP_SUMMARY
  728. fi