• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2023 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("//build/templates/bpf/ohos_bpf_config.gni")
15
16_script = "//build/ohos/file_exists.py"
17_args = [
18  "--filename",
19  rebase_path(bpf_linux_kernel_dir, root_build_dir),
20  "--type",
21  "dir",
22]
23_result = exec_script(_script, _args, "string")
24if (_result == "False") {
25  bpf_linux_kernel_dir = "//kernel/linux-5.10-lts"
26  kernel_tools_dir = "${bpf_linux_kernel_dir}/tools/lib/bpf"
27}
28
29action("gen_bpf_uapi") {
30  kernel_dir = rebase_path(bpf_linux_kernel_dir, root_build_dir)
31  kernel_out_dir = rebase_path("${target_out_dir}/${bpf_inc_out_dir}")
32  kernel_tools_dir = rebase_path(kernel_tools_dir, root_build_dir)
33
34  script = "//build/templates/bpf/gen_bpf_uapi.py"
35  outputs = [ "${target_out_dir}/${target_name}.stamp" ]
36  args = [
37    "--kernel-dir",
38    kernel_dir,
39    "--kernel-out-dir",
40    kernel_out_dir,
41    "--target-cpu",
42    target_cpu,
43    "--kernel-tools-dir",
44    kernel_tools_dir,
45  ]
46}
47