Merge "Remove linkerconfig prop to linker_config" into main
diff --git a/android/module.go b/android/module.go
index 58ae885..3b30c11 100644
--- a/android/module.go
+++ b/android/module.go
@@ -1382,6 +1382,8 @@
if config.SystemExtPath() == "system_ext" {
partition = "system_ext"
}
+ } else if m.InstallInRamdisk() {
+ partition = "ramdisk"
}
return partition
}
diff --git a/android/variable.go b/android/variable.go
index c6a1b0a..89d90c2 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -606,10 +606,20 @@
BoardExt4ShareDupBlocks string `json:",omitempty"`
BoardFlashLogicalBlockSize string `json:",omitempty"`
BoardFlashEraseBlockSize string `json:",omitempty"`
- BoardUsesRecoveryAsBoot bool `json:",omitempty"`
ProductUseDynamicPartitionSize bool `json:",omitempty"`
CopyImagesForTargetFilesZip bool `json:",omitempty"`
+ // Boot image stuff
+ ProductBuildBootImage bool `json:",omitempty"`
+ ProductBuildInitBootImage bool `json:",omitempty"`
+ BoardUsesRecoveryAsBoot bool `json:",omitempty"`
+ BoardPrebuiltBootimage string `json:",omitempty"`
+ BoardPrebuiltInitBootimage string `json:",omitempty"`
+ BoardBootimagePartitionSize string `json:",omitempty"`
+ BoardInitBootimagePartitionSize string `json:",omitempty"`
+ BoardBootHeaderVersion string `json:",omitempty"`
+
+ // Avb (android verified boot) stuff
BoardAvbEnable bool `json:",omitempty"`
BoardAvbAlgorithm string `json:",omitempty"`
BoardAvbKeyPath string `json:",omitempty"`
diff --git a/apex/apex.go b/apex/apex.go
index a1879f5..04b5a07 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -105,11 +105,10 @@
Rros []string
// List of bootclasspath fragments that are embedded inside this APEX bundle.
- Bootclasspath_fragments []string
+ Bootclasspath_fragments proptools.Configurable[[]string]
// List of systemserverclasspath fragments that are embedded inside this APEX bundle.
- Systemserverclasspath_fragments proptools.Configurable[[]string]
- ResolvedSystemserverclasspathFragments []string `blueprint:"mutated"`
+ Systemserverclasspath_fragments proptools.Configurable[[]string]
// List of java libraries that are embedded inside this APEX bundle.
Java_libs []string
@@ -891,13 +890,11 @@
}
}
- a.properties.ResolvedSystemserverclasspathFragments = a.properties.Systemserverclasspath_fragments.GetOrDefault(ctx, nil)
-
// Common-arch dependencies come next
commonVariation := ctx.Config().AndroidCommonTarget.Variations()
ctx.AddFarVariationDependencies(commonVariation, rroTag, a.properties.Rros...)
- ctx.AddFarVariationDependencies(commonVariation, bcpfTag, a.properties.Bootclasspath_fragments...)
- ctx.AddFarVariationDependencies(commonVariation, sscpfTag, a.properties.ResolvedSystemserverclasspathFragments...)
+ ctx.AddFarVariationDependencies(commonVariation, bcpfTag, a.properties.Bootclasspath_fragments.GetOrDefault(ctx, nil)...)
+ ctx.AddFarVariationDependencies(commonVariation, sscpfTag, a.properties.Systemserverclasspath_fragments.GetOrDefault(ctx, nil)...)
ctx.AddFarVariationDependencies(commonVariation, javaLibTag, a.properties.Java_libs...)
ctx.AddFarVariationDependencies(commonVariation, fsTag, a.properties.Filesystems...)
ctx.AddFarVariationDependencies(commonVariation, compatConfigTag, a.properties.Compat_configs...)
@@ -2776,8 +2773,8 @@
// Collect information for opening IDE project files in java/jdeps.go.
func (a *apexBundle) IDEInfo(ctx android.BaseModuleContext, dpInfo *android.IdeInfo) {
dpInfo.Deps = append(dpInfo.Deps, a.properties.Java_libs...)
- dpInfo.Deps = append(dpInfo.Deps, a.properties.Bootclasspath_fragments...)
- dpInfo.Deps = append(dpInfo.Deps, a.properties.ResolvedSystemserverclasspathFragments...)
+ dpInfo.Deps = append(dpInfo.Deps, a.properties.Bootclasspath_fragments.GetOrDefault(ctx, nil)...)
+ dpInfo.Deps = append(dpInfo.Deps, a.properties.Systemserverclasspath_fragments.GetOrDefault(ctx, nil)...)
}
func init() {
diff --git a/cc/cc.go b/cc/cc.go
index 60cf011..08a93cb9 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -1560,12 +1560,11 @@
}
if ctx.ctx.Device() {
- config := ctx.ctx.Config()
- if ctx.inVendor() {
- // If building for vendor with final API, then use the latest _stable_ API as "current".
- if config.VendorApiLevelFrozen() && (ver == "" || ver == "current") {
- ver = config.PlatformSdkVersion().String()
- }
+ // When building for vendor/product, use the latest _stable_ API as "current".
+ // This is passed to clang/aidl compilers so that compiled/generated code works
+ // with the system.
+ if (ctx.inVendor() || ctx.inProduct()) && (ver == "" || ver == "current") {
+ ver = ctx.ctx.Config().PlatformSdkVersion().String()
}
}
diff --git a/cc/cc_test.go b/cc/cc_test.go
index 989b043..144b90b 100644
--- a/cc/cc_test.go
+++ b/cc/cc_test.go
@@ -1008,7 +1008,7 @@
android.AssertArrayString(t, "variants for llndk stubs", expected, actual)
params := result.ModuleForTests("libllndk", "android_vendor_arm_armv7-a-neon_shared").Description("generate stub")
- android.AssertSame(t, "use Vendor API level for default stubs", "202404", params.Args["apiLevel"])
+ android.AssertSame(t, "use Vendor API level for default stubs", "999999", params.Args["apiLevel"])
checkExportedIncludeDirs := func(module, variant string, expectedSystemDirs []string, expectedDirs ...string) {
t.Helper()
@@ -3153,7 +3153,7 @@
testDepWithVariant("product")
}
-func TestVendorSdkVersion(t *testing.T) {
+func TestVendorOrProductVariantUsesPlatformSdkVersionAsDefault(t *testing.T) {
t.Parallel()
bp := `
@@ -3161,31 +3161,29 @@
name: "libfoo",
srcs: ["libfoo.cc"],
vendor_available: true,
+ product_available: true,
}
cc_library {
name: "libbar",
srcs: ["libbar.cc"],
vendor_available: true,
+ product_available: true,
min_sdk_version: "29",
}
`
ctx := prepareForCcTest.RunTestWithBp(t, bp)
- testSdkVersionFlag := func(module, version string) {
- flags := ctx.ModuleForTests(module, "android_vendor_arm64_armv8-a_static").Rule("cc").Args["cFlags"]
- android.AssertStringDoesContain(t, "min sdk version", flags, "-target aarch64-linux-android"+version)
+ testSdkVersionFlag := func(module, variant, version string) {
+ flags := ctx.ModuleForTests(module, "android_"+variant+"_arm64_armv8-a_static").Rule("cc").Args["cFlags"]
+ android.AssertStringDoesContain(t, "target SDK version", flags, "-target aarch64-linux-android"+version)
}
- testSdkVersionFlag("libfoo", "10000")
- testSdkVersionFlag("libbar", "29")
-
- ctx = android.GroupFixturePreparers(
- prepareForCcTest,
- android.PrepareForTestWithBuildFlag("RELEASE_BOARD_API_LEVEL_FROZEN", "true"),
- ).RunTestWithBp(t, bp)
- testSdkVersionFlag("libfoo", "30")
- testSdkVersionFlag("libbar", "29")
+ testSdkVersionFlag("libfoo", "vendor", "30")
+ testSdkVersionFlag("libfoo", "product", "30")
+ // target SDK version can be set explicitly with min_sdk_version
+ testSdkVersionFlag("libbar", "vendor", "29")
+ testSdkVersionFlag("libbar", "product", "29")
}
func TestClangVerify(t *testing.T) {
diff --git a/cc/compdb.go b/cc/compdb.go
index b33f490..4132e09 100644
--- a/cc/compdb.go
+++ b/cc/compdb.go
@@ -146,6 +146,8 @@
isAsm = false
isCpp = true
clangPath = cxxPath
+ case ".o":
+ return nil
default:
log.Print("Unknown file extension " + src.Ext() + " on file " + src.String())
isAsm = true
@@ -185,6 +187,10 @@
}
for _, src := range srcs {
if _, ok := builds[src.String()]; !ok {
+ args := getArguments(src, ctx, ccModule, ccPath, cxxPath)
+ if args == nil {
+ continue
+ }
builds[src.String()] = compDbEntry{
Directory: android.AbsSrcDirForExistingUseCases(),
Arguments: getArguments(src, ctx, ccModule, ccPath, cxxPath),
diff --git a/cc/library.go b/cc/library.go
index 7dffa72..4ce506e 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -566,16 +566,10 @@
func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) Objects {
if ctx.IsLlndk() {
- vendorApiLevel := ctx.Config().VendorApiLevel()
- if vendorApiLevel == "" {
- // TODO(b/321892570): Some tests relying on old fixtures which
- // doesn't set vendorApiLevel. Needs to fix them.
- vendorApiLevel = ctx.Config().PlatformSdkVersion().String()
- }
- // This is the vendor variant of an LLNDK library, build the LLNDK stubs.
+ futureVendorApiLevel := android.ApiLevelOrPanic(ctx, "999999")
nativeAbiResult := parseNativeAbiDefinition(ctx,
String(library.Properties.Llndk.Symbol_file),
- android.ApiLevelOrPanic(ctx, vendorApiLevel), "--llndk")
+ futureVendorApiLevel, "--llndk")
objs := compileStubLibrary(ctx, flags, nativeAbiResult.stubSrc)
if !Bool(library.Properties.Llndk.Unversioned) {
library.versionScriptPath = android.OptionalPathForPath(
diff --git a/cmd/symbols_map/symbols_map_proto/symbols_map.proto b/cmd/symbols_map/symbols_map_proto/symbols_map.proto
index 693fe3e..a76d171 100644
--- a/cmd/symbols_map/symbols_map_proto/symbols_map.proto
+++ b/cmd/symbols_map/symbols_map_proto/symbols_map.proto
@@ -37,6 +37,21 @@
// type is the type of the mapping, either ELF or R8.
optional Type type = 3;
+
+ // LocationType is the place where to look for the file with the given
+ // identifier.
+ Enum LocationType {
+ // ZIP denotes the file with the given identifier is in the distribuited
+ // symbols.zip or proguard_dict.zip files, or the local disc.
+ ZIP = 0;
+ // AB denotes the file with the given identifier is in the AB artifacts but
+ // not in a symbols.zip or proguard_dict.zip.
+ AB = 1;
+ }
+
+ // location_type is the Location Type that dictates where to search for the
+ // file with the given identifier. Defaults to ZIP if not present.
+ optional LocationType location_type = 4;
}
message Mappings {
diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go
index ec6360a..78e24e2 100644
--- a/filesystem/filesystem.go
+++ b/filesystem/filesystem.go
@@ -292,10 +292,14 @@
func (f *filesystem) FilterPackagingSpec(ps android.PackagingSpec) bool {
// Filesystem module respects the installation semantic. A PackagingSpec from a module with
// IsSkipInstall() is skipped.
- if proptools.Bool(f.properties.Is_auto_generated) { // TODO (spandandas): Remove this.
- return !ps.SkipInstall() && (ps.Partition() == f.PartitionType())
+ if ps.SkipInstall() {
+ return false
}
- return !ps.SkipInstall()
+ if proptools.Bool(f.properties.Is_auto_generated) { // TODO (spandandas): Remove this.
+ pt := f.PartitionType()
+ return pt == "ramdisk" || ps.Partition() == pt
+ }
+ return true
}
var pctx = android.NewPackageContext("android/soong/filesystem")
@@ -664,6 +668,7 @@
"vendor_dlkm",
"odm_dlkm",
"system_dlkm",
+ "ramdisk",
}
func (f *filesystem) addMakeBuiltFiles(ctx android.ModuleContext, builder *android.RuleBuilder, rootDir android.Path) {
diff --git a/fsgen/filesystem_creator.go b/fsgen/filesystem_creator.go
index 31cc5f3..0a65c6c 100644
--- a/fsgen/filesystem_creator.go
+++ b/fsgen/filesystem_creator.go
@@ -267,6 +267,7 @@
Vendor_dlkm_specific *bool
Odm_dlkm_specific *bool
Load_by_default *bool
+ Blocklist_file *string
}{
Name: proptools.StringPtr(name),
}
@@ -279,15 +280,24 @@
// https://source.corp.google.com/h/googleplex-android/platform/build/+/ef55daac9954896161b26db4f3ef1781b5a5694c:core/Makefile;l=695-700;drc=549fe2a5162548bd8b47867d35f907eb22332023;bpv=1;bpt=0
props.Load_by_default = proptools.BoolPtr(false)
}
+ if blocklistFile := ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse.SystemKernelBlocklistFile; blocklistFile != "" {
+ props.Blocklist_file = proptools.StringPtr(blocklistFile)
+ }
case "vendor_dlkm":
props.Srcs = ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse.VendorKernelModules
if len(ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse.SystemKernelModules) > 0 {
props.System_deps = []string{":" + generatedModuleName(ctx.Config(), "system_dlkm-kernel-modules") + "{.modules}"}
}
props.Vendor_dlkm_specific = proptools.BoolPtr(true)
+ if blocklistFile := ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse.VendorKernelBlocklistFile; blocklistFile != "" {
+ props.Blocklist_file = proptools.StringPtr(blocklistFile)
+ }
case "odm_dlkm":
props.Srcs = ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse.OdmKernelModules
props.Odm_dlkm_specific = proptools.BoolPtr(true)
+ if blocklistFile := ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse.OdmKernelBlocklistFile; blocklistFile != "" {
+ props.Blocklist_file = proptools.StringPtr(blocklistFile)
+ }
default:
ctx.ModuleErrorf("DLKM is not supported for %s\n", partitionType)
}
@@ -411,13 +421,20 @@
fsProps := &filesystem.FilesystemProperties{}
partitionVars := ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse
- specificPartitionVars := partitionVars.PartitionQualifiedVariables[partitionType]
-
- // BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE
- fsType := specificPartitionVars.BoardFileSystemType
+ var specificPartitionVars android.PartitionQualifiedVariablesType
+ var boardAvbEnable bool
+ var fsType string
+ if strings.Contains(partitionType, "ramdisk") {
+ fsType = "compressed_cpio"
+ } else {
+ specificPartitionVars = partitionVars.PartitionQualifiedVariables[partitionType]
+ boardAvbEnable = partitionVars.BoardAvbEnable
+ fsType = specificPartitionVars.BoardFileSystemType
+ }
if fsType == "" {
fsType = "ext4" //default
}
+
fsProps.Type = proptools.StringPtr(fsType)
if filesystem.GetFsTypeFromString(ctx, *fsProps.Type).IsUnknown() {
// Currently the android_filesystem module type only supports a handful of FS types like ext4, erofs
@@ -429,7 +446,7 @@
fsProps.Unchecked_module = proptools.BoolPtr(true)
// BOARD_AVB_ENABLE
- fsProps.Use_avb = proptools.BoolPtr(partitionVars.BoardAvbEnable)
+ fsProps.Use_avb = proptools.BoolPtr(boardAvbEnable)
// BOARD_AVB_KEY_PATH
fsProps.Avb_private_key = proptools.StringPtr(specificPartitionVars.BoardAvbKeyPath)
// BOARD_AVB_ALGORITHM
diff --git a/fsgen/fsgen_mutators.go b/fsgen/fsgen_mutators.go
index 4440c63..b6ba6c4 100644
--- a/fsgen/fsgen_mutators.go
+++ b/fsgen/fsgen_mutators.go
@@ -80,7 +80,7 @@
}
func generatedPartitions(ctx android.LoadHookContext) []string {
- generatedPartitions := []string{"system"}
+ generatedPartitions := []string{"system", "ramdisk"}
if ctx.DeviceConfig().SystemExtPath() == "system_ext" {
generatedPartitions = append(generatedPartitions, "system_ext")
}
@@ -171,6 +171,7 @@
"fs_config_files_odm_dlkm": defaultDepCandidateProps(ctx.Config()),
"odm_dlkm-build.prop": defaultDepCandidateProps(ctx.Config()),
},
+ "ramdisk": {},
},
fsDepsMutex: sync.Mutex{},
moduleToInstallationProps: map[string]installationProperties{},
@@ -205,29 +206,31 @@
}
func collectDepsMutator(mctx android.BottomUpMutatorContext) {
+ m := mctx.Module()
+ if m.Target().Os.Class != android.Device {
+ return
+ }
fsGenState := mctx.Config().Get(fsGenStateOnceKey).(*FsGenState)
- m := mctx.Module()
- if m.Target().Os.Class == android.Device && slices.Contains(fsGenState.depCandidates, mctx.ModuleName()) {
+ fsGenState.fsDepsMutex.Lock()
+ defer fsGenState.fsDepsMutex.Unlock()
+
+ if slices.Contains(fsGenState.depCandidates, mctx.ModuleName()) {
installPartition := m.PartitionTag(mctx.DeviceConfig())
- fsGenState.fsDepsMutex.Lock()
// Only add the module as dependency when:
// - its enabled
// - its namespace is included in PRODUCT_SOONG_NAMESPACES
if m.Enabled(mctx) && m.ExportedToMake() {
appendDepIfAppropriate(mctx, fsGenState.fsDeps[installPartition], installPartition)
}
- fsGenState.fsDepsMutex.Unlock()
}
// store the map of module to (required,overrides) even if the module is not in PRODUCT_PACKAGES.
// the module might be installed transitively.
- if m.Target().Os.Class == android.Device && m.Enabled(mctx) && m.ExportedToMake() {
- fsGenState.fsDepsMutex.Lock()
+ if m.Enabled(mctx) && m.ExportedToMake() {
fsGenState.moduleToInstallationProps[m.Name()] = installationProperties{
Required: m.RequiredModuleNames(mctx),
Overrides: m.Overrides(),
}
- fsGenState.fsDepsMutex.Unlock()
}
}
diff --git a/fsgen/vbmeta_partitions.go b/fsgen/vbmeta_partitions.go
index 280e405..f7b4638 100644
--- a/fsgen/vbmeta_partitions.go
+++ b/fsgen/vbmeta_partitions.go
@@ -156,6 +156,10 @@
// Already handled by a chained vbmeta partition
continue
}
+ if partitionType == "ramdisk" {
+ // ramdisk is never signed with avb information
+ continue
+ }
partitionModules = append(partitionModules, generatedModuleNameForPartition(ctx.Config(), partitionType))
}
diff --git a/kernel/prebuilt_kernel_modules.go b/kernel/prebuilt_kernel_modules.go
index 78a463f..13d6482 100644
--- a/kernel/prebuilt_kernel_modules.go
+++ b/kernel/prebuilt_kernel_modules.go
@@ -56,6 +56,8 @@
// This feature is used by system_dlkm
Load_by_default *bool
+ Blocklist_file *string `android:"path"`
+
// Kernel version that these modules are for. Kernel modules are installed to
// /lib/modules/<kernel_version> directory in the corresponding partition. Default is "".
Kernel_version *string
@@ -109,10 +111,25 @@
ctx.InstallFile(installDir, "modules.dep", depmodOut.modulesDep)
ctx.InstallFile(installDir, "modules.softdep", depmodOut.modulesSoftdep)
ctx.InstallFile(installDir, "modules.alias", depmodOut.modulesAlias)
+ pkm.installBlocklistFile(ctx, installDir)
ctx.SetOutputFiles(modules, ".modules")
}
+func (pkm *prebuiltKernelModules) installBlocklistFile(ctx android.ModuleContext, installDir android.InstallPath) {
+ if pkm.properties.Blocklist_file == nil {
+ return
+ }
+ blocklistOut := android.PathForModuleOut(ctx, "modules.blocklist")
+
+ ctx.Build(pctx, android.BuildParams{
+ Rule: processBlocklistFile,
+ Input: android.PathForModuleSrc(ctx, proptools.String(pkm.properties.Blocklist_file)),
+ Output: blocklistOut,
+ })
+ ctx.InstallFile(installDir, "modules.blocklist", blocklistOut)
+}
+
var (
pctx = android.NewPackageContext("android/soong/kernel")
@@ -159,6 +176,19 @@
Command: `sed -e 's|\([^: ]*lib/modules/[^: ]*\)|/\1|g' $in > $out`,
},
)
+ // Remove empty lines. Raise an exception if line is _not_ formatted as `blocklist $name.ko`
+ processBlocklistFile = pctx.AndroidStaticRule("process_blocklist_file",
+ blueprint.RuleParams{
+ Command: `rm -rf $out && awk <$in > $out` +
+ ` '/^#/ { print; next }` +
+ ` NF == 0 { next }` +
+ ` NF != 2 || $$1 != "blocklist"` +
+ ` { print "Invalid blocklist line " FNR ": " $$0 >"/dev/stderr";` +
+ ` exit_status = 1; next }` +
+ ` { $$1 = $$1; print }` +
+ ` END { exit exit_status }'`,
+ },
+ )
)
// This is the path in soong intermediates where the .ko files will be copied.