build.yml 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538
  1. name: Kernel Build Process
  2. permissions:
  3. contents: write
  4. actions: write
  5. on:
  6. workflow_call:
  7. inputs:
  8. branch:
  9. required: true
  10. type: string
  11. android_version:
  12. required: true
  13. type: string
  14. kernel_version:
  15. required: true
  16. type: string
  17. jobs:
  18. build-samsung-gki:
  19. name: "${{ inputs.branch }}-${{ inputs.kernel_version }}-${{ inputs.android_version }}"
  20. runs-on: ubuntu-latest
  21. strategy:
  22. fail-fast: false
  23. steps:
  24. - name: Free Disk Space
  25. if: true
  26. uses: endersonmenezes/free-disk-space@v3 # Use @main for latest, @v3 for stable
  27. with:
  28. remove_android: true
  29. remove_dotnet: true
  30. remove_haskell: true
  31. remove_tool_cache: true
  32. remove_swap: true
  33. remove_packages: "azure-cli google-cloud-cli microsoft-edge-stable google-chrome-stable firefox postgresql* temurin-* *llvm* mysql* dotnet-sdk-*"
  34. remove_packages_one_command: true
  35. 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"
  36. rm_cmd: "rmz" # Use 'rmz' for faster deletion (default: 'rm')
  37. rmz_version: "3.1.1" # Required when rm_cmd is 'rmz'
  38. testing: false
  39. - name: Set CONFIG Environment Variable
  40. run: |
  41. # Set CONFIG dynamically based on inputs values
  42. CONFIG="${{ inputs.branch }}-${{ inputs.android_version }}-${{ inputs.kernel_version }}"
  43. # Set CONFIG as an environment variable for future steps
  44. echo "CONFIG=$CONFIG" >> $GITHUB_ENV
  45. - name: Clone AnyKernel3 and Other Dependencies
  46. run: |
  47. ANYKERNEL_BRANCH="gki-2.0"
  48. SUSFS_BRANCH="gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}"
  49. git clone https://github.com/WildKernels/AnyKernel3.git -b "$ANYKERNEL_BRANCH"
  50. git clone https://github.com/WildKernels/kernel_patches.git
  51. git clone https://gitlab.com/simonpunk/susfs4ksu.git -b "$SUSFS_BRANCH"
  52. - name: Clone Kernel Source
  53. run: |
  54. git clone https://github.com/WildKernels/Samsung_Kernels.git -b ${{ inputs.branch }} $CONFIG
  55. - name: Set Path Environment Variables
  56. run: |
  57. ROOT="$GITHUB_WORKSPACE"
  58. SUSFS4KSU="$ROOT/susfs4ksu"
  59. KERNEL_PATCHES="$ROOT/kernel_patches"
  60. ANYKERNEL3="$ROOT/AnyKernel3"
  61. if [[ "${{ inputs.branch }}" == "SM-A546B-Oneui7" || "${{ inputs.branch }}" == "SM-A546E-Oneui7" ]]; then
  62. COMMON="$CONFIG"
  63. elif [[ "${{ inputs.branch }}" == "SM-A566B" ]]; then
  64. COMMON="$CONFIG/kernel-6.6"
  65. elif [[ "${{ inputs.branch }}" == "SM-S926B-Oneui8" ]]; then
  66. COMMON="$CONFIG/kernel"
  67. else
  68. COMMON="$CONFIG/kernel_platform/common"
  69. fi
  70. DEFCONFIG="$COMMON/arch/arm64/configs/gki_defconfig"
  71. echo "ROOT=$ROOT" >> $GITHUB_ENV
  72. echo "SUSFS4KSU=$SUSFS4KSU" >> $GITHUB_ENV
  73. echo "KERNEL_PATCHES=$KERNEL_PATCHES" >> $GITHUB_ENV
  74. echo "ANYKERNEL3=$ANYKERNEL3" >> $GITHUB_ENV
  75. echo "COMMON=$COMMON" >> $GITHUB_ENV
  76. echo "DEFCONFIG=$DEFCONFIG" >> $GITHUB_ENV
  77. - name: Extract all tar.xz files and delete them
  78. run: |
  79. cd "$CONFIG"
  80. find . -type f -name '*.tar.xz' -print0 | while IFS= read -r -d '' file; do
  81. echo "Extracting $file"
  82. tar -xf "$file"
  83. rm "$file"
  84. done
  85. - name: Add Wild_KSU
  86. run: |
  87. cd "$COMMON"
  88. curl -LSs "https://raw.githubusercontent.com/WildKernels/Wild_KSU/wild/kernel/setup.sh" | bash -s canary
  89. - name: Getting Wild_KSU Version
  90. run: |
  91. cd "$COMMON/Wild_KSU/kernel"
  92. KSU_DIR=$(pwd)
  93. KBUILD="Kbuild"
  94. BASE_VERSION=30000
  95. if [ -d "$KSU_DIR/.git" ]; then
  96. echo "✔ Git repo detected"
  97. # Unshallow if needed
  98. if [ -f "$KSU_DIR/.git/shallow" ]; then
  99. git -C "$KSU_DIR" fetch --unshallow || true
  100. fi
  101. # Get commit count
  102. KSU_GIT_VERSION=$(git -C "$KSU_DIR" rev-list --count HEAD)
  103. # Calculate version
  104. KSU_VERSION=$((BASE_VERSION + KSU_GIT_VERSION))
  105. # Get latest tag (safe)
  106. KSU_GIT_TAG=$(git -C "$KSU_DIR" describe --tags --abbrev=0 2>/dev/null || echo "v0.0.1")
  107. else
  108. echo "⚠ Not a git repo, using defaults"
  109. KSU_VERSION=33151
  110. KSU_GIT_TAG="v3.0.0"
  111. fi
  112. echo "Computed version: $KSU_VERSION"
  113. echo "Computed tag: $KSU_GIT_TAG"
  114. # Export for CI (optional)
  115. echo "KSU_VERSION=$KSU_VERSION" >> $GITHUB_ENV
  116. echo "KSU_VERSION_TAG=$KSU_GIT_TAG" >> $GITHUB_ENV
  117. # --- Update Kbuild fallback values ---
  118. # Update numeric fallback
  119. sed -i "s/KSU_VERSION_FALLBACK := [0-9]\+/KSU_VERSION_FALLBACK := ${KSU_VERSION}/" "$KBUILD"
  120. # Update tag fallback
  121. sed -i "s/KSU_VERSION_TAG_FALLBACK := .*/KSU_VERSION_TAG_FALLBACK := ${KSU_GIT_TAG}/" "$KBUILD"
  122. echo "✅ Updated fallback values in $KBUILD"
  123. - name: Apply SUSFS Patches
  124. run: |
  125. cd "$COMMON"
  126. # Apply compatibility fixes
  127. SUSFS_VERSION="2.0.0"
  128. cp "$SUSFS4KSU/kernel_patches/fs/"* ./fs/
  129. cp "$SUSFS4KSU/kernel_patches/include/linux/"* ./include/linux/
  130. cp "$SUSFS4KSU/kernel_patches/50_add_susfs_in_gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}.patch" ./
  131. # Apply SUSFS core patch
  132. patch -p1 < 50_add_susfs_in_gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}.patch || true
  133. rm -rf 50_add_susfs_in_gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}.patch
  134. cp "$KERNEL_PATCHES/samsung/${{ inputs.branch }}/"* ./
  135. # Fix SUSFS rejects
  136. for p in *.patch; do
  137. patch -p1 < "$p"
  138. done
  139. # # Fix SUSFS rejects
  140. # if [[ "${{ inputs.branch }}" == "SM-S928B-Oneui7" || "${{ inputs.branch }}" == "SM-S928B-Oneui8" ]]; then
  141. # cp "$KERNEL_PATCHES/samsung/S24U/"* ./
  142. # patch -p1 < fix_namespace.patch
  143. # patch -p1 < fix_base.patch
  144. # elif [[ "${{ inputs.branch }}" == "SM-S918B-Oneui8" ]]; then
  145. # cp "$KERNEL_PATCHES/samsung/${{ inputs.branch }}/"* ./
  146. # patch -p1 < fix_namespace.patch
  147. # patch -p1 < fix_base.patch
  148. # patch -p1 < fix_exec.patch
  149. # elif [[ "${{ inputs.branch }}" == "SM-X916B" ]]; then
  150. # cp "$KERNEL_PATCHES/samsung/${{ inputs.branch }}/"* ./
  151. # patch -p1 < fix_namespace.patch
  152. # patch -p1 < fix_base.patch
  153. # patch -p1 < fix_exec.patch
  154. # elif [[ "${{ inputs.branch }}" == "SM-F946N" || "${{ inputs.branch }}" == "SM-F946B-Oneui8" ]]; then
  155. # cp "$KERNEL_PATCHES/samsung/SM-F946N/"* ./
  156. # patch -p1 < fix_namespace.patch
  157. # patch -p1 < fix_base.patch
  158. # patch -p1 < fix_exec.patch
  159. # elif [[ "${{ inputs.branch }}" == "SM-A546B-Oneui7" || "${{ inputs.branch }}" == "SM-A546E-Oneui7" ]]; then
  160. # cp "$KERNEL_PATCHES/samsung/SM-A546B-Oneui7/"* ./
  161. # patch -p1 < fix_namespace.patch
  162. # patch -p1 < fix_base.patch
  163. # patch -p1 < Disable_CRC.patch
  164. # patch -p1 < fix_exec.patch
  165. # patch -p1 < configLSM.patch
  166. # elif [[ "${{ inputs.branch }}" == "SM-A566B" ]]; then
  167. # cp "$KERNEL_PATCHES/samsung/${{ inputs.branch }}/"* ./
  168. # patch -p1 < fix_namespace.patch
  169. # patch -p1 < fix_base.patch
  170. # patch -p1 < fix_taskmmu.patch
  171. # elif [[ "${{ inputs.branch }}" == "SM-S916B-Oneui8" ]]; then
  172. # cp "$KERNEL_PATCHES/samsung/${{ inputs.branch }}/"* ./
  173. # patch -p1 < fix_namespace.patch
  174. # patch -p1 < fix_base.patch
  175. # patch -p1 < fix_exec.patch
  176. # elif [[ "${{ inputs.branch }}" == "SM-S926B-Oneui8" ]]; then
  177. # cp "$KERNEL_PATCHES/samsung/${{ inputs.branch }}/"* ./
  178. # patch -p1 < fix_namespace.patch
  179. # patch -p1 < fix_base.patch
  180. # fi
  181. - name: Fix WiFi and Bluetooth on Samsung 6.6 GKI devices
  182. if: ${{ inputs.kernel_version == '6.6' }}
  183. run: |
  184. cd "$COMMON"
  185. SYMBOL_LIST=android/abi_gki_aarch64_galaxy
  186. echo "kdp_set_cred_non_rcu" >> $SYMBOL_LIST
  187. echo "kdp_usecount_dec_and_test" >> $SYMBOL_LIST
  188. echo "kdp_usecount_inc" >> $SYMBOL_LIST
  189. cp "$KERNEL_PATCHES/samsung/min_kdp/min_kdp.c" drivers/min_kdp.c
  190. echo "obj-y += min_kdp.o" >> drivers/Makefile
  191. - name: Add BBG
  192. run: |
  193. cd "$COMMON"
  194. echo "Adding BBG..."
  195. curl -LSs https://github.com/vc-teahouse/Baseband-guard/raw/main/setup.sh | bash
  196. echo "CONFIG_BBG=y" >> arch/arm64/configs/gki_defconfig
  197. sed -i '/^config LSM$/,/^help$/{ /^[[:space:]]*default/ { /baseband_guard/! s/selinux/selinux,baseband_guard/ } }' security/Kconfig
  198. - name: Set Kernel Configuration Variables
  199. run: |
  200. echo "Initializing kernel configuration..."
  201. cat >> "$DEFCONFIG" << 'EOF'
  202. # KernelSU Configuration
  203. CONFIG_KSU=y
  204. CONFIG_KSU_SUSFS=y
  205. # Mountify Support
  206. CONFIG_TMPFS_XATTR=y
  207. CONFIG_TMPFS_POSIX_ACL=y
  208. EOF
  209. if [[ "${{ inputs.branch }}" == "SM-S938B-Oneui7" ]]; then
  210. echo "Nothing else needed"
  211. elif [[ "${{ inputs.branch }}" == "SM-A546B-Oneui7" || "${{ inputs.branch }}" == "SM-A546E-Oneui7" ]]; then
  212. cat >> "$DEFCONFIG" << 'EOF'
  213. # nuke root protection
  214. CONFIG_UH=n
  215. CONFIG_UH_RKP=n
  216. CONFIG_UH_LKMAUTH=n
  217. CONFIG_UH_LKM_BLOCK=n
  218. CONFIG_RKP_CFP_JOPP=n
  219. CONFIG_RKP_CFP=n
  220. CONFIG_SECURITY_DEFEX=n
  221. CONFIG_PROCA=n
  222. CONFIG_FIVE=n
  223. #Force Load Kernel Modules
  224. CONFIG_MODULES=y
  225. CONFIG_MODULE_FORCE_LOAD=y
  226. CONFIG_MODULE_UNLOAD=y
  227. CONFIG_MODULE_FORCE_UNLOAD=y
  228. CONFIG_MODVERSIONS=y
  229. CONFIG_MODULE_SRCVERSION_ALL=n
  230. CONFIG_MODULE_SIG=n
  231. CONFIG_MODULE_COMPRESS=n
  232. CONFIG_TRIM_UNUSED_KSYMS=n
  233. EOF
  234. elif [[ "${{ inputs.branch }}" == "SM-S926B-Oneui8" ]]; then
  235. cat >> "$COMMON/arch/arm64/configs/s5e9945-bazel_defconfig" << 'EOF'
  236. # nuke root protection
  237. CONFIG_UH=n
  238. CONFIG_UH_RKP=n
  239. CONFIG_UH_LKMAUTH=n
  240. CONFIG_UH_LKM_BLOCK=n
  241. CONFIG_RKP_CFP_JOPP=n
  242. CONFIG_RKP_CFP=n
  243. CONFIG_SECURITY_DEFEX=n
  244. CONFIG_PROCA=n
  245. CONFIG_FIVE=n
  246. EOF
  247. else
  248. cat >> "$DEFCONFIG" << 'EOF'
  249. # nuke root protection
  250. CONFIG_UH=n
  251. CONFIG_UH_RKP=n
  252. CONFIG_UH_LKMAUTH=n
  253. CONFIG_UH_LKM_BLOCK=n
  254. CONFIG_RKP_CFP_JOPP=n
  255. CONFIG_RKP_CFP=n
  256. CONFIG_SECURITY_DEFEX=n
  257. CONFIG_PROCA=n
  258. CONFIG_FIVE=n
  259. EOF
  260. fi
  261. cd "$COMMON"
  262. # Remove check_defconfig
  263. sed -i 's/check_defconfig//' ./build.config.gki
  264. - name: Change Kernel Name
  265. run: |
  266. cd "$COMMON"
  267. #Add Wild to Kernel Version
  268. sed -i '$s|echo "\$res"|echo "\$res-Wild"|' ./scripts/setlocalversion
  269. #Set Kernel Timestamp
  270. 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
  271. #Remove Abi Exports and Error
  272. rm -rf ./android/abi_gki_protected_exports_*
  273. perl -pi -e 's/^\s*"protected_exports_list"\s*:\s*"android\/abi_gki_protected_exports_aarch64",\s*$//;' ./BUILD.bazel
  274. - name: Set file name
  275. run: |
  276. ARTIFACT_BASE="${{ inputs.branch }}-${{ inputs.kernel_version }}-${{ inputs.android_version }}"
  277. echo "ARTIFACT_BASE=$ARTIFACT_BASE" >> $GITHUB_ENV
  278. echo "FILE_NAME=$ARTIFACT_BASE" >> $GITHUB_ENV
  279. - name: Build
  280. run : |
  281. set -e
  282. set -x
  283. cd "$CONFIG"
  284. echo "Building the kernel..."
  285. if [[ "${{ inputs.branch }}" == "SM-S928B-Oneui7" || "${{ inputs.branch }}" == "SM-S928B-Oneui8" || "${{ inputs.branch }}" == "SM-S938B-Oneui7" ]]; then
  286. chmod +x build_kernel_GKI.sh
  287. ./build_kernel_GKI.sh
  288. elif [[ "${{ inputs.branch }}" == "SM-X916B" || "${{ inputs.branch }}" == "SM-F946N" || "${{ inputs.branch }}" == "SM-S916B-Oneui8" || "${{ inputs.branch }}" == "SM-S918B-Oneui8" || "${{ inputs.branch }}" == "SM-F946B-Oneui8" ]]; then
  289. chmod +x build_kernel_GKI.sh
  290. LTO=thin ./build_kernel_GKI.sh || true
  291. elif [[ "${{ inputs.branch }}" == "SM-A546B-Oneui7" || "${{ inputs.branch }}" == "SM-A546E-Oneui7" ]]; then
  292. sudo apt update
  293. sudo apt-get install -y libyaml-dev
  294. LTO=thin ./build_kernel.sh || true
  295. elif [[ "${{ inputs.branch }}" == "SM-A566B" ]]; then
  296. chmod +x build_script.sh
  297. touch ./kernel-6.6/abi_symbollist.raw
  298. touch ./kernel-6.6/abi_symbollist
  299. ./build_script.sh
  300. elif [[ "${{ inputs.branch }}" == "SM-S926B-Oneui8" ]]; then
  301. tools/bazel run --nocheck_bzl_visibility --config=stamp --sandbox_debug --verbose_failures --debug_make_verbosity=I //projects/s5e9945:s5e9945_user_dist
  302. else
  303. #temporarily using this until i can figure out the other phones build script issues
  304. cd kernel_platform
  305. tools/bazel build --config=fast --lto=thin //common:kernel_aarch64_dist || exit 1
  306. fi
  307. - name: Prepare AnyKernel3
  308. run: |
  309. cd "$CONFIG"
  310. # Copy Image from normal build locations
  311. #if [ -f "./$CONFIG/out/${{ inputs.android_version }}-${{ inputs.kernel_version }}/dist/Image" ]; then
  312. # cp ./$CONFIG/out/${{ inputs.android_version }}-${{ inputs.kernel_version }}/dist/Image AnyKernel3/Image
  313. #elif [ -f "./$CONFIG/bazel-bin/common/kernel_aarch64/Image" ]; then
  314. # cp ./$CONFIG/bazel-bin/common/kernel_aarch64/Image AnyKernel3/Image
  315. #else
  316. # echo "Error: Image file not found in any expected location"
  317. # exit 1
  318. #fi
  319. if [[ "${{ inputs.branch }}" == "SM-S928B-Oneui7" || "${{ inputs.branch }}" == "SM-S928B-Oneui8" || "${{ inputs.branch }}" == "SM-S938B-Oneui7" ]]; then
  320. cp ./kernel_platform/sec/dist/Image "$ANYKERNEL3/Image"
  321. elif [[ -f ./$CONFIG/bazel-bin/common/kernel_aarch64/Image ]]; then
  322. cp ./$CONFIG/bazel-bin/common/kernel_aarch64/Image "$ANYKERNEL3/Image"
  323. elif [[ "${{ inputs.branch }}" == "SM-X916B" || "${{ inputs.branch }}" == "SM-F946N" || "${{ inputs.branch }}" == "SM-F946B-Oneui8" || "${{ inputs.branch }}" == "SM-S916B-Oneui8" || "${{ inputs.branch }}" == "SM-S918B-Oneui8" ]]; then
  324. cp ./out/msm-kalama-kalama-gki/dist/Image "$ANYKERNEL3/Image"
  325. elif [[ "${{ inputs.branch }}" == "SM-A546B-Oneui7" || "${{ inputs.branch }}" == "SM-A546E-Oneui7" ]]; then
  326. cp ./arch/arm64/boot/Image "$ANYKERNEL3/Image"
  327. elif [[ "${{ inputs.branch }}" == "SM-A566B" ]]; then
  328. cp ./kernel-6.6/out/arch/arm64/boot/Image "$ANYKERNEL3/Image"
  329. elif [[ "${{ inputs.branch }}" == "SM-S926B-Oneui8" ]]; then
  330. cp ./out/s5e9945_user/dist/Image "$ANYKERNEL3/Image"
  331. else
  332. echo "Error: Image file not found in any expected location"
  333. exit 1
  334. fi
  335. - name: Create Bootimgs Folder and Copy Images for Android 14/15
  336. if: ${{ inputs.android_version == 'android14' || inputs.android_version == 'android15' }}
  337. run: |
  338. #mkdir bootimgs
  339. #cp ./$CONFIG/bazel-bin/common/kernel_aarch64/Image ./bootimgs
  340. #cp ./$CONFIG/bazel-bin/common/kernel_aarch64/Image.lz4 ./bootimgs
  341. #cp ./$CONFIG/bazel-bin/common/kernel_aarch64/Image ./${{ env.FILE_NAME }}-Image
  342. #cp ./$CONFIG/bazel-bin/common/kernel_aarch64/Image.lz4 ./${{ env.FILE_NAME }}-Image.lz4
  343. # Create gzip of the Image file
  344. #gzip -n -k -f -9 ./${{ env.FILE_NAME }}-Image > ./${{ env.FILE_NAME }}-Image.gz
  345. #gzip -n -k -f -9 ./bootimgs/Image > ./bootimgs/Image.gz
  346. #cp ./boot-lz4.img ../${{ env.FILE_NAME }}-boot-lz4.img
  347. - name: Upload AnyKernel3 Artifacts
  348. id: upload_ak3
  349. uses: actions/upload-artifact@v4
  350. with:
  351. name: ${{ env.FILE_NAME }}-AnyKernel3
  352. path: |
  353. ./AnyKernel3/**
  354. compression-level: 9
  355. - name: Scan and collect patch rejects
  356. if: ${{ always() }}
  357. run: |
  358. set -e
  359. CONFIG_DIR="$CONFIG"
  360. REJECTS_DIR="$GITHUB_WORKSPACE/patch-rejects"
  361. mkdir -p "$REJECTS_DIR"
  362. # Find all .rej files under the configuration directory
  363. mapfile -t REJS < <(find "$CONFIG_DIR" -type f -name '*.rej')
  364. REJ_COUNT=${#REJS[@]}
  365. echo "Found $REJ_COUNT .rej files under $CONFIG_DIR"
  366. echo "REJ_COUNT=$REJ_COUNT" >> $GITHUB_ENV
  367. if [ "$REJ_COUNT" -gt 0 ]; then
  368. for REJ in "${REJS[@]}"; do
  369. # Relative path from $CONFIG
  370. REL="${REJ#"$CONFIG_DIR"/}"
  371. DEST="$REJECTS_DIR/$REL"
  372. mkdir -p "$(dirname "$DEST")"
  373. cp "$REJ" "$DEST"
  374. # Copy the associated original file alongside the .rej
  375. ORIG="${REJ%.rej}"
  376. if [ -f "$ORIG" ]; then
  377. ORIG_DEST="$REJECTS_DIR/${REL%.rej}"
  378. mkdir -p "$(dirname "$ORIG_DEST")"
  379. cp "$ORIG" "$ORIG_DEST"
  380. fi
  381. echo "$REL" >> "$REJECTS_DIR/index.txt"
  382. done
  383. fi
  384. - name: Generate Build Summary
  385. if: ${{ always() }}
  386. run: |
  387. # Create build summary file for inclusion in Misc artifact
  388. echo "# Kernel Build Summary" > build_summary.md
  389. # Add build variant header
  390. echo "## ${{ env.FILE_NAME }}" >> build_summary.md
  391. # Add build info
  392. echo "## Build Information" >> build_summary.md
  393. echo "- **Android Version**: ${{ inputs.android_version }}" >> build_summary.md
  394. echo "- **Kernel Version**: ${{ inputs.kernel_version }}.${{ inputs.sub_level }}" >> build_summary.md
  395. echo "- **BBG**: Installed" >> build_summary.md
  396. echo "- **Bypass Mode**: ${{ matrix.apply_bypass }}" >> build_summary.md
  397. echo "" >> build_summary.md
  398. # Get Wild_KSU commit
  399. if [ -d "$CONFIG/Wild_KSU" ]; then
  400. cd "$CONFIG/Wild_KSU"
  401. WKSU_COMMIT=$(git rev-parse HEAD)
  402. WKSU_URL="https://github.com/WildKernels/Wild_KSU/commit/$WKSU_COMMIT"
  403. echo "- **Wild_KSU**: [$WKSU_COMMIT]($WKSU_URL)" >> "$GITHUB_WORKSPACE/build_summary.md"
  404. cd "$GITHUB_WORKSPACE"
  405. else
  406. echo "- **Wild_KSU**: not present" >> build_summary.md
  407. fi
  408. # Get Baseband-guard commit
  409. if [ -d "$CONFIG/Baseband-guard" ]; then
  410. cd "$CONFIG/Baseband-guard"
  411. BBG_COMMIT=$(git rev-parse HEAD)
  412. BBG_URL="https://github.com/vc-teahouse/Baseband-guard/commit/$BBG_COMMIT"
  413. echo "- **Baseband-guard**: [$BBG_COMMIT]($BBG_URL)" >> "$GITHUB_WORKSPACE/build_summary.md"
  414. cd "$GITHUB_WORKSPACE"
  415. else
  416. echo "- **Baseband-guard**: not present" >> build_summary.md
  417. fi
  418. # Get SUSFS4KSU commit
  419. if [ -d "$GITHUB_WORKSPACE/susfs4ksu" ]; then
  420. cd "$GITHUB_WORKSPACE/susfs4ksu"
  421. SUSFS_COMMIT=$(git rev-parse HEAD)
  422. SUSFS_URL="https://gitlab.com/simonpunk/susfs4ksu/-/commit/$SUSFS_COMMIT"
  423. echo "- **SUSFS4KSU (v1.5.12)**: [$SUSFS_COMMIT]($SUSFS_URL)" >> "$GITHUB_WORKSPACE/build_summary.md"
  424. cd "$GITHUB_WORKSPACE"
  425. else
  426. echo "- **SUSFS4KSU (v1.5.12)**: not present" >> build_summary.md
  427. fi
  428. echo "" >> build_summary.md
  429. # Add artifact summary with presence verification
  430. echo "## Build Artifacts" >> build_summary.md
  431. # Verify AnyKernel3 contents - check if kernel Image was actually copied (indicates successful build)
  432. if [ -d "AnyKernel3" ] && [ -f "AnyKernel3/Image" ]; then
  433. AK3_STATUS="✅"
  434. else
  435. AK3_STATUS="❌"
  436. fi
  437. echo "- **AnyKernel3**: $AK3_STATUS ${{ env.FILE_NAME }}-AnyKernel3" >> build_summary.md
  438. echo "### Misc (uploaded files)" >> build_summary.md
  439. FILES_PRESENT=0
  440. 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
  441. if [ -f "$f" ]; then FILES_PRESENT=$((FILES_PRESENT+1)); fi
  442. done
  443. if [ "$FILES_PRESENT" -gt 0 ]; then
  444. MISC_STATUS="✅"
  445. else
  446. MISC_STATUS="❌"
  447. fi
  448. echo "- **Set**: $MISC_STATUS ${{ env.FILE_NAME }}-Misc" >> build_summary.md
  449. if [ "$MISC_STATUS" = "✅" ]; then
  450. echo " Included:" >> build_summary.md
  451. 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
  452. if [ -f "$f" ]; then
  453. echo " - $f" >> build_summary.md
  454. fi
  455. done
  456. fi
  457. echo "### Diagnostics" >> build_summary.md
  458. echo "- **Rejected Patches**: ${{ env.FILE_NAME }}-Rejected-Patches" >> build_summary.md
  459. if [ -f patch-rejects/index.txt ]; then
  460. if [ -s patch-rejects/index.txt ]; then
  461. echo " Rejected files:" >> build_summary.md
  462. while IFS= read -r line; do
  463. echo " - $line" >> build_summary.md
  464. done < patch-rejects/index.txt
  465. else
  466. echo " Rejected file list is empty." >> build_summary.md
  467. fi
  468. else
  469. echo " No rejected patches found." >> build_summary.md
  470. fi