android_packages_modules_Co.../bpf/loader/Android.bp
Motomu Utsumi 5a3103ba1e NetBpfLoad: use libbpf based on mainline beta flag
This CL did not change the binary and library size

Before this CL
"""
$adb shell ls -l /apex/com.android.tethering/bin/netbpfload
-rwxr-x--- 1 root root 102744 1970-01-01 09:00 /apex/com.android.tethering/bin/netbpfload
$adb shell ls -1 /apex/com.android.tethering/lib64 | wc -l
21
"""

After this CL
"""
$adb shell ls -l /apex/com.android.tethering/bin/netbpfload
-rwxr-x--- 1 root root 102744 1970-01-01 09:00 /apex/com.android.tethering/bin/netbpfload
$adb shell ls -1 /apex/com.android.tethering/lib64 | wc -l
21
"""

Flag: com.android.tethering.readonly.flags.use_libbpf
Bug: 428792764
Test: Enable/Disable flag, boot, adb shell logcat
Change-Id: Ie8d94ab00d8b32f5062265c6b9696feb77a0f0b1
2025-08-22 22:46:24 +09:00

94 lines
2.9 KiB
Text

//
// Copyright (C) 2023 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
package {
default_team: "trendy_team_fwk_core_networking",
}
install_symlink {
name: "mainline_tethering_platform_components",
symlink_target: "/apex/com.android.tethering/bin/ethtool",
// installed_location is relative to /system because that's the default partition for soong
// modules, unless we add something like `system_ext_specific: true` like in hwservicemanager.
installed_location: "bin/ethtool",
init_rc: ["netbpfload.rc"],
required: ["bpfloader"],
}
cc_binary {
name: "netbpfload",
defaults: ["bpf_cc_defaults"],
sanitize: {
integer_overflow: true,
},
header_libs: [
"bpf_headers",
"bpf_prog_mainline_headers",
],
shared_libs: [
"libbase",
"liblog",
"libbpf",
],
static_libs: [
"libtetheringflags",
],
srcs: ["NetBpfLoad.cpp"],
apex_available: [
"com.android.tethering",
"//apex_available:platform",
],
// really should be Android 12/S (31), but we cannot include binaries built
// against newer sdk in the apex, which still targets 30(R):
// module "netbpfload" variant "android_x86_apex30": should support
// min_sdk_version(30) for "com.android.tethering": newer SDK(34).
min_sdk_version: "30",
installable: false,
}
// Versioned netbpfload init rc: init system will process it only on api R/30 S/31 Sv2/32 devices
// Note: R[30] S[31] Sv2[32] T[33] U[34] V[35])
//
// For details of versioned rc files see:
// https://android.googlesource.com/platform/system/core/+/HEAD/init/README.md#versioned-rc-files-within-apexs
//
// However, .Xrc versioning doesn't work on S, so we use unversioned, and thus *do* trigger on R,
// luckily nothing ever uses the new service on R, so you can think of it as being S/Sv2 only
prebuilt_etc {
name: "netbpfload.31rc",
src: "netbpfload.31rc",
filename: "netbpfload.rc", // intentional: .31rc wouldn't take effect on S
installable: false,
}
// Versioned netbpfload init rc: init system will process it only on api T/33+ devices
prebuilt_etc {
name: "netbpfload.33rc",
src: "netbpfload.33rc",
filename: "netbpfload.33rc",
installable: false,
}
prebuilt_etc {
name: "netbpfload.35rc",
src: "netbpfload.35rc",
filename: "netbpfload.35rc",
installable: false,
}