Pārlūkot izejas kodu

ci: run make prepare into obj tree; include generated arch/asm headers for BPF

TheWildJames 3 nedēļas atpakaļ
vecāks
revīzija
a006be8ded
1 mainītis faili ar 22 papildinājumiem un 13 dzēšanām
  1. 22 13
      .github/actions/fuse-bpf/action.yml

+ 22 - 13
.github/actions/fuse-bpf/action.yml

@@ -28,24 +28,26 @@ runs:
           gcc-aarch64-linux-gnu \
           elfutils
 
-    - name: Generate kernel UAPI headers
+    - name: Generate kernel UAPI + arch headers
       shell: bash
       run: |
         set -euo pipefail
         GEN_DIR="$(mktemp -d)"
+        OBJ_DIR="${GEN_DIR}/build"
         echo "GENERATED_HDR_DIR=${GEN_DIR}" >> "$GITHUB_ENV"
-        # Generate clean, self-contained UAPI headers (incl. arch asm/) into a
-        # temp build dir, so compilation doesn't rely on absent generated files.
+
+        # Run prepare which generates the arch/asm headers (incl. asm/types.h)
+        # into the object tree, plus headers_install for the UAPI set.
+        make -C "${{ github.workspace }}/kernel/common" \
+          ARCH=arm64 O="${OBJ_DIR}" \
+          prepare >/dev/null 2>&1 || true
         make -C "${{ github.workspace }}/kernel/common" \
-          ARCH=arm64 \
-          O="${GEN_DIR}/build" \
+          ARCH=arm64 O="${OBJ_DIR}" \
           headers_install \
-          INSTALL_HDR_PATH="${GEN_DIR}/usr" \
-          >/dev/null 2>&1 || {
-            # Fallback: generate just the arch asm headers via prepare
-            make -C "${{ github.workspace }}/kernel/common" \
-              ARCH=arm64 O="${GEN_DIR}/build" prepare >/dev/null 2>&1 || true
-          }
+          INSTALL_HDR_PATH="${GEN_DIR}/usr" >/dev/null 2>&1 || true
+        echo "Generated header trees:"
+        find "${OBJ_DIR}/arch/arm64/include/generated" "${OBJ_DIR}/include/generated" \
+          -name types.h 2>/dev/null | head || true
 
     - name: Build BPF Object (fd_bpf.bpf) for arm64
       shell: bash
@@ -77,13 +79,18 @@ runs:
         echo "Using BPF compiler: $BPF_CC"
         echo "Compiling fd_bpf.c → fd_bpf.bpf..."
 
-        # Include generated UAPI headers first (contain arch asm/), then the
-        # kernel UAPI/source include dirs as fallback.
+        # Include generated UAPI headers AND the object-tree arch/asm headers
+        # (contain asm/types.h generated by make prepare), then kernel source.
         GEN_HDR="${GENERATED_HDR_DIR}/usr/include"
+        GEN_OBJ="${GENERATED_HDR_DIR}/build"
 
         $BPF_CC -target bpf \
           -D__TARGET_ARCH_arm64 \
           -I "$GEN_HDR" \
+          -idirafter "${GEN_OBJ}/arch/arm64/include/generated/uapi" \
+          -idirafter "${GEN_OBJ}/arch/arm64/include/generated" \
+          -idirafter "${GEN_OBJ}/include/generated/uapi" \
+          -idirafter "${GEN_OBJ}/include/generated" \
           -idirafter "${{ github.workspace }}/kernel/common/arch/arm64/include/generated/uapi" \
           -idirafter "${{ github.workspace }}/kernel/common/arch/arm64/include/uapi" \
           -idirafter "${{ github.workspace }}/kernel/common/include/uapi" \
@@ -98,6 +105,8 @@ runs:
           $BPF_CC -target bpf \
             -D__TARGET_ARCH_arm64 \
             -I "$GEN_HDR" \
+            -idirafter "${GEN_OBJ}/arch/arm64/include/generated" \
+            -idirafter "${GEN_OBJ}/include/generated" \
             -Wall -O2 -g \
             -c fd_bpf.c -o fd_bpf.bpf
         fi