blob: 2b603fc952188bc9595ed9d163f3d9fed0a31f40 [file] [log] [blame]
Maciej Żenczykowski40dfe532023-10-08 20:21:11 -07001//
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
Aditya Choudhary01b5ede2024-01-31 11:08:57 +000017package {
18 default_team: "trendy_team_fwk_core_networking",
19}
20
Maciej Żenczykowskie678f572024-02-28 11:58:49 -080021install_symlink {
22 name: "platform_ethtool_symlink",
23 symlink_target: "/apex/com.android.tethering/bin/ethtool",
24 // installed_location is relative to /system because that's the default partition for soong
25 // modules, unless we add something like `system_ext_specific: true` like in hwservicemanager.
26 installed_location: "bin/ethtool",
27}
28
Maciej Żenczykowskie0dd8692024-03-06 18:18:19 +000029install_symlink {
30 name: "platform_netbpfload_symlink",
31 symlink_target: "/apex/com.android.tethering/bin/netbpfload",
32 installed_location: "bin/netbpfload",
33 init_rc: ["netbpfload.rc"],
34}
35
Maciej Żenczykowskie678f572024-02-28 11:58:49 -080036phony {
37 name: "mainline_tethering_platform_components",
38 required: [
Maciej Żenczykowskie0dd8692024-03-06 18:18:19 +000039 "bpfloader",
Maciej Żenczykowskie678f572024-02-28 11:58:49 -080040 "platform_ethtool_symlink",
Maciej Żenczykowskie0dd8692024-03-06 18:18:19 +000041 "platform_netbpfload_symlink",
Maciej Żenczykowskie678f572024-02-28 11:58:49 -080042 ],
43}
44
Maciej Żenczykowski40dfe532023-10-08 20:21:11 -070045cc_binary {
46 name: "netbpfload",
47
48 defaults: ["bpf_defaults"],
49 cflags: [
50 "-Wall",
51 "-Werror",
52 "-Wthread-safety",
53 ],
54 sanitize: {
55 integer_overflow: true,
56 },
57
58 header_libs: ["bpf_headers"],
59 shared_libs: [
60 "libbase",
Maciej Żenczykowski40dfe532023-10-08 20:21:11 -070061 "liblog",
62 ],
63 srcs: [
64 "loader.cpp",
65 "NetBpfLoad.cpp",
66 ],
Maciej Żenczykowskia2a3d752023-10-10 15:24:13 -070067 apex_available: [
68 "com.android.tethering",
69 "//apex_available:platform",
70 ],
Maciej Żenczykowski03ef12c2024-02-10 21:34:22 +000071 // really should be Android 13/T (33), but we cannot include binaries built
Maciej Żenczykowskia2a3d752023-10-10 15:24:13 -070072 // against newer sdk in the apex, which still targets 30(R):
73 // module "netbpfload" variant "android_x86_apex30": should support
74 // min_sdk_version(30) for "com.android.tethering": newer SDK(34).
75 min_sdk_version: "30",
Maciej Żenczykowskie0dd8692024-03-06 18:18:19 +000076 installable: false,
Maciej Żenczykowski40dfe532023-10-08 20:21:11 -070077}
Maciej Żenczykowski041be522023-10-23 23:34:52 -070078
Maciej Żenczykowski03ef12c2024-02-10 21:34:22 +000079// Versioned netbpfload init rc: init system will process it only on api T/33+ devices
80// Note: R[30] S[31] Sv2[32] T[33] U[34] V[35])
Maciej Żenczykowski041be522023-10-23 23:34:52 -070081//
82// For details of versioned rc files see:
83// https://android.googlesource.com/platform/system/core/+/HEAD/init/README.md#versioned-rc-files-within-apexs
84prebuilt_etc {
85 name: "netbpfload.mainline.rc",
86 src: "netbpfload.mainline.rc",
Maciej Żenczykowski03ef12c2024-02-10 21:34:22 +000087 filename: "netbpfload.33rc",
Maciej Żenczykowski041be522023-10-23 23:34:52 -070088 installable: false,
89}