build.yml 37 KB

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