action.yml 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. name: 'Kernel Fixes'
  2. description: 'Applies compatibility fixes based on android/kernel/sublevel'
  3. inputs:
  4. android_version:
  5. required: true
  6. type: string
  7. kernel_version:
  8. required: true
  9. type: string
  10. sublevel:
  11. required: true
  12. type: string
  13. os_patch_level:
  14. required: true
  15. type: string
  16. runs:
  17. using: composite
  18. steps:
  19. - shell: bash
  20. run: |
  21. set -euo pipefail
  22. ANDROID_VERSION="${{ inputs.android_version }}"
  23. KERNEL_VERSION="${{ inputs.kernel_version }}"
  24. SUBLEVEL="${{ inputs.sublevel }}"
  25. OS_PATCH_LEVEL="${{ inputs.os_patch_level }}"
  26. if { [[ "$ANDROID_VERSION" == "android13" && "$KERNEL_VERSION" == "5.10" && "$SUBLEVEL" -le 186 ]] || \
  27. [[ "$ANDROID_VERSION" == "android13" && "$KERNEL_VERSION" == "5.15" && "$SUBLEVEL" -le 119 ]] || \
  28. [[ "$ANDROID_VERSION" == "android14" && "$KERNEL_VERSION" == "5.15" && "$SUBLEVEL" -le 110 ]] || \
  29. [[ "$ANDROID_VERSION" == "android14" && "$KERNEL_VERSION" == "6.1" && "$SUBLEVEL" -le 43 ]]; }; then
  30. GLIBC_VERSION="$(ldd --version 2>/dev/null | head -n 1 | awk '{print $NF}')"
  31. if [ "$(printf '%s\n' "2.38" "$GLIBC_VERSION" | sort -V | head -n 1)" = "2.38" ]; then
  32. cd "$GITHUB_WORKSPACE/kernel/common"
  33. sed -i '/\$(Q)\$(MAKE) -C \$(SUBCMD_SRC) OUTPUT=\$(abspath \$(dir \$@))\/ \$(abspath \$@)/s//$(Q)$(MAKE) -C $(SUBCMD_SRC) EXTRA_CFLAGS="$(CFLAGS)" OUTPUT=$(abspath $(dir $@))\/ $(abspath $@)/' tools/bpf/resolve_btfids/Makefile 2>/dev/null || true
  34. if { [[ "$ANDROID_VERSION" == "android13" && "$KERNEL_VERSION" == "5.10" && "$SUBLEVEL" -le 186 ]] || \
  35. [[ "$ANDROID_VERSION" == "android13" && "$KERNEL_VERSION" == "5.15" && "$SUBLEVEL" -le 119 ]] || \
  36. [[ "$ANDROID_VERSION" == "android14" && "$KERNEL_VERSION" == "5.15" && "$SUBLEVEL" -le 110 ]]; }; then
  37. sed -i '/char \*buf = NULL;/a int i;' tools/lib/subcmd/parse-options.c 2>/dev/null || true
  38. sed -i 's/for (int i = 0; subcommands\[i\]; i++) {/for (i = 0; subcommands[i]; i++) {/' tools/lib/subcmd/parse-options.c 2>/dev/null || true
  39. sed -i '/if (subcommands) {/a int i;' tools/lib/subcmd/parse-options.c 2>/dev/null || true
  40. sed -i 's/for (int i = 0; subcommands\[i\]; i++)/for (i = 0; subcommands[i]; i++)/' tools/lib/subcmd/parse-options.c 2>/dev/null || true
  41. fi
  42. fi
  43. fi
  44. if [ "$ANDROID_VERSION" = "android15" ] && [ "$KERNEL_VERSION" = "6.6" ]; then
  45. cd "$GITHUB_WORKSPACE/kernel/common"
  46. if ! grep -qxF '#include <trace/hooks/fs.h>' ./fs/namespace.c; then
  47. sed -i '/#include <trace\/hooks\/blk.h>/a #include <trace\/hooks\/fs.h>' ./fs/namespace.c
  48. fi
  49. fi
  50. - shell: bash
  51. if: ${{ inputs.kernel_version == '5.10' && inputs.android_version == 'android12' && inputs.sublevel == 226 }}
  52. working-directory: ${{ github.workspace }}/kernel/common
  53. run: |
  54. sed -i 's/\s*vm_flags_clear(new_vma, VM_PAD_MASK);/ new_vma->vm_flags \&= ~VM_PAD_MASK;/' mm/mmap.c