Add vendor-ramdisk image to Soong.
Add vendor_ramdisk_available and vendor_ramdisk attribute to
various rules. When a vendor_ramdisk variant of a module is
generated, it is installed to $OUT/vendor-ramdisk.
It is similar to a ramdisk image.
Test: m nothing -j
Change-Id: Ib2d16459f3094dbe21c3bdb7c016cb4b2bf62765
diff --git a/android/arch.go b/android/arch.go
index 616cead..98ff07a 100644
--- a/android/arch.go
+++ b/android/arch.go
@@ -914,8 +914,8 @@
osTargets = targets
}
- // only the primary arch in the ramdisk / recovery partition
- if os == Android && (module.InstallInRecovery() || module.InstallInRamdisk()) {
+ // only the primary arch in the ramdisk / vendor_ramdisk / recovery partition
+ if os == Android && (module.InstallInRecovery() || module.InstallInRamdisk() || module.InstallInVendorRamdisk()) {
osTargets = []Target{osTargets[0]}
}
diff --git a/android/image.go b/android/image.go
index 061bfa5..1a1a423 100644
--- a/android/image.go
+++ b/android/image.go
@@ -26,6 +26,10 @@
// ramdisk partition).
RamdiskVariantNeeded(ctx BaseModuleContext) bool
+ // VendorRamdiskVariantNeeded should return true if the module needs a vendor ramdisk variant (installed on the
+ // vendor ramdisk partition).
+ VendorRamdiskVariantNeeded(ctx BaseModuleContext) bool
+
// RecoveryVariantNeeded should return true if the module needs a recovery variant (installed on the
// recovery partition).
RecoveryVariantNeeded(ctx BaseModuleContext) bool
@@ -53,6 +57,9 @@
// RamdiskVariation means a module to be installed to ramdisk image.
RamdiskVariation string = "ramdisk"
+
+ // VendorRamdiskVariation means a module to be installed to vendor ramdisk image.
+ VendorRamdiskVariation string = "vendor_ramdisk"
)
// imageMutator creates variants for modules that implement the ImageInterface that
@@ -73,6 +80,9 @@
if m.RamdiskVariantNeeded(ctx) {
variations = append(variations, RamdiskVariation)
}
+ if m.VendorRamdiskVariantNeeded(ctx) {
+ variations = append(variations, VendorRamdiskVariation)
+ }
if m.RecoveryVariantNeeded(ctx) {
variations = append(variations, RecoveryVariation)
}
diff --git a/android/module.go b/android/module.go
index 70a343e..d677406 100644
--- a/android/module.go
+++ b/android/module.go
@@ -348,6 +348,7 @@
InstallInTestcases() bool
InstallInSanitizerDir() bool
InstallInRamdisk() bool
+ InstallInVendorRamdisk() bool
InstallInRecovery() bool
InstallInRoot() bool
InstallBypassMake() bool
@@ -403,6 +404,7 @@
InstallInTestcases() bool
InstallInSanitizerDir() bool
InstallInRamdisk() bool
+ InstallInVendorRamdisk() bool
InstallInRecovery() bool
InstallInRoot() bool
InstallBypassMake() bool
@@ -623,6 +625,9 @@
// Whether this module is installed to ramdisk
Ramdisk *bool
+ // Whether this module is installed to vendor ramdisk
+ Vendor_ramdisk *bool
+
// Whether this module is built for non-native architecures (also known as native bridge binary)
Native_bridge_supported *bool `android:"arch_variant"`
@@ -1274,6 +1279,10 @@
return Bool(m.commonProperties.Ramdisk)
}
+func (m *ModuleBase) InstallInVendorRamdisk() bool {
+ return Bool(m.commonProperties.Vendor_ramdisk)
+}
+
func (m *ModuleBase) InstallInRecovery() bool {
return Bool(m.commonProperties.Recovery)
}
@@ -1323,6 +1332,10 @@
return m.base().commonProperties.ImageVariation == RamdiskVariation
}
+func (m *ModuleBase) InVendorRamdisk() bool {
+ return m.base().commonProperties.ImageVariation == VendorRamdiskVariation
+}
+
func (m *ModuleBase) InRecovery() bool {
return m.base().commonProperties.ImageVariation == RecoveryVariation
}
@@ -2224,6 +2237,10 @@
return m.module.InstallInRamdisk()
}
+func (m *moduleContext) InstallInVendorRamdisk() bool {
+ return m.module.InstallInVendorRamdisk()
+}
+
func (m *moduleContext) InstallInRecovery() bool {
return m.module.InstallInRecovery()
}
diff --git a/android/paths.go b/android/paths.go
index 3825d45..8fd2e88 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -58,6 +58,7 @@
InstallInTestcases() bool
InstallInSanitizerDir() bool
InstallInRamdisk() bool
+ InstallInVendorRamdisk() bool
InstallInRecovery() bool
InstallInRoot() bool
InstallBypassMake() bool
@@ -1376,6 +1377,9 @@
if !ctx.InstallInRoot() {
partition += "/system"
}
+ } else if ctx.InstallInVendorRamdisk() {
+ // TODO(elsk): Should be conditional on move_recovery_res_to_vendor_boot
+ partition = "vendor-ramdisk"
} else if ctx.InstallInRecovery() {
if ctx.InstallInRoot() {
partition = "recovery/root"
diff --git a/android/paths_test.go b/android/paths_test.go
index 108bd6c..9ecf4a1 100644
--- a/android/paths_test.go
+++ b/android/paths_test.go
@@ -200,14 +200,15 @@
type moduleInstallPathContextImpl struct {
baseModuleContext
- inData bool
- inTestcases bool
- inSanitizerDir bool
- inRamdisk bool
- inRecovery bool
- inRoot bool
- forceOS *OsType
- forceArch *ArchType
+ inData bool
+ inTestcases bool
+ inSanitizerDir bool
+ inRamdisk bool
+ inVendorRamdisk bool
+ inRecovery bool
+ inRoot bool
+ forceOS *OsType
+ forceArch *ArchType
}
func (m moduleInstallPathContextImpl) Config() Config {
@@ -232,6 +233,10 @@
return m.inRamdisk
}
+func (m moduleInstallPathContextImpl) InstallInVendorRamdisk() bool {
+ return m.inVendorRamdisk
+}
+
func (m moduleInstallPathContextImpl) InstallInRecovery() bool {
return m.inRecovery
}