action.yml 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. name: Apply Kernel Bypass Hack
  2. description: >
  3. Patches the kernel version-check path (bad_version) to return 1 instead of 0,
  4. allowing kernels that would otherwise reject the build to boot.
  5. Disabled by default; enable by passing bypass: true at the workflow level.
  6. inputs:
  7. bypass:
  8. description: 'Whether to apply the bypass hack'
  9. required: false
  10. type: boolean
  11. default: false
  12. version:
  13. description: 'Kernel config version (e.g., android14-6.1)'
  14. required: true
  15. runs:
  16. using: composite
  17. steps:
  18. - name: Activate Bypass
  19. if: ${{ inputs.bypass == 'true' }}
  20. shell: bash
  21. working-directory: ${{ github.workspace }}/kernel
  22. run: |
  23. set -euo pipefail
  24. if [[ "${{ inputs.version }}" == "android14-6.1" \
  25. || "${{ inputs.version }}" == "android15-6.6" \
  26. || "${{ inputs.version }}" == "android16-6.12" ]]; then
  27. TARGET_FILE="${{ github.workspace }}/kernel/common/kernel/module/version.c"
  28. else
  29. TARGET_FILE="${{ github.workspace }}/kernel/common/kernel/module.c"
  30. fi
  31. sed -i '/bad_version:/{:a;n;/return 0;/{s/return 0;/return 1;/;b};ba}' "$TARGET_FILE"
  32. if ! grep -A 5 "bad_version:" "$TARGET_FILE" | grep -q "return 1;"; then
  33. echo "Patch failed! 'return 1;' not found at bad_version:" >&2
  34. grep -A 10 "bad_version:" "$TARGET_FILE" || true
  35. exit 1
  36. fi
  37. echo "Bypass hack applied to $TARGET_FILE"