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/ohos/kernel/kernel.gni")
15
16declare_args() {
17  if (current_cpu == "arm") {
18    bpf_arch = "arm"
19  } else if (current_cpu == "arm64") {
20    bpf_arch = "aarch64"
21  } else if (current_cpu == "x86_64" || current_cpu == "x64") {
22    bpf_arch = "x86_64"
23  } else if (current_cpu == "mipsel") {
24    bpf_arch = "mipsel"
25  } else if (current_cpu == "riscv64") {
26    bpf_arch = "riscv64"
27  } else if (current_cpu == "loongarch64") {
28    bpf_arch = "loongarch64"
29  }
30}
31
32declare_args() {
33  if ((defined(target_os) && target_os == "ohos") ||
34      (defined(ohos_kernel_type) && ohos_kernel_type == "linux")) {
35    bpf_target_os = "linux"
36    bpf_target_triple = "${bpf_arch}-linux-ohos"
37  } else if (defined(ohos_kernel_type) && ohos_kernel_type == "liteos_a") {
38    bpf_target_os = "liteos_a"
39    bpf_target_triple = "arm-liteos-ohos"
40  }
41}
42
43declare_args() {
44  bpf_inc_out_dir = bpf_target_triple
45  bpf_linux_kernel_dir = "//kernel/linux/${linux_kernel_version}"
46}
47
48declare_args() {
49  kernel_tools_dir = "${bpf_linux_kernel_dir}/tools/lib/bpf"
50}
51