action.yml 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. name: 'Build Kernel'
  2. description: 'Builds kernel using legacy build.sh or Bazel (kleaf)'
  3. inputs:
  4. bypass:
  5. description: 'Whether to add the bypass hack or not'
  6. required: true
  7. version:
  8. description: 'Kernel config version (e.g., android14-6.1)'
  9. required: true
  10. runs:
  11. using: composite
  12. steps:
  13. - name: Setup Kernel Configs
  14. if: false
  15. uses: ./.github/actions/set-kernel-config
  16. - name: 'Build Kernel'
  17. shell: bash
  18. working-directory: ${{ github.workspace }}/kernel
  19. run: |
  20. sed -i 's/check_defconfig//' ./common/build.config.gki
  21. if [ -f "build/build.sh" ]; then
  22. BUILD_GKI_ARTIFACTS="" \
  23. BUILD_GKI_CERTIFICATION_TOOLS=0 \
  24. BUILD_SYSTEM_DLKM=0 \
  25. SKIP_VENDOR_BOOT=1 \
  26. SKIP_EXT_MODULES=1 \
  27. SKIP_CP_KERNEL_HDR=1 \
  28. OUT_DIR="/home/runner/out" \
  29. LTO=thin \
  30. BUILD_CONFIG=common/build.config.gki.aarch64 \
  31. build/build.sh -j"$(nproc)" \
  32. CC="/usr/bin/ccache clang" \
  33. CXX="/usr/bin/ccache clang+" \
  34. HOSTCC="/usr/bin/ccache clang" \
  35. HOSTCXX="/usr/bin/ccache clang+"
  36. else
  37. if [ "${{ inputs.bypass }}" = "false" ]; then
  38. sed -i '/name = "kernel_aarch64",/a\ check_defconfig = "disabled",' common/BUILD.bazel
  39. fi
  40. tools/bazel build \
  41. --config=fast \
  42. --config=stamp \
  43. --disk_cache=/home/runner/.cache/bazel \
  44. //common:kernel_aarch64/Image
  45. fi
  46. - name: 'Gather Build Artifacts'
  47. shell: bash
  48. working-directory: ${{ github.workspace }}/kernel
  49. run: |
  50. set -euo pipefail
  51. if [ -f "bazel-bin/common/kernel_aarch64/Image" ]; then
  52. echo "Found Image at bazel-bin/common/kernel_aarch64/Image"
  53. if [[ ${{ inputs.bypass }} == "true" ]]; then
  54. cp "bazel-bin/common/kernel_aarch64/Image" "${{ github.workspace }}/AnyKernel3/Bypass-Image"
  55. else
  56. cp "bazel-bin/common/kernel_aarch64/Image" "${{ github.workspace }}/AnyKernel3/Image"
  57. fi
  58. exit 0
  59. fi
  60. if [ -f "/home/runner/out/dist/Image" ]; then
  61. echo "Found Image at /home/runner/out/dist/Image"
  62. if [[ ${{ inputs.bypass }} == "true" ]]; then
  63. cp "/home/runner/out/dist/Image" "${{ github.workspace }}/AnyKernel3/Bypass-Image"
  64. else
  65. cp "/home/runner/out/dist/Image" "${{ github.workspace }}/AnyKernel3/Image"
  66. fi
  67. exit 0
  68. fi
  69. exit 1
  70. - name: 'Patch AnyKernel3 for Bypass Hack'
  71. shell: bash
  72. if: inputs.bypass == 'true'
  73. working-directory: ${{ github.workspace }}/AnyKernel3
  74. run: |
  75. set -euo pipefail
  76. cp ${{ github.action_path }}/patches/bypass.patch "${{ github.workspace }}/AnyKernel3/bypass.patch"
  77. patch -p1 < bypass.patch