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/cc/image.go b/cc/image.go
index 6710e94..ba091e1 100644
--- a/cc/image.go
+++ b/cc/image.go
@@ -27,12 +27,13 @@
type imageVariantType string
const (
- coreImageVariant imageVariantType = "core"
- vendorImageVariant imageVariantType = "vendor"
- productImageVariant imageVariantType = "product"
- ramdiskImageVariant imageVariantType = "ramdisk"
- recoveryImageVariant imageVariantType = "recovery"
- hostImageVariant imageVariantType = "host"
+ coreImageVariant imageVariantType = "core"
+ vendorImageVariant imageVariantType = "vendor"
+ productImageVariant imageVariantType = "product"
+ ramdiskImageVariant imageVariantType = "ramdisk"
+ vendorRamdiskImageVariant imageVariantType = "vendor_ramdisk"
+ recoveryImageVariant imageVariantType = "recovery"
+ hostImageVariant imageVariantType = "host"
)
func (c *Module) getImageVariantType() imageVariantType {
@@ -44,6 +45,8 @@
return productImageVariant
} else if c.InRamdisk() {
return ramdiskImageVariant
+ } else if c.InVendorRamdisk() {
+ return vendorRamdiskImageVariant
} else if c.InRecovery() {
return recoveryImageVariant
} else {
@@ -83,6 +86,10 @@
return ctx.mod.InRamdisk()
}
+func (ctx *moduleContextImpl) inVendorRamdisk() bool {
+ return ctx.mod.InVendorRamdisk()
+}
+
func (ctx *moduleContextImpl) inRecovery() bool {
return ctx.mod.InRecovery()
}
@@ -107,6 +114,10 @@
return c.ModuleBase.InRamdisk() || c.ModuleBase.InstallInRamdisk()
}
+func (c *Module) InVendorRamdisk() bool {
+ return c.ModuleBase.InVendorRamdisk() || c.ModuleBase.InstallInVendorRamdisk()
+}
+
func (c *Module) InRecovery() bool {
return c.ModuleBase.InRecovery() || c.ModuleBase.InstallInRecovery()
}
@@ -115,6 +126,10 @@
return c.ModuleBase.InstallInRamdisk()
}
+func (c *Module) OnlyInVendorRamdisk() bool {
+ return c.ModuleBase.InstallInVendorRamdisk()
+}
+
func (c *Module) OnlyInRecovery() bool {
return c.ModuleBase.InstallInRecovery()
}
@@ -165,6 +180,7 @@
var coreVariantNeeded bool = false
var ramdiskVariantNeeded bool = false
+ var vendorRamdiskVariantNeeded bool = false
var recoveryVariantNeeded bool = false
var vendorVariants []string
@@ -283,6 +299,15 @@
coreVariantNeeded = false
}
+ if Bool(m.Properties.Vendor_ramdisk_available) {
+ vendorRamdiskVariantNeeded = true
+ }
+
+ if m.ModuleBase.InstallInVendorRamdisk() {
+ vendorRamdiskVariantNeeded = true
+ coreVariantNeeded = false
+ }
+
if Bool(m.Properties.Recovery_available) {
recoveryVariantNeeded = true
}
@@ -301,6 +326,7 @@
}
m.Properties.RamdiskVariantNeeded = ramdiskVariantNeeded
+ m.Properties.VendorRamdiskVariantNeeded = vendorRamdiskVariantNeeded
m.Properties.RecoveryVariantNeeded = recoveryVariantNeeded
m.Properties.CoreVariantNeeded = coreVariantNeeded
}
@@ -313,6 +339,10 @@
return c.Properties.RamdiskVariantNeeded
}
+func (c *Module) VendorRamdiskVariantNeeded(ctx android.BaseModuleContext) bool {
+ return c.Properties.VendorRamdiskVariantNeeded
+}
+
func (c *Module) RecoveryVariantNeeded(ctx android.BaseModuleContext) bool {
return c.Properties.RecoveryVariantNeeded
}
@@ -323,7 +353,7 @@
func (c *Module) SetImageVariation(ctx android.BaseModuleContext, variant string, module android.Module) {
m := module.(*Module)
- if variant == android.RamdiskVariation {
+ if variant == android.RamdiskVariation || variant == android.VendorRamdiskVariation {
m.MakeAsPlatform()
} else if variant == android.RecoveryVariation {
m.MakeAsPlatform()