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_cc_defaults"],
37    sanitize: {
38        integer_overflow: true,
39    },
40
41    header_libs: ["bpf_headers"],
42    shared_libs: [
43        "libbase",
44        "liblog",
45    ],
46    srcs: ["NetBpfLoad.cpp"],
47    apex_available: [
48        "com.android.tethering",
49        "//apex_available:platform",
50    ],
51    // really should be Android 13/T (33), but we cannot include binaries built
52    // against newer sdk in the apex, which still targets 30(R):
53    // module "netbpfload" variant "android_x86_apex30": should support
54    // min_sdk_version(30) for "com.android.tethering": newer SDK(34).
55    min_sdk_version: "30",
56    installable: false,
57}
58
59// Versioned netbpfload init rc: init system will process it only on api T/33+ devices
60// Note: R[30] S[31] Sv2[32] T[33] U[34] V[35])
61//
62// For details of versioned rc files see:
63// https://android.googlesource.com/platform/system/core/+/HEAD/init/README.md#versioned-rc-files-within-apexs
64prebuilt_etc {
65    name: "netbpfload.33rc",
66    src: "netbpfload.33rc",
67    filename: "netbpfload.33rc",
68    installable: false,
69}
70
71prebuilt_etc {
72    name: "netbpfload.35rc",
73    src: "netbpfload.35rc",
74    filename: "netbpfload.35rc",
75    installable: false,
76}
77