1//
2// Copyright (C) 2023 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8//      http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
17package {
18    default_team: "trendy_team_fwk_core_networking",
19}
20
21install_symlink {
22    name: "mainline_tethering_platform_components",
23
24    symlink_target: "/apex/com.android.tethering/bin/ethtool",
25    // installed_location is relative to /system because that's the default partition for soong
26    // modules, unless we add something like `system_ext_specific: true` like in hwservicemanager.
27    installed_location: "bin/ethtool",
28
29    init_rc: ["netbpfload.rc"],
30    required: ["bpfloader"],
31}
32
33cc_binary {
34    name: "netbpfload",
35
36    defaults: ["bpf_defaults"],
37    cflags: [
38        "-Wall",
39        "-Werror",
40        "-Wthread-safety",
41    ],
42    sanitize: {
43        integer_overflow: true,
44    },
45
46    header_libs: ["bpf_headers"],
47    shared_libs: [
48        "libbase",
49        "liblog",
50    ],
51    srcs: [
52        "loader.cpp",
53        "NetBpfLoad.cpp",
54    ],
55    apex_available: [
56        "com.android.tethering",
57        "//apex_available:platform",
58    ],
59    // really should be Android 13/T (33), but we cannot include binaries built
60    // against newer sdk in the apex, which still targets 30(R):
61    // module "netbpfload" variant "android_x86_apex30": should support
62    // min_sdk_version(30) for "com.android.tethering": newer SDK(34).
63    min_sdk_version: "30",
64    installable: false,
65}
66
67// Versioned netbpfload init rc: init system will process it only on api T/33+ devices
68// Note: R[30] S[31] Sv2[32] T[33] U[34] V[35])
69//
70// For details of versioned rc files see:
71// https://android.googlesource.com/platform/system/core/+/HEAD/init/README.md#versioned-rc-files-within-apexs
72prebuilt_etc {
73    name: "netbpfload.33rc",
74    src: "netbpfload.33rc",
75    filename: "netbpfload.33rc",
76    installable: false,
77}
78
79prebuilt_etc {
80    name: "netbpfload.35rc",
81    src: "netbpfload.35rc",
82    filename: "netbpfload.35rc",
83    installable: false,
84}
85