gki-kernel.yml 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438
  1. name: GKI Kernel Build
  2. permissions:
  3. contents: write # Allow writing to repository contents (for pushing tags)
  4. actions: write # Allows triggering actions
  5. on:
  6. workflow_call: # This allows this workflow to be called from another workflow
  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. runner:
  21. required: true
  22. type: string
  23. lto_type:
  24. required: true
  25. type: string
  26. kernelsu_variant:
  27. required: true
  28. type: string
  29. kernelsu_branch:
  30. required: true
  31. type: string
  32. kernelsu_branch_other:
  33. required: false
  34. type: string
  35. revision:
  36. required: false
  37. type: string
  38. jobs:
  39. build-kernel-kernelsu-susfs:
  40. runs-on: ${{ inputs.runner }}
  41. steps:
  42. - name: Maximize build space
  43. if: ${{ inputs.runner == 'ubuntu-22.04' }}
  44. uses: easimon/maximize-build-space@master
  45. with:
  46. root-reserve-mb: 8192
  47. temp-reserve-mb: 2048
  48. swap-size-mb: 8192
  49. remove-dotnet: "true"
  50. remove-android: "true"
  51. remove-haskell: "true"
  52. remove-codeql: "true"
  53. - name: Clean up workspace
  54. run: rm -rf ${{ github.workspace }}/*
  55. - name: Set CONFIG Environment Variable
  56. run: |
  57. # Set CONFIG dynamically based on inputs values
  58. CONFIG="${{ inputs.android_version }}-${{ inputs.kernel_version }}-${{ inputs.sub_level }}"
  59. # Set CONFIG as an environment variable for future steps
  60. echo "CONFIG=$CONFIG" >> $GITHUB_ENV
  61. echo "CONFIG set to: $CONFIG"
  62. - name: Cache toolchain
  63. id: cache-toolchain
  64. uses: actions/cache@v4
  65. with:
  66. path: |
  67. kernel-build-tools
  68. mkbootimg
  69. key: toolchain-${{ runner.os }}-v1
  70. # Step 2: Download toolchain if cache was not found
  71. - name: Download toolchain (if cache not found)
  72. if: steps.cache-toolchain.outputs.cache-hit != 'true'
  73. run: |
  74. AOSP_MIRROR=https://android.googlesource.com
  75. BRANCH=main-kernel-build-2024
  76. git clone $AOSP_MIRROR/kernel/prebuilts/build-tools -b $BRANCH --depth 1 kernel-build-tools
  77. git clone $AOSP_MIRROR/platform/system/tools/mkbootimg -b $BRANCH --depth 1 mkbootimg
  78. - name: Set environment variables
  79. run: |
  80. echo "AVBTOOL=$GITHUB_WORKSPACE/kernel-build-tools/linux-x86/bin/avbtool" >> $GITHUB_ENV
  81. echo "MKBOOTIMG=$GITHUB_WORKSPACE/mkbootimg/mkbootimg.py" >> $GITHUB_ENV
  82. echo "UNPACK_BOOTIMG=$GITHUB_WORKSPACE/mkbootimg/unpack_bootimg.py" >> $GITHUB_ENV
  83. - name: Set boot sign key
  84. env:
  85. BOOT_SIGN_KEY: ${{ secrets.BOOT_SIGN_KEY }}
  86. run: |
  87. if [ ! -z "$BOOT_SIGN_KEY" ]; then
  88. echo "$BOOT_SIGN_KEY" > ./kernel-build-tools/linux-x86/share/avb/testkey_rsa2048.pem
  89. echo "BOOT_SIGN_KEY_PATH=$GITHUB_WORKSPACE/kernel-build-tools/linux-x86/share/avb/testkey_rsa2048.pem" >> $GITHUB_ENV
  90. else
  91. echo "BOOT_SIGN_KEY is not set. Exiting..."
  92. exit 1
  93. fi
  94. - name: Install Repo
  95. run: |
  96. # Install dependencies
  97. mkdir -p ./git-repo
  98. curl https://storage.googleapis.com/git-repo-downloads/repo > ./git-repo/repo
  99. chmod a+rx ./git-repo/repo
  100. echo "REPO=$GITHUB_WORKSPACE/./git-repo/repo" >> $GITHUB_ENV
  101. - name: Clone AnyKernel3 and Other Dependencies
  102. run: |
  103. echo "Cloning AnyKernel3 and other dependencies..."
  104. # Define the branch names using the inputs values
  105. SUSFS_BRANCH="gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}"
  106. # Debug print the branches
  107. echo "Using branch for SUSFS: $SUSFS_BRANCH"
  108. # Clone repositories using the branch names
  109. git clone https://github.com/WildPlusKernel/AnyKernel3.git -b "gki"
  110. git clone https://gitlab.com/simonpunk/susfs4ksu.git -b "$SUSFS_BRANCH"
  111. git clone https://github.com/WildPlusKernel/kernel_patches.git
  112. - name: Set CONFIG Environment Variable
  113. run: |
  114. # Set CONFIG dynamically based on inputs values
  115. CONFIG="${{ inputs.android_version }}-${{ inputs.kernel_version }}-${{ inputs.sub_level }}"
  116. # Set CONFIG as an environment variable for future steps
  117. echo "CONFIG=$CONFIG" >> $GITHUB_ENV
  118. echo "CONFIG set to: $CONFIG"
  119. - name: Initialize and Sync Kernel Source
  120. run: |
  121. echo "Creating folder for configuration: $CONFIG..."
  122. mkdir -p "$CONFIG"
  123. cd "$CONFIG"
  124. # Initialize and sync kernel source
  125. echo "Initializing and syncing kernel source..."
  126. FORMATTED_BRANCH="${{ inputs.android_version }}-${{ inputs.kernel_version }}-${{ inputs.os_patch_level }}"
  127. $REPO init --depth=1 --u https://android.googlesource.com/kernel/manifest -b common-${FORMATTED_BRANCH} --repo-rev=v2.16
  128. REMOTE_BRANCH=$(git ls-remote https://android.googlesource.com/kernel/common ${FORMATTED_BRANCH})
  129. DEFAULT_MANIFEST_PATH=.repo/manifests/default.xml
  130. # Check if branch is deprecated
  131. if grep -q deprecated <<< $REMOTE_BRANCH; then
  132. echo "Found deprecated branch: $FORMATTED_BRANCH"
  133. sed -i "s/\"${FORMATTED_BRANCH}\"/\"deprecated\/${FORMATTED_BRANCH}\"/g" $DEFAULT_MANIFEST_PATH
  134. fi
  135. # Sync repo and apply patches
  136. $REPO --version
  137. $REPO --trace sync -c -j$(nproc --all) --no-tags --fail-fast
  138. - name: Determine the branch for KernelSU
  139. run: |
  140. if [[ "${{ inputs.kernelsu_branch }}" == "Stable" ]]; then
  141. echo "BRANCH=-" >> $GITHUB_ENV
  142. elif [[ "${{ inputs.kernelsu_branch }}" == "Dev" && ( "${{ inputs.kernelsu_variant }}" == "Official" || "${{ inputs.kernelsu_variant }}" == "MKSU" ) ]]; then
  143. echo "BRANCH=-s main" >> $GITHUB_ENV
  144. elif [[ "${{ inputs.kernelsu_branch }}" == "Dev" && "${{ inputs.kernelsu_variant }}" == "Next" ]]; then
  145. echo "BRANCH=-s next" >> $GITHUB_ENV
  146. elif [[ "${{ inputs.kernelsu_branch }}" == "Other" && -n "${{ inputs.kernelsu_branch_other }}" ]]; then
  147. echo "BRANCH=-s ${{ inputs.kernelsu_branch_other }}" >> $GITHUB_ENV
  148. else
  149. echo "Error: Custom branch not provided for 'Other'" >&2
  150. exit 1
  151. fi
  152. - name: Add KernelSU
  153. run: |
  154. echo "Changing to configuration directory: $CONFIG..."
  155. cd "$CONFIG"
  156. if [ "${{ inputs.kernelsu_variant }}" == "Official" ]; then
  157. echo "Adding KernelSU Official..."
  158. curl -LSs "https://raw.githubusercontent.com/tiann/KernelSU/main/kernel/setup.sh" | bash $BRANCH
  159. elif [ "${{ inputs.kernelsu_variant }}" == "Next" ]; then
  160. echo "Adding KernelSU Next..."
  161. #curl -LSs "https://raw.githubusercontent.com/KernelSU-Next/KernelSU-Next/next/kernel/setup.sh" | bash $BRANCH
  162. curl -LSs "https://raw.githubusercontent.com/KernelSU-Next/KernelSU-Next/next-susfs/kernel/setup.sh" | bash -s next-susfs
  163. elif [ "${{ inputs.kernelsu_variant }}" == "MKSU" ]; then
  164. echo "Adding KernelSU MKSU..."
  165. curl -LSs "https://raw.githubusercontent.com/5ec1cff/KernelSU/main/kernel/setup.sh" | bash $BRANCH
  166. fi
  167. - name: Apply SUSFS Patches for KernelSU Variants
  168. run: |
  169. echo "Changing to configuration directory: $CONFIG..."
  170. cd "$CONFIG"
  171. echo "Applying SUSFS patches..."
  172. # Copy SUSFS patches
  173. cp ../susfs4ksu/kernel_patches/50_add_susfs_in_gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}.patch ./common/
  174. cp ../susfs4ksu/kernel_patches/fs/* ./common/fs/
  175. cp ../susfs4ksu/kernel_patches/include/linux/* ./common/include/linux/
  176. if [ "${{ inputs.kernelsu_variant }}" == "Official" ]; then
  177. echo "Applying SUSFS patches for Official KernelSU..."
  178. cp ../susfs4ksu/kernel_patches/KernelSU/10_enable_susfs_for_ksu.patch ./KernelSU/
  179. cd ./KernelSU
  180. patch -p1 --forward < 10_enable_susfs_for_ksu.patch
  181. elif [ "${{ inputs.kernelsu_variant }}" == "Next" ]; then
  182. #echo "Applying SUSFS patches for KernelSU-Next..."
  183. cd ./KernelSU-Next
  184. #cp ../../kernel_patches/KernelSU-Next-Implement-SUSFS-v1.5.5-Universal.patch ./
  185. #patch -p1 --forward < KernelSU-Next-Implement-SUSFS-v1.5.5-Universal.patch || true
  186. elif [ "${{ inputs.kernelsu_variant }}" == "MKSU" ]; then
  187. echo "Applying SUSFS patches for MKSU..."
  188. cp ../susfs4ksu/kernel_patches/KernelSU/10_enable_susfs_for_ksu.patch ./KernelSU/
  189. cd ./KernelSU
  190. patch -p1 --forward < 10_enable_susfs_for_ksu.patch || true
  191. echo "Applying MKSU specific SUSFS patch..."
  192. cp ../../kernel_patches/mksu_susfs.patch ../KernelSU/
  193. patch -p1 < mksu_susfs.patch
  194. cp ../../kernel_patches/fix.patch ./KernelSU/
  195. patch -p1 < fix.patch
  196. else
  197. echo "Invalid KernelSU variant selected!"
  198. exit 1
  199. fi
  200. # Change to common directory and apply common SUSFS patch
  201. cd ../common
  202. patch -p1 < 50_add_susfs_in_gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}.patch || true
  203. - name: Apply Hide Stuff Patches
  204. run: |
  205. echo "Changing to configuration directory: $CONFIG..."
  206. cd "$CONFIG/common"
  207. # Apply additional patch
  208. cp ../../kernel_patches/69_hide_stuff.patch ./
  209. patch -p1 -F 3 < 69_hide_stuff.patch
  210. - name: Add SUSFS Configuration Settings
  211. run: |
  212. echo "Changing to configuration directory: $CONFIG..."
  213. cd "$CONFIG"
  214. echo "Adding configuration settings to gki_defconfig..."
  215. # Add SUSFS configuration settings
  216. echo "CONFIG_KSU=y" >> ./common/arch/arm64/configs/gki_defconfig
  217. echo "CONFIG_KSU_SUSFS=y" >> ./common/arch/arm64/configs/gki_defconfig
  218. echo "CONFIG_KSU_SUSFS_HAS_MAGIC_MOUNT=y" >> ./common/arch/arm64/configs/gki_defconfig
  219. echo "CONFIG_KSU_SUSFS_SUS_PATH=y" >> ./common/arch/arm64/configs/gki_defconfig
  220. echo "CONFIG_KSU_SUSFS_SUS_MOUNT=y" >> ./common/arch/arm64/configs/gki_defconfig
  221. echo "CONFIG_KSU_SUSFS_AUTO_ADD_SUS_KSU_DEFAULT_MOUNT=y" >> ./common/arch/arm64/configs/gki_defconfig
  222. echo "CONFIG_KSU_SUSFS_AUTO_ADD_SUS_BIND_MOUNT=y" >> ./common/arch/arm64/configs/gki_defconfig
  223. echo "CONFIG_KSU_SUSFS_SUS_KSTAT=y" >> ./common/arch/arm64/configs/gki_defconfig
  224. echo "CONFIG_KSU_SUSFS_SUS_OVERLAYFS=n" >> ./common/arch/arm64/configs/gki_defconfig
  225. echo "CONFIG_KSU_SUSFS_TRY_UMOUNT=y" >> ./common/arch/arm64/configs/gki_defconfig
  226. echo "CONFIG_KSU_SUSFS_AUTO_ADD_TRY_UMOUNT_FOR_BIND_MOUNT=y" >> ./common/arch/arm64/configs/gki_defconfig
  227. echo "CONFIG_KSU_SUSFS_SPOOF_UNAME=y" >> ./common/arch/arm64/configs/gki_defconfig
  228. echo "CONFIG_KSU_SUSFS_ENABLE_LOG=y" >> ./common/arch/arm64/configs/gki_defconfig
  229. echo "CONFIG_KSU_SUSFS_HIDE_KSU_SUSFS_SYMBOLS=y" >> ./common/arch/arm64/configs/gki_defconfig
  230. echo "CONFIG_KSU_SUSFS_SPOOF_CMDLINE_OR_BOOTCONFIG=y" >> ./common/arch/arm64/configs/gki_defconfig
  231. echo "CONFIG_KSU_SUSFS_OPEN_REDIRECT=y" >> ./common/arch/arm64/configs/gki_defconfig
  232. echo "CONFIG_KSU_SUSFS_SUS_SU=y" >> ./common/arch/arm64/configs/gki_defconfig
  233. # Add additional tmpfs config setting
  234. echo "CONFIG_TMPFS_XATTR=y" >> ./common/arch/arm64/configs/gki_defconfig
  235. echo "CONFIG_TMPFS_POSIX_ACL=y" >> ./common/arch/arm64/configs/gki_defconfig
  236. # Add additional tmpfs config setting
  237. echo "CONFIG_IP_NF_TARGET_TTL=y" >> ./common/arch/arm64/configs/gki_defconfig
  238. echo "CONFIG_IP6_NF_TARGET_HL=y" >> ./common/arch/arm64/configs/gki_defconfig
  239. echo "CONFIG_IP6_NF_MATCH_HL=y" >> ./common/arch/arm64/configs/gki_defconfig
  240. # Remove check_defconfig
  241. sed -i 's/check_defconfig//' ./common/build.config.gki
  242. - name: Build the Kernel
  243. run: |
  244. echo "Changing to configuration directory: $CONFIG..."
  245. cd "$CONFIG"
  246. sed -i '$s|echo "\$res"|echo "\$res-Wild+"|' ./common/scripts/setlocalversion
  247. # Run perl command to modify UTS_VERSION
  248. perl -pi -e 's{UTS_VERSION="\$\(echo \$UTS_VERSION \$CONFIG_FLAGS \$TIMESTAMP \| cut -b -\$UTS_LEN\)"}{UTS_VERSION="#1 SMP PREEMPT Sat Apr 20 04:20:00 UTC 2024"}' ./common/scripts/mkcompile_h
  249. echo "Building the kernel..."
  250. if [ -f "build/build.sh" ]; then
  251. sed -i 's/-dirty//' ./common/scripts/setlocalversion
  252. LTO=${{ inputs.lto_type }} BUILD_CONFIG=common/build.config.gki.aarch64 build/build.sh
  253. else
  254. rm -rf ./common/android/abi_gki_protected_exports_*
  255. sed -i "/stable_scmversion_cmd/s/-maybe-dirty//g" ./build/kernel/kleaf/impl/stamp.bzl
  256. sed -E -i '/^CONFIG_LOCALVERSION=/ s/(.*)"$/\1-Wild+"/' ./common/arch/arm64/configs/gki_defconfig
  257. tools/bazel build --config=fast --lto=${{ inputs.lto_type }} //common:kernel_aarch64_dist
  258. fi
  259. - name: Create Bootimgs Folder and Copy Images
  260. if: ${{ inputs.android_version == 'android12' || inputs.android_version == 'android13' }}
  261. run: |
  262. echo "Changing to configuration directory: $CONFIG..."
  263. mkdir bootimgs
  264. echo "Creating bootimgs folder and copying images..."
  265. cp ./$CONFIG/out/${{ inputs.android_version }}-${{ inputs.kernel_version }}/dist/Image ./bootimgs
  266. cp ./$CONFIG/out/${{ inputs.android_version }}-${{ inputs.kernel_version }}/dist/Image.lz4 ./bootimgs
  267. cp ./$CONFIG/out/${{ inputs.android_version }}-${{ inputs.kernel_version }}/dist/Image ./
  268. cp ./$CONFIG/out/${{ inputs.android_version }}-${{ inputs.kernel_version }}/dist/Image.lz4 ./
  269. # Create gzip of the Image file
  270. gzip -n -k -f -9 ./Image > ./Image.gz
  271. - name: Create Bootimgs Folder and Copy Images
  272. if: ${{ inputs.android_version == 'android14' || inputs.android_version == 'android15' }}
  273. run: |
  274. echo "Changing to configuration directory: $CONFIG..."
  275. mkdir bootimgs
  276. echo "Creating bootimgs folder and copying images..."
  277. cp ./$CONFIG/bazel-bin/common/kernel_aarch64/Image ./bootimgs
  278. cp ./$CONFIG/bazel-bin/common/kernel_aarch64/Image.lz4 ./bootimgs
  279. cp ./$CONFIG/bazel-bin/common/kernel_aarch64/Image ./
  280. cp ./$CONFIG/bazel-bin/common/kernel_aarch64/Image.lz4 ./
  281. # Create gzip of the Image file
  282. gzip -n -k -f -9 ./Image > ./Image.gz
  283. - name: Create ZIP Files for Different Formats
  284. run: |
  285. echo "Creating zip files for all formats..."
  286. cd ./AnyKernel3
  287. # Create and upload zip for each format
  288. ZIP_NAME="${{ inputs.android_version }}-${{ inputs.kernel_version }}.${{ inputs.sub_level }}-${{ inputs.os_patch_level }}-AnyKernel3.zip"
  289. echo "Creating zip file: $ZIP_NAME..."
  290. mv ../Image ./Image
  291. zip -r "../$ZIP_NAME" ./*
  292. rm ./Image
  293. ZIP_NAME="${{ inputs.android_version }}-${{ inputs.kernel_version }}.${{ inputs.sub_level }}-${{ inputs.os_patch_level }}-AnyKernel3-lz4.zip"
  294. echo "Creating zip file: $ZIP_NAME..."
  295. mv ../Image.lz4 ./Image.lz4
  296. zip -r "../$ZIP_NAME" ./*
  297. rm ./Image.lz4
  298. ZIP_NAME="${{ inputs.android_version }}-${{ inputs.kernel_version }}.${{ inputs.sub_level }}-${{ inputs.os_patch_level }}-AnyKernel3-gz.zip"
  299. echo "Creating zip file: $ZIP_NAME..."
  300. mv ../Image.gz ./Image.gz
  301. zip -r "../$ZIP_NAME" ./*
  302. rm ./Image.gz
  303. - name: Run Boot Image ${{ inputs.android_version }} Build Script
  304. if: ${{ inputs.android_version == 'android12' }}
  305. run: |
  306. echo "Changing to configuration directory: $CONFIG..."
  307. cd bootimgs
  308. GKI_URL=https://dl.google.com/android/gki/gki-certified-boot-android12-5.10-"${{ inputs.os_patch_level }}"_"${{ inputs.revision }}".zip
  309. FALLBACK_URL=https://dl.google.com/android/gki/gki-certified-boot-android12-5.10-2023-01_r1.zip
  310. # Check if the GKI URL is available
  311. echo "Checking if GKI kernel URL is reachable: $GKI_URL"
  312. status=$(curl -sL -w "%{http_code}" "$GKI_URL" -o /dev/null)
  313. if [ "$status" = "200" ]; then
  314. echo "[+] Downloading from GKI_URL"
  315. curl -Lo gki-kernel.zip "$GKI_URL"
  316. else
  317. echo "[+] $GKI_URL not found, using $FALLBACK_URL"
  318. curl -Lo gki-kernel.zip "$FALLBACK_URL"
  319. fi
  320. # Unzip the downloaded kernel and remove the zip
  321. echo "Unzipping the downloaded kernel..."
  322. unzip gki-kernel.zip && rm gki-kernel.zip
  323. echo "Unpacking boot.img..."
  324. FULL_PATH=$(pwd)/boot-5.10.img
  325. echo "Unpacking using: $FULL_PATH"
  326. echo "Running unpack_bootimg.py..."
  327. $UNPACK_BOOTIMG --boot_img="$FULL_PATH"
  328. echo "Building Image.gz"
  329. gzip -n -k -f -9 ./Image > ./Image.gz
  330. echo "Building boot.img"
  331. $MKBOOTIMG --header_version 4 --kernel Image --output boot.img --ramdisk out/ramdisk --os_version 12.0.0 --os_patch_level "${{ inputs.os_patch_level }}"
  332. $AVBTOOL add_hash_footer --partition_name boot --partition_size $((64 * 1024 * 1024)) --image boot.img --algorithm SHA256_RSA2048 --key $BOOT_SIGN_KEY_PATH
  333. cp ./boot.img ../${{ inputs.android_version }}-${{ inputs.kernel_version }}.${{ inputs.sub_level }}-${{ inputs.os_patch_level }}-boot.img
  334. echo "Building boot-gz.img"
  335. $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 }}"
  336. $AVBTOOL add_hash_footer --partition_name boot --partition_size $((64 * 1024 * 1024)) --image boot-gz.img --algorithm SHA256_RSA2048 --key $BOOT_SIGN_KEY_PATH
  337. cp ./boot-gz.img ../${{ inputs.android_version }}-${{ inputs.kernel_version }}.${{ inputs.sub_level }}-${{ inputs.os_patch_level }}-boot-gz.img
  338. echo "Building boot-lz4.img"
  339. $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 }}"
  340. $AVBTOOL add_hash_footer --partition_name boot --partition_size $((64 * 1024 * 1024)) --image boot-lz4.img --algorithm SHA256_RSA2048 --key $BOOT_SIGN_KEY_PATH
  341. cp ./boot-lz4.img ../${{ inputs.android_version }}-${{ inputs.kernel_version }}.${{ inputs.sub_level }}-${{ inputs.os_patch_level }}-boot-lz4.img
  342. - name: Run Boot Image ${{ inputs.android_version }} Build Script
  343. if: ${{ inputs.android_version == 'android13' || inputs.android_version == 'android14' || inputs.android_version == 'android15' }}
  344. run: |
  345. cd bootimgs
  346. echo "Building Image.gz"
  347. gzip -n -k -f -9 ./Image > ./Image.gz
  348. echo "Building boot.img"
  349. $MKBOOTIMG --header_version 4 --kernel Image --output boot.img
  350. $AVBTOOL add_hash_footer --partition_name boot --partition_size $((64 * 1024 * 1024)) --image boot.img --algorithm SHA256_RSA2048 --key $BOOT_SIGN_KEY_PATH
  351. cp ./boot.img ../${{ inputs.android_version }}-${{ inputs.kernel_version }}.${{ inputs.sub_level }}-${{ inputs.os_patch_level }}-boot.img
  352. echo "Building boot-gz.img"
  353. $MKBOOTIMG --header_version 4 --kernel Image.gz --output boot-gz.img
  354. $AVBTOOL add_hash_footer --partition_name boot --partition_size $((64 * 1024 * 1024)) --image boot-gz.img --algorithm SHA256_RSA2048 --key $BOOT_SIGN_KEY_PATH
  355. cp ./boot-gz.img ../${{ inputs.android_version }}-${{ inputs.kernel_version }}.${{ inputs.sub_level }}-${{ inputs.os_patch_level }}-boot-gz.img
  356. echo "Building boot-lz4.img"
  357. $MKBOOTIMG --header_version 4 --kernel Image.lz4 --output boot-lz4.img
  358. $AVBTOOL add_hash_footer --partition_name boot --partition_size $((64 * 1024 * 1024)) --image boot-lz4.img --algorithm SHA256_RSA2048 --key $BOOT_SIGN_KEY_PATH
  359. cp ./boot-lz4.img ../${{ inputs.android_version }}-${{ inputs.kernel_version }}.${{ inputs.sub_level }}-${{ inputs.os_patch_level }}-boot-lz4.img
  360. - name: Upload Build Artifacts
  361. uses: actions/upload-artifact@v4
  362. with:
  363. name: kernel-${{ env.CONFIG }}
  364. path: |
  365. *.zip
  366. *.img