gki-kernel.yml 21 KB

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