Add debug ramdisk variant.
A module will be installed to /debug_ramdisk if debug_ramdisk is set to
true.
This is a reland of f84e9c05e2
, with a fix
that removes /first_stage_ramdisk.
Bug: 184004542
Test: soong test
Change-Id: I739de63cfec6b0fec5a90f7c4741fc4d884d209c
This commit is contained in:
parent
1cc8f451d1
commit
08758f08e9
|
@ -665,7 +665,7 @@ func archMutator(bpctx blueprint.BottomUpMutatorContext) {
|
|||
}
|
||||
|
||||
// only the primary arch in the ramdisk / vendor_ramdisk / recovery partition
|
||||
if os == Android && (module.InstallInRecovery() || module.InstallInRamdisk() || module.InstallInVendorRamdisk()) {
|
||||
if os == Android && (module.InstallInRecovery() || module.InstallInRamdisk() || module.InstallInVendorRamdisk() || module.InstallInDebugRamdisk()) {
|
||||
osTargets = []Target{osTargets[0]}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,10 @@ type ImageInterface interface {
|
|||
// vendor ramdisk partition).
|
||||
VendorRamdiskVariantNeeded(ctx BaseModuleContext) bool
|
||||
|
||||
// DebugRamdiskVariantNeeded should return true if the module needs a debug ramdisk variant (installed on the
|
||||
// debug ramdisk partition: $(PRODUCT_OUT)/debug_ramdisk).
|
||||
DebugRamdiskVariantNeeded(ctx BaseModuleContext) bool
|
||||
|
||||
// RecoveryVariantNeeded should return true if the module needs a recovery variant (installed on the
|
||||
// recovery partition).
|
||||
RecoveryVariantNeeded(ctx BaseModuleContext) bool
|
||||
|
@ -60,6 +64,9 @@ const (
|
|||
|
||||
// VendorRamdiskVariation means a module to be installed to vendor ramdisk image.
|
||||
VendorRamdiskVariation string = "vendor_ramdisk"
|
||||
|
||||
// DebugRamdiskVariation means a module to be installed to debug ramdisk image.
|
||||
DebugRamdiskVariation string = "debug_ramdisk"
|
||||
)
|
||||
|
||||
// imageMutator creates variants for modules that implement the ImageInterface that
|
||||
|
@ -83,6 +90,9 @@ func imageMutator(ctx BottomUpMutatorContext) {
|
|||
if m.VendorRamdiskVariantNeeded(ctx) {
|
||||
variations = append(variations, VendorRamdiskVariation)
|
||||
}
|
||||
if m.DebugRamdiskVariantNeeded(ctx) {
|
||||
variations = append(variations, DebugRamdiskVariation)
|
||||
}
|
||||
if m.RecoveryVariantNeeded(ctx) {
|
||||
variations = append(variations, RecoveryVariation)
|
||||
}
|
||||
|
|
|
@ -393,6 +393,7 @@ type ModuleContext interface {
|
|||
InstallInSanitizerDir() bool
|
||||
InstallInRamdisk() bool
|
||||
InstallInVendorRamdisk() bool
|
||||
InstallInDebugRamdisk() bool
|
||||
InstallInRecovery() bool
|
||||
InstallInRoot() bool
|
||||
InstallBypassMake() bool
|
||||
|
@ -450,6 +451,7 @@ type Module interface {
|
|||
InstallInSanitizerDir() bool
|
||||
InstallInRamdisk() bool
|
||||
InstallInVendorRamdisk() bool
|
||||
InstallInDebugRamdisk() bool
|
||||
InstallInRecovery() bool
|
||||
InstallInRoot() bool
|
||||
InstallBypassMake() bool
|
||||
|
@ -753,6 +755,9 @@ type commonProperties struct {
|
|||
// Whether this module is installed to vendor ramdisk
|
||||
Vendor_ramdisk *bool
|
||||
|
||||
// Whether this module is installed to debug ramdisk
|
||||
Debug_ramdisk *bool
|
||||
|
||||
// Whether this module is built for non-native architectures (also known as native bridge binary)
|
||||
Native_bridge_supported *bool `android:"arch_variant"`
|
||||
|
||||
|
@ -1540,6 +1545,10 @@ func (m *ModuleBase) InstallInVendorRamdisk() bool {
|
|||
return Bool(m.commonProperties.Vendor_ramdisk)
|
||||
}
|
||||
|
||||
func (m *ModuleBase) InstallInDebugRamdisk() bool {
|
||||
return Bool(m.commonProperties.Debug_ramdisk)
|
||||
}
|
||||
|
||||
func (m *ModuleBase) InstallInRecovery() bool {
|
||||
return Bool(m.commonProperties.Recovery)
|
||||
}
|
||||
|
@ -1593,6 +1602,10 @@ func (m *ModuleBase) InVendorRamdisk() bool {
|
|||
return m.base().commonProperties.ImageVariation == VendorRamdiskVariation
|
||||
}
|
||||
|
||||
func (m *ModuleBase) InDebugRamdisk() bool {
|
||||
return m.base().commonProperties.ImageVariation == DebugRamdiskVariation
|
||||
}
|
||||
|
||||
func (m *ModuleBase) InRecovery() bool {
|
||||
return m.base().commonProperties.ImageVariation == RecoveryVariation
|
||||
}
|
||||
|
@ -2576,6 +2589,10 @@ func (m *moduleContext) InstallInVendorRamdisk() bool {
|
|||
return m.module.InstallInVendorRamdisk()
|
||||
}
|
||||
|
||||
func (m *moduleContext) InstallInDebugRamdisk() bool {
|
||||
return m.module.InstallInDebugRamdisk()
|
||||
}
|
||||
|
||||
func (m *moduleContext) InstallInRecovery() bool {
|
||||
return m.module.InstallInRecovery()
|
||||
}
|
||||
|
|
|
@ -106,6 +106,7 @@ type ModuleInstallPathContext interface {
|
|||
InstallInSanitizerDir() bool
|
||||
InstallInRamdisk() bool
|
||||
InstallInVendorRamdisk() bool
|
||||
InstallInDebugRamdisk() bool
|
||||
InstallInRecovery() bool
|
||||
InstallInRoot() bool
|
||||
InstallBypassMake() bool
|
||||
|
@ -1689,6 +1690,8 @@ func modulePartition(ctx ModuleInstallPathContext, os OsType) string {
|
|||
if !ctx.InstallInRoot() {
|
||||
partition += "/system"
|
||||
}
|
||||
} else if ctx.InstallInDebugRamdisk() {
|
||||
partition = "debug_ramdisk"
|
||||
} else if ctx.InstallInRecovery() {
|
||||
if ctx.InstallInRoot() {
|
||||
partition = "recovery/root"
|
||||
|
@ -1859,6 +1862,7 @@ type testModuleInstallPathContext struct {
|
|||
inSanitizerDir bool
|
||||
inRamdisk bool
|
||||
inVendorRamdisk bool
|
||||
inDebugRamdisk bool
|
||||
inRecovery bool
|
||||
inRoot bool
|
||||
forceOS *OsType
|
||||
|
@ -1891,6 +1895,10 @@ func (m testModuleInstallPathContext) InstallInVendorRamdisk() bool {
|
|||
return m.inVendorRamdisk
|
||||
}
|
||||
|
||||
func (m testModuleInstallPathContext) InstallInDebugRamdisk() bool {
|
||||
return m.inDebugRamdisk
|
||||
}
|
||||
|
||||
func (m testModuleInstallPathContext) InstallInRecovery() bool {
|
||||
return m.inRecovery
|
||||
}
|
||||
|
|
|
@ -394,6 +394,19 @@ func TestPathForModuleInstall(t *testing.T) {
|
|||
out: "target/product/test_device/vendor_ramdisk/my_test",
|
||||
partitionDir: "target/product/test_device/vendor_ramdisk",
|
||||
},
|
||||
{
|
||||
name: "debug_ramdisk binary",
|
||||
ctx: &testModuleInstallPathContext{
|
||||
baseModuleContext: baseModuleContext{
|
||||
os: deviceTarget.Os,
|
||||
target: deviceTarget,
|
||||
},
|
||||
inDebugRamdisk: true,
|
||||
},
|
||||
in: []string{"my_test"},
|
||||
out: "target/product/test_device/debug_ramdisk/my_test",
|
||||
partitionDir: "target/product/test_device/debug_ramdisk",
|
||||
},
|
||||
{
|
||||
name: "system native test binary",
|
||||
ctx: &testModuleInstallPathContext{
|
||||
|
|
|
@ -75,6 +75,10 @@ func (g *GenruleExtraProperties) VendorRamdiskVariantNeeded(ctx android.BaseModu
|
|||
return Bool(g.Vendor_ramdisk_available)
|
||||
}
|
||||
|
||||
func (g *GenruleExtraProperties) DebugRamdiskVariantNeeded(ctx android.BaseModuleContext) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (g *GenruleExtraProperties) RecoveryVariantNeeded(ctx android.BaseModuleContext) bool {
|
||||
// If the build is using a snapshot, the recovery variant under AOSP directories
|
||||
// is not needed.
|
||||
|
|
|
@ -601,6 +601,10 @@ func (c *Module) VendorRamdiskVariantNeeded(ctx android.BaseModuleContext) bool
|
|||
return c.Properties.VendorRamdiskVariantNeeded
|
||||
}
|
||||
|
||||
func (c *Module) DebugRamdiskVariantNeeded(ctx android.BaseModuleContext) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (c *Module) RecoveryVariantNeeded(ctx android.BaseModuleContext) bool {
|
||||
return c.Properties.RecoveryVariantNeeded
|
||||
}
|
||||
|
|
|
@ -308,6 +308,10 @@ func (s *snapshot) VendorRamdiskVariantNeeded(ctx android.BaseModuleContext) boo
|
|||
return false
|
||||
}
|
||||
|
||||
func (s *snapshot) DebugRamdiskVariantNeeded(ctx android.BaseModuleContext) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (s *snapshot) RecoveryVariantNeeded(ctx android.BaseModuleContext) bool {
|
||||
return false
|
||||
}
|
||||
|
|
|
@ -84,6 +84,9 @@ type prebuiltEtcProperties struct {
|
|||
// the recovery variant instead.
|
||||
Vendor_ramdisk_available *bool
|
||||
|
||||
// Make this module available when building for debug ramdisk.
|
||||
Debug_ramdisk_available *bool
|
||||
|
||||
// Make this module available when building for recovery.
|
||||
Recovery_available *bool
|
||||
|
||||
|
@ -159,6 +162,18 @@ func (p *PrebuiltEtc) InstallInVendorRamdisk() bool {
|
|||
return p.inVendorRamdisk()
|
||||
}
|
||||
|
||||
func (p *PrebuiltEtc) inDebugRamdisk() bool {
|
||||
return p.ModuleBase.InDebugRamdisk() || p.ModuleBase.InstallInDebugRamdisk()
|
||||
}
|
||||
|
||||
func (p *PrebuiltEtc) onlyInDebugRamdisk() bool {
|
||||
return p.ModuleBase.InstallInDebugRamdisk()
|
||||
}
|
||||
|
||||
func (p *PrebuiltEtc) InstallInDebugRamdisk() bool {
|
||||
return p.inDebugRamdisk()
|
||||
}
|
||||
|
||||
func (p *PrebuiltEtc) inRecovery() bool {
|
||||
return p.ModuleBase.InRecovery() || p.ModuleBase.InstallInRecovery()
|
||||
}
|
||||
|
@ -177,7 +192,7 @@ func (p *PrebuiltEtc) ImageMutatorBegin(ctx android.BaseModuleContext) {}
|
|||
|
||||
func (p *PrebuiltEtc) CoreVariantNeeded(ctx android.BaseModuleContext) bool {
|
||||
return !p.ModuleBase.InstallInRecovery() && !p.ModuleBase.InstallInRamdisk() &&
|
||||
!p.ModuleBase.InstallInVendorRamdisk()
|
||||
!p.ModuleBase.InstallInVendorRamdisk() && !p.ModuleBase.InstallInDebugRamdisk()
|
||||
}
|
||||
|
||||
func (p *PrebuiltEtc) RamdiskVariantNeeded(ctx android.BaseModuleContext) bool {
|
||||
|
@ -188,6 +203,10 @@ func (p *PrebuiltEtc) VendorRamdiskVariantNeeded(ctx android.BaseModuleContext)
|
|||
return proptools.Bool(p.properties.Vendor_ramdisk_available) || p.ModuleBase.InstallInVendorRamdisk()
|
||||
}
|
||||
|
||||
func (p *PrebuiltEtc) DebugRamdiskVariantNeeded(ctx android.BaseModuleContext) bool {
|
||||
return proptools.Bool(p.properties.Debug_ramdisk_available) || p.ModuleBase.InstallInDebugRamdisk()
|
||||
}
|
||||
|
||||
func (p *PrebuiltEtc) RecoveryVariantNeeded(ctx android.BaseModuleContext) bool {
|
||||
return proptools.Bool(p.properties.Recovery_available) || p.ModuleBase.InstallInRecovery()
|
||||
}
|
||||
|
@ -313,6 +332,9 @@ func (p *PrebuiltEtc) AndroidMkEntries() []android.AndroidMkEntries {
|
|||
if p.inVendorRamdisk() && !p.onlyInVendorRamdisk() {
|
||||
nameSuffix = ".vendor_ramdisk"
|
||||
}
|
||||
if p.inDebugRamdisk() && !p.onlyInDebugRamdisk() {
|
||||
nameSuffix = ".debug_ramdisk"
|
||||
}
|
||||
if p.inRecovery() && !p.onlyInRecovery() {
|
||||
nameSuffix = ".recovery"
|
||||
}
|
||||
|
|
|
@ -626,6 +626,7 @@ func (x noopImageInterface) ImageMutatorBegin(android.BaseModuleContext)
|
|||
func (x noopImageInterface) CoreVariantNeeded(android.BaseModuleContext) bool { return false }
|
||||
func (x noopImageInterface) RamdiskVariantNeeded(android.BaseModuleContext) bool { return false }
|
||||
func (x noopImageInterface) VendorRamdiskVariantNeeded(android.BaseModuleContext) bool { return false }
|
||||
func (x noopImageInterface) DebugRamdiskVariantNeeded(android.BaseModuleContext) bool { return false }
|
||||
func (x noopImageInterface) RecoveryVariantNeeded(android.BaseModuleContext) bool { return false }
|
||||
func (x noopImageInterface) ExtraImageVariations(ctx android.BaseModuleContext) []string { return nil }
|
||||
func (x noopImageInterface) SetImageVariation(ctx android.BaseModuleContext, variation string, module android.Module) {
|
||||
|
|
|
@ -97,6 +97,10 @@ func (mod *Module) RamdiskVariantNeeded(android.BaseModuleContext) bool {
|
|||
return mod.InRamdisk()
|
||||
}
|
||||
|
||||
func (mod *Module) DebugRamdiskVariantNeeded(ctx android.BaseModuleContext) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (mod *Module) RecoveryVariantNeeded(android.BaseModuleContext) bool {
|
||||
return mod.InRecovery()
|
||||
}
|
||||
|
|
|
@ -210,6 +210,10 @@ func (s *ShBinary) VendorRamdiskVariantNeeded(ctx android.BaseModuleContext) boo
|
|||
return proptools.Bool(s.properties.Vendor_ramdisk_available) || s.ModuleBase.InstallInVendorRamdisk()
|
||||
}
|
||||
|
||||
func (s *ShBinary) DebugRamdiskVariantNeeded(ctx android.BaseModuleContext) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (s *ShBinary) RecoveryVariantNeeded(ctx android.BaseModuleContext) bool {
|
||||
return proptools.Bool(s.properties.Recovery_available) || s.ModuleBase.InstallInRecovery()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue