Loading bpf/bpf.go +47 −5 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ import ( "strings" "android/soong/android" _ "android/soong/cc/config" "github.com/google/blueprint" "github.com/google/blueprint/proptools" Loading Loading @@ -75,6 +74,9 @@ type BpfProperties struct { Sub_dir string // If set to true, generate BTF debug info for maps & programs Btf *bool Vendor *bool VendorInternal bool `blueprint:"mutated"` } type bpf struct { Loading @@ -85,6 +87,41 @@ type bpf struct { objs android.Paths } var _ android.ImageInterface = (*bpf)(nil) func (bpf *bpf) ImageMutatorBegin(ctx android.BaseModuleContext) {} func (bpf *bpf) CoreVariantNeeded(ctx android.BaseModuleContext) bool { return !proptools.Bool(bpf.properties.Vendor) } func (bpf *bpf) RamdiskVariantNeeded(ctx android.BaseModuleContext) bool { return false } func (bpf *bpf) VendorRamdiskVariantNeeded(ctx android.BaseModuleContext) bool { return false } func (bpf *bpf) DebugRamdiskVariantNeeded(ctx android.BaseModuleContext) bool { return false } func (bpf *bpf) RecoveryVariantNeeded(ctx android.BaseModuleContext) bool { return false } func (bpf *bpf) ExtraImageVariations(ctx android.BaseModuleContext) []string { if proptools.Bool(bpf.properties.Vendor) { return []string{"vendor"} } return nil } func (bpf *bpf) SetImageVariation(ctx android.BaseModuleContext, variation string, module android.Module) { bpf.properties.VendorInternal = variation == "vendor" } func (bpf *bpf) GenerateAndroidBuildActions(ctx android.ModuleContext) { cflags := []string{ "-nostdlibinc", Loading Loading @@ -154,7 +191,12 @@ func (bpf *bpf) AndroidMk() android.AndroidMkData { fmt.Fprintln(w) fmt.Fprintln(w, "LOCAL_PATH :=", moduleDir) fmt.Fprintln(w) localModulePath := "LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/bpf" var localModulePath string if bpf.properties.VendorInternal { localModulePath = "LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC)/bpf" } else { localModulePath = "LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/bpf" } if len(bpf.properties.Sub_dir) > 0 { localModulePath += "/" + bpf.properties.Sub_dir } Loading Loading
bpf/bpf.go +47 −5 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ import ( "strings" "android/soong/android" _ "android/soong/cc/config" "github.com/google/blueprint" "github.com/google/blueprint/proptools" Loading Loading @@ -75,6 +74,9 @@ type BpfProperties struct { Sub_dir string // If set to true, generate BTF debug info for maps & programs Btf *bool Vendor *bool VendorInternal bool `blueprint:"mutated"` } type bpf struct { Loading @@ -85,6 +87,41 @@ type bpf struct { objs android.Paths } var _ android.ImageInterface = (*bpf)(nil) func (bpf *bpf) ImageMutatorBegin(ctx android.BaseModuleContext) {} func (bpf *bpf) CoreVariantNeeded(ctx android.BaseModuleContext) bool { return !proptools.Bool(bpf.properties.Vendor) } func (bpf *bpf) RamdiskVariantNeeded(ctx android.BaseModuleContext) bool { return false } func (bpf *bpf) VendorRamdiskVariantNeeded(ctx android.BaseModuleContext) bool { return false } func (bpf *bpf) DebugRamdiskVariantNeeded(ctx android.BaseModuleContext) bool { return false } func (bpf *bpf) RecoveryVariantNeeded(ctx android.BaseModuleContext) bool { return false } func (bpf *bpf) ExtraImageVariations(ctx android.BaseModuleContext) []string { if proptools.Bool(bpf.properties.Vendor) { return []string{"vendor"} } return nil } func (bpf *bpf) SetImageVariation(ctx android.BaseModuleContext, variation string, module android.Module) { bpf.properties.VendorInternal = variation == "vendor" } func (bpf *bpf) GenerateAndroidBuildActions(ctx android.ModuleContext) { cflags := []string{ "-nostdlibinc", Loading Loading @@ -154,7 +191,12 @@ func (bpf *bpf) AndroidMk() android.AndroidMkData { fmt.Fprintln(w) fmt.Fprintln(w, "LOCAL_PATH :=", moduleDir) fmt.Fprintln(w) localModulePath := "LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/bpf" var localModulePath string if bpf.properties.VendorInternal { localModulePath = "LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_ETC)/bpf" } else { localModulePath = "LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/bpf" } if len(bpf.properties.Sub_dir) > 0 { localModulePath += "/" + bpf.properties.Sub_dir } Loading