From 655664e3cd5056b0bb51afc16693d0c425d6af58 Mon Sep 17 00:00:00 2001 From: Kalesh Singh Date: Tue, 3 Jun 2025 21:19:00 -0700 Subject: [PATCH] Add 6.12 vmlinux.h genrules Generate vmlinux.h from the kernel prebuilt vmlinux Bug: 421990777 Test: Manual; build bpf prog with "vmlinux_h_6_12" header Change-Id: I5647a3c2d7d1695aa42fd9636dd7f7abd4a1dc44 Signed-off-by: Kalesh Singh --- include/vmlinux/Android.bp | 61 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 include/vmlinux/Android.bp diff --git a/include/vmlinux/Android.bp b/include/vmlinux/Android.bp new file mode 100644 index 0000000..91db501 --- /dev/null +++ b/include/vmlinux/Android.bp @@ -0,0 +1,61 @@ +// Copyright (C) 2025 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +genrule { + name: "vmlinux_h_6_12_arm64", + cmd: "mkdir -p $(genDir)/6.12/arm64 && $(location bpftool) btf dump file $(location :vmlinux_6_12_arm64) format c > $(genDir)/6.12/arm64/vmlinux.h", + srcs: [ + ":vmlinux_6_12_arm64", + ], + tools: ["bpftool"], + out: [ + "6.12/arm64/vmlinux.h", + ], + export_include_dirs: ["6.12/arm64"], +} + +genrule { + name: "vmlinux_h_6_12_x86_64", + cmd: "mkdir -p $(genDir)/6.12/x86_64 && $(location bpftool) btf dump file $(location :vmlinux_6_12_x86_64) format c > $(genDir)/6.12/x86_64/vmlinux.h", + srcs: [ + ":vmlinux_6_12_x86_64", + ], + tools: ["bpftool"], + out: [ + "6.12/x86_64/vmlinux.h", + ], + export_include_dirs: ["6.12/x86_64"], +} + +cc_library_headers { + name: "vmlinux_h_6_12", + arch: { + arm: { + generated_headers: ["vmlinux_h_6_12_arm64"], + export_generated_headers: ["vmlinux_h_6_12_arm64"], + }, + arm64: { + generated_headers: ["vmlinux_h_6_12_arm64"], + export_generated_headers: ["vmlinux_h_6_12_arm64"], + }, + x86: { + generated_headers: ["vmlinux_h_6_12_x86_64"], + export_generated_headers: ["vmlinux_h_6_12_x86_64"], + }, + x86_64: { + generated_headers: ["vmlinux_h_6_12_x86_64"], + export_generated_headers: ["vmlinux_h_6_12_x86_64"], + }, + }, +}