gki-kernel.yml 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455
  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. cd KernelSU
  163. git revert -m 1 3a73585 -n
  164. KSU_VERSION=$(expr $(/usr/bin/git rev-list --count HEAD) "+" 12063)
  165. echo "KSUVER=$KSU_VERSION" >> $GITHUB_ENV
  166. sed -i "s/DKSU_VERSION=16/DKSU_VERSION=${KSU_VERSION}/" kernel/Makefile
  167. - name: Add KernelSU
  168. if: ${{ inputs.kernelsu_variant == 'Next' }}
  169. run: |
  170. echo "Changing to configuration directory: $CONFIG..."
  171. cd "$CONFIG"
  172. echo "Adding KernelSU..."
  173. curl -LSs "https://raw.githubusercontent.com/rifsxd/KernelSU-Next/next/kernel/setup.sh" | bash $BRANCH
  174. - name: Apply Addtional Patches for MagicKernelSU
  175. if: ${{inputs.kernelsu_variant == 'MKSU' }}
  176. run: |
  177. echo "Changing to configuration directory: $CONFIG..."
  178. cd "$CONFIG"
  179. echo "Apply Addtional patches for MagicKernelSU..."
  180. cp ../kernel_patches/patches/mksu_susfs.patch ./KernelSU/
  181. cd ./KernelSU
  182. patch -p1 < mksu_susfs.patch
  183. - name: Apply SUSFS Patches KernelSU
  184. if: ${{ inputs.kernelsu_variant == 'Official' || inputs.kernelsu_variant == 'MKSU' }}
  185. run: |
  186. echo "Changing to configuration directory: $CONFIG..."
  187. cd "$CONFIG"
  188. echo "Applying SUSFS patches..."
  189. # Copy SUSFS patches
  190. cp ../susfs4ksu/kernel_patches/KernelSU/10_enable_susfs_for_ksu.patch ./KernelSU/
  191. cp ../susfs4ksu/kernel_patches/50_add_susfs_in_gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}.patch ./common/
  192. cp ../susfs4ksu/kernel_patches/fs/* ./common/fs/
  193. cp ../susfs4ksu/kernel_patches/include/linux/* ./common/include/linux/
  194. cd ./KernelSU
  195. echo "Applying next SUSFS patches..."
  196. patch -p1 --forward < 10_enable_susfs_for_ksu.patch
  197. # Change to common directory and apply SUSFS patch
  198. cd ../common
  199. patch -p1 < 50_add_susfs_in_gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}.patch || true
  200. - name: Apply SUSFS Patches KernelSU-Next
  201. if: ${{ inputs.kernelsu_variant == 'Next' }}
  202. run: |
  203. echo "Changing to configuration directory: $CONFIG..."
  204. cd "$CONFIG"
  205. echo "Applying SUSFS patches..."
  206. # Copy SUSFS patches
  207. cp ../susfs4ksu/kernel_patches/50_add_susfs_in_gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}.patch ./common/
  208. cp ../susfs4ksu/kernel_patches/fs/* ./common/fs/
  209. cp ../susfs4ksu/kernel_patches/include/linux/* ./common/include/linux/
  210. cd ./KernelSU-Next
  211. echo "Applying next SUSFS patches..."
  212. cp ../../kernel_patches/KernelSU-Next-Implement-SUSFS-v1.5.5-Universal.patch ./
  213. patch -p1 --forward < KernelSU-Next-Implement-SUSFS-v1.5.5-Universal.patch || true
  214. # Change to common directory and apply SUSFS patch
  215. cd ../common
  216. patch -p1 < 50_add_susfs_in_gki-${{ inputs.android_version }}-${{ inputs.kernel_version }}.patch || true
  217. - name: Apply Hide Stuff Patches
  218. run: |
  219. echo "Changing to configuration directory: $CONFIG..."
  220. cd "$CONFIG/common"
  221. # Apply additional patch
  222. cp ../../kernel_patches/69_hide_stuff.patch ./
  223. patch -p1 -F 3 < 69_hide_stuff.patch
  224. - name: Add SUSFS Configuration Settings
  225. run: |
  226. echo "Changing to configuration directory: $CONFIG..."
  227. cd "$CONFIG"
  228. echo "Adding configuration settings to gki_defconfig..."
  229. # Add SUSFS configuration settings
  230. echo "CONFIG_KSU=y" >> ./common/arch/arm64/configs/gki_defconfig
  231. echo "CONFIG_KSU_SUSFS=y" >> ./common/arch/arm64/configs/gki_defconfig
  232. echo "CONFIG_KSU_SUSFS_HAS_MAGIC_MOUNT=y" >> ./common/arch/arm64/configs/gki_defconfig
  233. echo "CONFIG_KSU_SUSFS_SUS_PATH=y" >> ./common/arch/arm64/configs/gki_defconfig
  234. echo "CONFIG_KSU_SUSFS_SUS_MOUNT=y" >> ./common/arch/arm64/configs/gki_defconfig
  235. echo "CONFIG_KSU_SUSFS_AUTO_ADD_SUS_KSU_DEFAULT_MOUNT=y" >> ./common/arch/arm64/configs/gki_defconfig
  236. echo "CONFIG_KSU_SUSFS_AUTO_ADD_SUS_BIND_MOUNT=y" >> ./common/arch/arm64/configs/gki_defconfig
  237. echo "CONFIG_KSU_SUSFS_SUS_KSTAT=y" >> ./common/arch/arm64/configs/gki_defconfig
  238. echo "CONFIG_KSU_SUSFS_SUS_OVERLAYFS=y" >> ./common/arch/arm64/configs/gki_defconfig
  239. echo "CONFIG_KSU_SUSFS_TRY_UMOUNT=y" >> ./common/arch/arm64/configs/gki_defconfig
  240. echo "CONFIG_KSU_SUSFS_AUTO_ADD_TRY_UMOUNT_FOR_BIND_MOUNT=y" >> ./common/arch/arm64/configs/gki_defconfig
  241. echo "CONFIG_KSU_SUSFS_SPOOF_UNAME=y" >> ./common/arch/arm64/configs/gki_defconfig
  242. echo "CONFIG_KSU_SUSFS_ENABLE_LOG=y" >> ./common/arch/arm64/configs/gki_defconfig
  243. echo "CONFIG_KSU_SUSFS_HIDE_KSU_SUSFS_SYMBOLS=y" >> ./common/arch/arm64/configs/gki_defconfig
  244. echo "CONFIG_KSU_SUSFS_SPOOF_CMDLINE_OR_BOOTCONFIG=y" >> ./common/arch/arm64/configs/gki_defconfig
  245. echo "CONFIG_KSU_SUSFS_OPEN_REDIRECT=y" >> ./common/arch/arm64/configs/gki_defconfig
  246. echo "CONFIG_KSU_SUSFS_SUS_SU=y" >> ./common/arch/arm64/configs/gki_defconfig
  247. # Add additional tmpfs config setting
  248. echo "CONFIG_TMPFS_XATTR=y" >> ./common/arch/arm64/configs/gki_defconfig
  249. # Remove check_defconfig
  250. sed -i 's/check_defconfig//' ./common/build.config.gki
  251. - name: Build the Kernel
  252. run: |
  253. echo "Changing to configuration directory: $CONFIG..."
  254. cd "$CONFIG"
  255. sed -i '$s|echo "\$res"|echo "\$res-Wild+"|' ./common/scripts/setlocalversion
  256. # Run perl command to modify UTS_VERSION
  257. 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
  258. echo "Building the kernel..."
  259. if [ -f "build/build.sh" ]; then
  260. sed -i 's/-dirty//' ./common/scripts/setlocalversion
  261. LTO=${{ inputs.lto_type }} BUILD_CONFIG=common/build.config.gki.aarch64 build/build.sh
  262. else
  263. rm -rf ./common/android/abi_gki_protected_exports_*
  264. sed -i "/stable_scmversion_cmd/s/-maybe-dirty//g" ./build/kernel/kleaf/impl/stamp.bzl
  265. tools/bazel build --config=fast --lto=${{ inputs.lto_type }} //common:kernel_aarch64_dist
  266. fi
  267. - name: Create Bootimgs Folder and Copy Images
  268. if: ${{ inputs.android_version == 'android12' || inputs.android_version == 'android13' }}
  269. run: |
  270. echo "Changing to configuration directory: $CONFIG..."
  271. mkdir bootimgs
  272. echo "Creating bootimgs folder and copying images..."
  273. cp ./$CONFIG/out/${{ inputs.android_version }}-${{ inputs.kernel_version }}/dist/Image ./bootimgs
  274. cp ./$CONFIG/out/${{ inputs.android_version }}-${{ inputs.kernel_version }}/dist/Image.lz4 ./bootimgs
  275. cp ./$CONFIG/out/${{ inputs.android_version }}-${{ inputs.kernel_version }}/dist/Image ./
  276. cp ./$CONFIG/out/${{ inputs.android_version }}-${{ inputs.kernel_version }}/dist/Image.lz4 ./
  277. # Create gzip of the Image file
  278. gzip -n -k -f -9 ./Image > ./Image.gz
  279. - name: Create Bootimgs Folder and Copy Images
  280. if: ${{ inputs.android_version == 'android14' || inputs.android_version == 'android15' }}
  281. run: |
  282. echo "Changing to configuration directory: $CONFIG..."
  283. mkdir bootimgs
  284. echo "Creating bootimgs folder and copying images..."
  285. cp ./$CONFIG/bazel-bin/common/kernel_aarch64/Image ./bootimgs
  286. cp ./$CONFIG/bazel-bin/common/kernel_aarch64/Image.lz4 ./bootimgs
  287. cp ./$CONFIG/bazel-bin/common/kernel_aarch64/Image ./
  288. cp ./$CONFIG/bazel-bin/common/kernel_aarch64/Image.lz4 ./
  289. # Create gzip of the Image file
  290. gzip -n -k -f -9 ./Image > ./Image.gz
  291. - name: Create ZIP Files for Different Formats
  292. run: |
  293. echo "Creating zip files for all formats..."
  294. cd ./AnyKernel3
  295. # Create and upload zip for each format
  296. ZIP_NAME="${{ inputs.android_version }}-${{ inputs.kernel_version }}.${{ inputs.sub_level }}-${{ inputs.os_patch_level }}-AnyKernel3.zip"
  297. echo "Creating zip file: $ZIP_NAME..."
  298. mv ../Image ./Image
  299. zip -r "../$ZIP_NAME" ./*
  300. rm ./Image
  301. ZIP_NAME="${{ inputs.android_version }}-${{ inputs.kernel_version }}.${{ inputs.sub_level }}-${{ inputs.os_patch_level }}-AnyKernel3-lz4.zip"
  302. echo "Creating zip file: $ZIP_NAME..."
  303. mv ../Image.lz4 ./Image.lz4
  304. zip -r "../$ZIP_NAME" ./*
  305. rm ./Image.lz4
  306. ZIP_NAME="${{ inputs.android_version }}-${{ inputs.kernel_version }}.${{ inputs.sub_level }}-${{ inputs.os_patch_level }}-AnyKernel3-gz.zip"
  307. echo "Creating zip file: $ZIP_NAME..."
  308. mv ../Image.gz ./Image.gz
  309. zip -r "../$ZIP_NAME" ./*
  310. rm ./Image.gz
  311. - name: Run Boot Image ${{ inputs.android_version }} Build Script
  312. if: ${{ inputs.android_version == 'android12' }}
  313. run: |
  314. echo "Changing to configuration directory: $CONFIG..."
  315. cd bootimgs
  316. GKI_URL=https://dl.google.com/android/gki/gki-certified-boot-android12-5.10-"${{ inputs.os_patch_level }}"_r1.zip
  317. FALLBACK_URL=https://dl.google.com/android/gki/gki-certified-boot-android12-5.10-2023-01_r1.zip
  318. # Check if the GKI URL is available
  319. echo "Checking if GKI kernel URL is reachable: $GKI_URL"
  320. status=$(curl -sL -w "%{http_code}" "$GKI_URL" -o /dev/null)
  321. if [ "$status" = "200" ]; then
  322. echo "[+] Downloading from GKI_URL"
  323. curl -Lo gki-kernel.zip "$GKI_URL"
  324. else
  325. echo "[+] $GKI_URL not found, using $FALLBACK_URL"
  326. curl -Lo gki-kernel.zip "$FALLBACK_URL"
  327. fi
  328. # Unzip the downloaded kernel and remove the zip
  329. echo "Unzipping the downloaded kernel..."
  330. unzip gki-kernel.zip && rm gki-kernel.zip
  331. echo "Unpacking boot.img..."
  332. FULL_PATH=$(pwd)/boot-5.10.img
  333. echo "Unpacking using: $FULL_PATH"
  334. echo "Running unpack_bootimg.py..."
  335. $UNPACK_BOOTIMG --boot_img="$FULL_PATH"
  336. echo "Building Image.gz"
  337. gzip -n -k -f -9 ./Image > ./Image.gz
  338. echo "Building boot.img"
  339. $MKBOOTIMG --header_version 4 --kernel Image --output boot.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.img --algorithm SHA256_RSA2048 --key $BOOT_SIGN_KEY_PATH
  341. cp ./boot.img ../${{ inputs.android_version }}-${{ inputs.kernel_version }}.${{ inputs.sub_level }}-${{ inputs.os_patch_level }}-boot.img
  342. echo "Building boot-gz.img"
  343. $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 }}"
  344. $AVBTOOL add_hash_footer --partition_name boot --partition_size $((64 * 1024 * 1024)) --image boot-gz.img --algorithm SHA256_RSA2048 --key $BOOT_SIGN_KEY_PATH
  345. cp ./boot-gz.img ../${{ inputs.android_version }}-${{ inputs.kernel_version }}.${{ inputs.sub_level }}-${{ inputs.os_patch_level }}-boot-gz.img
  346. echo "Building boot-lz4.img"
  347. $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 }}"
  348. $AVBTOOL add_hash_footer --partition_name boot --partition_size $((64 * 1024 * 1024)) --image boot-lz4.img --algorithm SHA256_RSA2048 --key $BOOT_SIGN_KEY_PATH
  349. cp ./boot-lz4.img ../${{ inputs.android_version }}-${{ inputs.kernel_version }}.${{ inputs.sub_level }}-${{ inputs.os_patch_level }}-boot-lz4.img
  350. - name: Run Boot Image ${{ inputs.android_version }} Build Script
  351. if: ${{ inputs.android_version == 'android13' || inputs.android_version == 'android14' || inputs.android_version == 'android15' }}
  352. run: |
  353. cd bootimgs
  354. echo "Building Image.gz"
  355. gzip -n -k -f -9 ./Image > ./Image.gz
  356. echo "Building boot.img"
  357. $MKBOOTIMG --header_version 4 --kernel Image --output boot.img
  358. $AVBTOOL add_hash_footer --partition_name boot --partition_size $((64 * 1024 * 1024)) --image boot.img --algorithm SHA256_RSA2048 --key $BOOT_SIGN_KEY_PATH
  359. cp ./boot.img ../${{ inputs.android_version }}-${{ inputs.kernel_version }}.${{ inputs.sub_level }}-${{ inputs.os_patch_level }}-boot.img
  360. echo "Building boot-gz.img"
  361. $MKBOOTIMG --header_version 4 --kernel Image.gz --output boot-gz.img
  362. $AVBTOOL add_hash_footer --partition_name boot --partition_size $((64 * 1024 * 1024)) --image boot-gz.img --algorithm SHA256_RSA2048 --key $BOOT_SIGN_KEY_PATH
  363. cp ./boot-gz.img ../${{ inputs.android_version }}-${{ inputs.kernel_version }}.${{ inputs.sub_level }}-${{ inputs.os_patch_level }}-boot-gz.img
  364. echo "Building boot-lz4.img"
  365. $MKBOOTIMG --header_version 4 --kernel Image.lz4 --output boot-lz4.img
  366. $AVBTOOL add_hash_footer --partition_name boot --partition_size $((64 * 1024 * 1024)) --image boot-lz4.img --algorithm SHA256_RSA2048 --key $BOOT_SIGN_KEY_PATH
  367. cp ./boot-lz4.img ../${{ inputs.android_version }}-${{ inputs.kernel_version }}.${{ inputs.sub_level }}-${{ inputs.os_patch_level }}-boot-lz4.img
  368. - name: Upload Build Artifacts
  369. uses: actions/upload-artifact@v4
  370. with:
  371. name: kernel-${{ env.CONFIG }}
  372. path: |
  373. *.zip
  374. *.img