summaryrefslogtreecommitdiff
path: root/bpf/bpf.go
AgeCommit message (Collapse)Author
2025-02-19Change depVisitor to use providers instead of type-asserting to Yu Liu
interfaces directly, the next step is to change it to use ModuleProxy once IsDepInSameApex is ready. Bug: 377723687 Test: Unit tests and compare the ninja and mk files generated. Change-Id: I13a4e256a26dbf7f9b3b746d628ac8f68b4e598e
2024-12-18Remove source_file_provider.go after it's last usage was removed. Yu Liu
Bug: 377723687 Test: Unit tests and compare the ninja and mk files generated. Change-Id: Iff10448dc4dda49e1f02258a4c113db75778a95d
2024-10-21Make ImageInterface use its own context Cole Faust
In a followup cl, the ImageInterface will be queried during incoming transitions, which have a more limited context. Make a dedicated ImageInterfaceContext so we can have more control about what functions we expose. Bug: 372091092 Test: m nothing --no-skip-soong-tests Change-Id: Idb320352433cda4b0467226599295056ec47025d
2024-08-30Soong: BPF: add defaults support and local include Neill Kapron
Add support for defaults clause in the bpf soong module, as well as local_include_dirs property. Test: TH Change-Id: Iaa03e7f1f6dcf0e929d1d5b23bb79ca2a8366bef Signed-off-by: Neill Kapron <nkapron@google.com>
2024-08-21bpf.go: adjust for p/m/C change to location of bpf headers Maciej Żenczykowski
Test: TreeHugger Signed-off-by: Maciej Żenczykowski <maze@google.com> Change-Id: Id08dba160d2296581d6b41ade3e464b9bfe74540
2024-07-30Soong: BPF: Cflag and btf defaults Neill Kapron
Currently, all bpf programs require a cflags field which defines -Wall and -Werror. This change enables this by default, and also enables -Wextra. This removes boilerplate required for every bpf program, and improves code quality. Additionally, this change enables the default of 'btf: true' further reducing the boilerplate required for most bpf programs in their Android.bp file. BTF should be enabled by default, with only limited mainlined bpf programs requiring BTF being disabled for compatibility with older bpfloader releases. Test: Treehugger Change-Id: I8efd0f63115030d40c0ff7fe81d5345ff3436e5a Signed-off-by: Neill Kapron <nkapron@google.com>
2024-06-21Move vendor and product variant generation logic from cc package to android ↵ Jihoon Kang
package Although image variation generation logic has moved out of cc package to the android package, the vendor and product partition variants generation logic is still specific to cc package. Therefore, in order to create a product or vendor variant, they have to specified in `ExtraImageVariants`. In order to avoid such confusing behaviors and enforce modules to specify product and vendor installation rules, this change moves the vendor and product variant generation logic to android.ImageInterface. Test: m nothing --no-skip-soong-tests && diff contents of out/soong/Android-{product}.mk Change-Id: I9e14f3739d9dea94167ee6a91e92b2f942055aba
2024-06-13Cleanup ImageInterface.SetImageVariation Jihoon Kang
This change modifies the interface method of ImageInterface.SetImageVariation so that the image variation is set directly at the caller image variation module, instead of passing the pointer to set the image variation. Test: m nothing Change-Id: I8eadb5149365530243e19a8cd37eb49d335fbeef
2024-06-04Use OutputFilesProvider on bpf mrziwang
This changes makes bpf module type uses OutputFilesProvider, instead of current OutputFileProducer for inter-module- communication. Test: CI Bug: 339477385 Bug: 342406930 Change-Id: I85d1141e9f6583cc5427756107da99f56b0c7ea1
2024-02-16bpf modules can be included in filesystem modules Jiyong Park
Bug: 322246536 Test: go test ./... Change-Id: I5f29258e45475b30cdb26014c2db147182ec52fa
2024-01-24Propagate AconfigFiles in ModuleBase. LaMont Jones
Aconfig file dependencies are module-independent, and properly part of ModuleBase. Bug: b/308625757 Test: manual Change-Id: I38c5907d1671cc69bb198345201316ae781fdc9f
2023-12-14Convert SetProvider to generic providers API Colin Cross
Convert all of the callers of SetProvider to use the type-safe android.SetProvider API. Bug: 316410648 Test: builds Change-Id: If58f4b5355264ddab2045bc3591a4eac19cd58fc
2023-12-08Remove ConvertWithBp2build implementations Colin Cross
Remove the ConvertWithBp2build implementations from all the module types, along with the related code. Bug: 315353489 Test: m blueprint_tests Change-Id: I212672286686a318893bc7348ddd5a5ec51e77a7
2023-12-05Add source file provider for genrule/srcs, python libraries and rust libraries. Aditya Choudhary
Change-Id: I2d7d4684a10c15aeecc27b8db800ab27a807d2e2
2023-11-21Don't write license data to Android-${TARGET_PRODUCT}.mk Colin Cross
All the necessary license data is already propagated through the license metadata file, and the entries in Android-${TARGET_PRODUCT}.mk are not used. Remove them, which should both reduce the size and parsing cost of the Android-${TARGET_PRODUCT}.mk file and also removes a variable that changes when dependencies are added or removed, which will eventually allow running kati less often. Bug: 309006256 Test: No change to out/Android-aosp_cf_x86_64_phone.ninja Change-Id: Idfeb6fd10d77497ca274f8e74fe8e994ce1cafe6
2023-09-22Merge "Remove unused file path" into main Motomu Utsumi
2023-09-21Remove unused file path Motomu Utsumi
frameworks/libs/net was moved to the packages/modules/Connectivity Bug: 296014682 Test: TH Change-Id: I1c17eb0cb4a2d6d2526b26fd800f206e93d4e009
2023-09-20Have ConvertWBp2build use Bp2buildMutatorContext Chris Parsons
This no-op refactoring facilitates some upcoming functional changes for "bp2build allowlist v2". The work requires that the bp2build conversion mutator be changed from a TopDown mutator to a BottomUp mutator. Refactoring all bp2build-related methods so that they use Bp2buildMutatorContext makes it easier to make this functional change without touching tens of files and multiple projects. Bug: 285631638 Test: m bp2build Change-Id: I3d1ef3064146e959c6f0dc315350fc9764bf2bd2
2023-08-22Add package/modules/Connectivity bpf_headers path Motomu Utsumi
Following CLs will move frameworks/libs/net to packages/modules/Connectivity. This CL is a preparation for that. Bug: 296014682 Test: m Change-Id: Ie6483d1e5dfbf6c4745c10d3bb031344368c8c8f
2022-12-12Streamline AndroidMk generation Sasha Smundak
Add AndroidMkEmitAssignList to emit a line to assign the items from the given list of string arrays. Test: treehugger Change-Id: Id5acbef38ea4e91349bd2461f226db352d4b8123
2022-12-01Show module type in a module section of the Android-TARGET.mk Sasha Smundak
The first line of each section will be ``` include $(CLEAR_VARS) # <module type> ... ``` Bug: 257037252 Test: treehugger Change-Id: Iba586155b682fe4e1e5817d8397eda8f9d9c8789
2022-11-10bpf: use PwdPrefix() helper Connor O'Brien
relPwd is only set if runtime.GOOS != "darwin" but is used unconditionally. Instead, unconditionally set relPwd using the cc.PwdPrefix() helper. Bug: 238165437 Test: m timeInState.o Signed-off-by: Connor O'Brien <connoro@google.com> Change-Id: I5294bb6ea95dad60fbf64e9d958e1f1b32a02a48
2022-11-10Merge "bpf: use relative source file path in debug info" Connor O'Brien
2022-11-10bpf: use relative source file path in debug info Connor O'Brien
Enabling BTF leads clang to generate debug line info that includes the absolute path to the source file. For C++ modules the -fdebug-prefix-map flag is used to convert these to relative paths. Do the same for BPF programs when BTF is enabled. Test: build timeInState.c; strings shows only relative path to source file Bug: 238165437 Signed-off-by: Connor O'Brien <connoro@google.com> Change-Id: Ie4ebc8f9a7d115baeddde5c7ac3ae710335ddf13
2022-10-07Incorporate bpf into mixed builds Zi Wang
Bug: 240163393 Test: TestBpfWithBazel in bpf_test.go Change-Id: I1d24a9c0d1d6911987c730bf1b5b7e02d6e73a5e
2022-09-28Add bp2build converter for bpf Zi Wang
Bug: 240163393 Test: m bp2build Test: bp2build/bpf_conversion_test.go Change-Id: Ie3bbc64511146b099a766d7e8b56e93cef58ef68
2022-08-12Add comments to bpf properties Zi Wang
Bug: 240141438 Test: m soong_docs Change-Id: I86388391da9b6f30f0f3745490641e918d68c046
2022-07-07Disallow '_' in bpf source name Ken Chen
Current design: 1. The bpf compiled object name is derived from the source name (e.g. foo.c -> foo.o). 2. Full bpf program/map name are concatenated by object name + '_' + program/map name in run-time. (e.g. obj name: x.o; program name: y_z; full bpf program name will be x_y_z) Issue: x.o with map y_z and x_y.o with map z can cause naming collision in run-time, since both result in x_y_z. This commit prevents it from happening with a build-time check. Bug: 236706995 Test: m Change-Id: Ic03bfcf07a5748ed63246b71d5ae8de0405e658a
2022-02-09bpf: support installing to vendor Steven Moreland
Bug: 140330870 Test: use bpf{} to install bpf program to vendor and have it successfully loaded and installed by Android's bpfloader. Change-Id: If0aac3098e39498f0238516ec839b6ac910cc61e
2022-01-27Add option to generate BTF debug info for bpf programs Connor O'Brien
Add "btf" option that generates BTF debug info to support easier map inspection. This is accomplished by passing the "-g" flag to clang when compiling the BPF program. The "-g" option also generates a number of DWARF debug sections which are not necessary for loading BTF information, so strip these to avoid increasing file size unnecessarily. bpfloader currently only supports BTF info for maps, not programs, so we also strip the .BTF.ext section containing program BTF info. Bug: 203823368 Test: libbpf_load_test Test: verify time_in_state.o includes .BTF section iff "btf: true" is set Test: verify time_in_state.o still loads if BTF is enabled Change-Id: Ica25b253bace59d04130b0210350188399889bbe Signed-off-by: Connor O'Brien <connoro@google.com>
2022-01-19Merge "[NETD-BPF#34] Add a tag for bpf to specify the install folder" Treehugger Robot
2022-01-19[NETD-BPF#34] Add a tag for bpf to specify the install folder Ken Chen
Currently, the bpf module netd.o (source system/netd/bpf_progs/netd.c) will be built to /system/etc/bpf/netd.o. In Android T, it will be moved to mainline module com.android.tethering. The expected behavior is: - In T device, it uses the netd.o in mainline module. - In pre-T devices, it uses the original netd, built from platform. However, netd.o will be double loaded if the tethering module is installed in Pre-T devices. Because: 1. bpf in apex is packed into /apex/MAINLINE_MODULE/etc/bpf/ 2. bpf in platform is packed into /system/etc/bpf/ 3. bpfloader in pre-T loads ANY bpf modules under /apex/com.android.tethering/etc/bpf/ and /system/etc/bpf/. We can't change the behavior of bpfloader in pre-T devices. We can't delete the /system/etc/bpf/netd.o from pre-T devices. Both of them are not mainline modules. So the mainlined netd.o needs to be packed into a folder other than /apex/com.android.tethering/etc/bpf/ or /system/etc/bpf/. This commit adds a tag 'sub_dir' for bpf module. The installation path of bpf modules will be: - /system/etc/bpf/SUB_DIR/ (for platform code) - /apex/MAINLINE_MODULE/etc/bpf/SUB_DIR/ (for mainline module) Bug: 202086915 Test: add test in apex_test.go and build Change-Id: Icc6619768ab006de9f86620a7df1bb2853eaba13
2021-12-23Remove global bpf include path system/bpf/progs/include Ken Chen
Delete it because there is only one user left (system/bpfprogs/time_in_state.c). It can be specified locally. Bug: 202086915 Test: build and boot Change-Id: I1cb0ceb7b8e3fb63af34e11e5fece11fa038b24e
2021-12-23[NETD-BPF#21] Move a few headers to frameworks/libs/net Ken Chen
BPF headers used by both platform and mainline modules should be in frameworks/libs/net. Bug: 202086915 Test: build and boot Test: cd packages/modules/Connectivity/netd; atest Change-Id: I5a86ccd44a673a18138201f186b104f5214fd449
2021-03-09Support test fixtures in bpf package Paul Duffin
Restructures the bpf package test setup code to create FixturePreparer instances for setting up a test fixture and converts the test to use it. Bug: 181070625 Test: m nothing Change-Id: I7c76ed6dc292ca92d76ef95c4167f7ca2d68e1af
2021-01-06Revert^2 "Export soong license data to make." Bob Badour
61a55a03440313461c0fd2805834e69c3131d483 Change-Id: I5fb017c683df18bad42a8e27fb2d7c7c510514e5
2021-01-06Revert "Export soong license data to make." Jerome Gaillard
Revert submission 1377717-metalics Reason for revert: This has broken renderscript_mac target for aosp-master, see b/176909442 Reverted Changes: I26ac54ca9:Define the standard license_kind rules. I656486070:Export soong license data to make. If9d661dfc:Export soong license data to make. I97943de53:Add ability to declare licenses in soong. Icaff40171:Rough-in license metadata support to make. Ib8e538bd0:Add variables for notice deps, license kinds etc. Change-Id: I51799c94a274eadab414abd80a07b5cda4584be9
2021-01-05Export soong license data to make. Bob Badour
See: http://go/android-license-checking-in-soong-v2-design Bug: 151953481 Bug: 151177513 Bug: 67772237 Change-Id: If9d661dfcaa732c459d38d8ad7ec4a0e540846b8
2020-09-02Include bpf program in APEXes markchien
bpf program is put to an APEX via 'bpfs' property. It is placed under etc/bpf directory in it. Fix: 167530625 Test: m Change-Id: Ia36b486f0cffb619ecc4f7a318cde881abc5baf4
2020-03-25Add no-canonical-prefixes to make sure paths in .d file are relative paths Kousik Kumar
Test: Ran "m out/soong/.intermediates/system/netd/bpf_progs/clatd.o/android_common/obj/system/netd/bpf_progs/clatd.o" and verified that the output .d file did NOT contain absolute paths. Change-Id: I2d187638eb7a6db8de057b83312cba3116985ac8
2020-02-18bpf progs depend on system/core/libcutils/include Maciej Żenczykowski
Test: build, atest Bug: 149434314 Signed-off-by: Maciej Żenczykowski <maze@google.com> Change-Id: I070bc147abe43556d66082e19c16214ae6a9f94b
2020-01-28Add support for experimentally enabling RBE support on specific rules. Ramy Medhat
This CL adds RBE support to javac, r8, and d8 rules which is only enabled if respective environment variables are set. Test: an aosp_crosshatch build with and without the new variables. Change-Id: Ic82f3627944f6a5ee7b9f3228170c2709b1bfcb8
2019-11-05Run non-RBE supported actions in the local pool when USE_RBE is set. Ramy Medhat
Bug: 143938974 Test: ran CTS build at -j500 successfully. Change-Id: I55074bd67308cd716972e24fb56a20bc393d5d9d
2019-06-04Support tagged module references Colin Cross
There are cases where a module needs to refer to an intermediate output of another module instead of its final output. For example, a module may want to use the .jar containing .class files from another module whose final output is a .jar containing classes.dex files. Support a new ":module{.tag}" format in any property that is annotated with `android:"path"`, which will query the target module for its ".tag" output(s). Test: path_properties_test.go, paths_test.go Test: no unexpected changes in build.ninja Change-Id: Icd3c9b0d83ff125771767c04046fcffb9fc3f65a
2019-05-17Add bpf_test.go to build and fix tests Colin Cross
bpf_test.go was not listed in testSrcs, which meant it was not run during the build, but ran and failed with go test android/soong/... Don't redeclare the cc module types and mutators, use exported functions from cc/testing.go instead, which contain a new dependency needed by cc modules. This reapplies I4542640e8ff08e71565ed50617dbe67d86b29b69 after fixes for mac tests. Test: m Test: go test android/soong/... Change-Id: I3dc3fdedbd7063df4a2e0cadf2a4e0711b1823ad
2019-04-10Fix relative path of bpf modules Colin Cross
Using bpf as test data installs the module into a strange subdirectory, clear the Rel() value before exporting it as a SourceFileProducer. Bug: 130206035 Test: m vts_test_binary_bpf_module Change-Id: Ifdae90d11b15d65c097562d7d6985a8a1dca2bfd
2019-03-20Replace ctx.ExpandSources with android.PathsForModuleSrc Colin Cross
Move the logic from ctx.ExpandSources into android.PathsForModuleSrc and ctx.ExpandSource into android.PathForModuleSrc, and deprecate them. When combined with the pathDepsMutator this will let all properties that take source paths also take filegroups or genrule outputs, as long as they are tagged with `android:"path"`. Test: All soong tests Change-Id: I01625e76b5da19240e9649bf26a014eeeafcab8f
2019-03-07Annotate paths and deprecate ExtractSource(s)Deps Colin Cross
Add `android:"path"` to all properties that take paths to source files, and remove the calls to ExtractSource(s)Deps, the pathsDepsMutator will add the necessary SourceDepTag dependency. Test: All soong tests Change-Id: I488ba1a5d680aaa50b04fc38acf693e23c6d4d6d
2019-02-12Add common BPF helper to include path Joel Fernandes (Google)
All BPF programs need helper header files. These end up being duplicated. Let us add a path to the common BPF helper to the search path so that it can be used across projects. No functional change to the final system image, only a build change. Bug: 122665156 Change-Id: Ieee838df98258213efa24d74a12e069f056c66c1 Signed-off-by: Joel Fernandes <joelaf@google.com>
2018-12-17Make bpf implement SourceFileProducer. Jaewoong Jung
This allows other modules depend on bpf object outputs via the data property. Bug: 120246361 Test: bpf_test.go Change-Id: I2ba9b9fea4d60f896d16f34053eb04513eae30ea