Support Rust in Recovery
Bug: 178565008 Bug: 165791368 Test: Build and link a Rust library into a recovery binary Change-Id: I1c76e6204019443c567082730a4cf680f4a2a74a
This commit is contained in:
@@ -29,7 +29,7 @@ var (
|
|||||||
VendorSuffix = ".vendor"
|
VendorSuffix = ".vendor"
|
||||||
ramdiskSuffix = ".ramdisk"
|
ramdiskSuffix = ".ramdisk"
|
||||||
VendorRamdiskSuffix = ".vendor_ramdisk"
|
VendorRamdiskSuffix = ".vendor_ramdisk"
|
||||||
recoverySuffix = ".recovery"
|
RecoverySuffix = ".recovery"
|
||||||
sdkSuffix = ".sdk"
|
sdkSuffix = ".sdk"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
4
cc/cc.go
4
cc/cc.go
@@ -1672,7 +1672,7 @@ func (c *Module) setSubnameProperty(actx android.ModuleContext) {
|
|||||||
} else if c.InVendorRamdisk() && !c.OnlyInVendorRamdisk() {
|
} else if c.InVendorRamdisk() && !c.OnlyInVendorRamdisk() {
|
||||||
c.Properties.SubName += VendorRamdiskSuffix
|
c.Properties.SubName += VendorRamdiskSuffix
|
||||||
} else if c.InRecovery() && !c.OnlyInRecovery() {
|
} else if c.InRecovery() && !c.OnlyInRecovery() {
|
||||||
c.Properties.SubName += recoverySuffix
|
c.Properties.SubName += RecoverySuffix
|
||||||
} else if c.IsSdkVariant() && (c.Properties.SdkAndPlatformVariantVisibleToMake || c.SplitPerApiLevel()) {
|
} else if c.IsSdkVariant() && (c.Properties.SdkAndPlatformVariantVisibleToMake || c.SplitPerApiLevel()) {
|
||||||
c.Properties.SubName += sdkSuffix
|
c.Properties.SubName += sdkSuffix
|
||||||
if c.SplitPerApiLevel() {
|
if c.SplitPerApiLevel() {
|
||||||
@@ -3033,7 +3033,7 @@ func MakeLibName(ctx android.ModuleContext, c LinkableInterface, ccDep LinkableI
|
|||||||
} else if ccDep.InVendorRamdisk() && !ccDep.OnlyInVendorRamdisk() {
|
} else if ccDep.InVendorRamdisk() && !ccDep.OnlyInVendorRamdisk() {
|
||||||
return libName + VendorRamdiskSuffix
|
return libName + VendorRamdiskSuffix
|
||||||
} else if ccDep.InRecovery() && !ccDep.OnlyInRecovery() {
|
} else if ccDep.InRecovery() && !ccDep.OnlyInRecovery() {
|
||||||
return libName + recoverySuffix
|
return libName + RecoverySuffix
|
||||||
} else if ccDep.Target().NativeBridge == android.NativeBridgeEnabled {
|
} else if ccDep.Target().NativeBridge == android.NativeBridgeEnabled {
|
||||||
return libName + nativeBridgeSuffix
|
return libName + nativeBridgeSuffix
|
||||||
} else {
|
} else {
|
||||||
|
@@ -61,7 +61,7 @@ func (recoverySnapshotImage) imageVariantName(cfg android.DeviceConfig) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (recoverySnapshotImage) moduleNameSuffix() string {
|
func (recoverySnapshotImage) moduleNameSuffix() string {
|
||||||
return recoverySuffix
|
return RecoverySuffix
|
||||||
}
|
}
|
||||||
|
|
||||||
// Override existing vendor and recovery snapshot for cc module specific extra functions
|
// Override existing vendor and recovery snapshot for cc module specific extra functions
|
||||||
|
@@ -50,7 +50,7 @@ func (mod *Module) AndroidModuleBase() *android.ModuleBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (mod *Module) RecoveryAvailable() bool {
|
func (mod *Module) RecoveryAvailable() bool {
|
||||||
return false
|
return Bool(mod.Properties.Recovery_available)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mod *Module) ExtraVariants() []string {
|
func (mod *Module) ExtraVariants() []string {
|
||||||
@@ -72,9 +72,7 @@ func (mod *Module) SetVendorRamdiskVariantNeeded(b bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (mod *Module) SetRecoveryVariantNeeded(b bool) {
|
func (mod *Module) SetRecoveryVariantNeeded(b bool) {
|
||||||
if b {
|
mod.Properties.RecoveryVariantNeeded = b
|
||||||
panic("Setting recovery variant needed for Rust module is unsupported: " + mod.BaseModuleName())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mod *Module) SetCoreVariantNeeded(b bool) {
|
func (mod *Module) SetCoreVariantNeeded(b bool) {
|
||||||
@@ -107,7 +105,7 @@ func (mod *Module) DebugRamdiskVariantNeeded(ctx android.BaseModuleContext) bool
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (mod *Module) RecoveryVariantNeeded(android.BaseModuleContext) bool {
|
func (mod *Module) RecoveryVariantNeeded(android.BaseModuleContext) bool {
|
||||||
return mod.InRecovery()
|
return mod.Properties.RecoveryVariantNeeded
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mod *Module) ExtraImageVariations(android.BaseModuleContext) []string {
|
func (mod *Module) ExtraImageVariations(android.BaseModuleContext) []string {
|
||||||
@@ -144,8 +142,7 @@ func (ctx *moduleContext) ProductSpecific() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (mod *Module) InRecovery() bool {
|
func (mod *Module) InRecovery() bool {
|
||||||
// TODO(b/165791368)
|
return mod.ModuleBase.InRecovery() || mod.ModuleBase.InstallInRecovery()
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mod *Module) InVendorRamdisk() bool {
|
func (mod *Module) InVendorRamdisk() bool {
|
||||||
@@ -193,6 +190,8 @@ func (mod *Module) SetImageVariation(ctx android.BaseModuleContext, variant stri
|
|||||||
m := module.(*Module)
|
m := module.(*Module)
|
||||||
if variant == android.VendorRamdiskVariation {
|
if variant == android.VendorRamdiskVariation {
|
||||||
m.MakeAsPlatform()
|
m.MakeAsPlatform()
|
||||||
|
} else if variant == android.RecoveryVariation {
|
||||||
|
m.MakeAsPlatform()
|
||||||
} else if strings.HasPrefix(variant, cc.VendorVariationPrefix) {
|
} else if strings.HasPrefix(variant, cc.VendorVariationPrefix) {
|
||||||
m.Properties.ImageVariationPrefix = cc.VendorVariationPrefix
|
m.Properties.ImageVariationPrefix = cc.VendorVariationPrefix
|
||||||
m.Properties.VndkVersion = strings.TrimPrefix(variant, cc.VendorVariationPrefix)
|
m.Properties.VndkVersion = strings.TrimPrefix(variant, cc.VendorVariationPrefix)
|
||||||
|
@@ -84,6 +84,7 @@ type BaseProperties struct {
|
|||||||
// Set by imageMutator
|
// Set by imageMutator
|
||||||
CoreVariantNeeded bool `blueprint:"mutated"`
|
CoreVariantNeeded bool `blueprint:"mutated"`
|
||||||
VendorRamdiskVariantNeeded bool `blueprint:"mutated"`
|
VendorRamdiskVariantNeeded bool `blueprint:"mutated"`
|
||||||
|
RecoveryVariantNeeded bool `blueprint:"mutated"`
|
||||||
ExtraVariants []string `blueprint:"mutated"`
|
ExtraVariants []string `blueprint:"mutated"`
|
||||||
|
|
||||||
// Allows this module to use non-APEX version of libraries. Useful
|
// Allows this module to use non-APEX version of libraries. Useful
|
||||||
@@ -98,7 +99,7 @@ type BaseProperties struct {
|
|||||||
// On device without a dedicated recovery partition, the module is only
|
// On device without a dedicated recovery partition, the module is only
|
||||||
// available after switching root into
|
// available after switching root into
|
||||||
// /first_stage_ramdisk. To expose the module before switching root, install
|
// /first_stage_ramdisk. To expose the module before switching root, install
|
||||||
// the recovery variant instead (TODO(b/165791368) recovery not yet supported)
|
// the recovery variant instead
|
||||||
Vendor_ramdisk_available *bool
|
Vendor_ramdisk_available *bool
|
||||||
|
|
||||||
// Normally Soong uses the directory structure to decide which modules
|
// Normally Soong uses the directory structure to decide which modules
|
||||||
@@ -115,6 +116,9 @@ type BaseProperties struct {
|
|||||||
// framework module from the recovery snapshot.
|
// framework module from the recovery snapshot.
|
||||||
Exclude_from_recovery_snapshot *bool
|
Exclude_from_recovery_snapshot *bool
|
||||||
|
|
||||||
|
// Make this module available when building for recovery
|
||||||
|
Recovery_available *bool
|
||||||
|
|
||||||
// Minimum sdk version that the artifact should support when it runs as part of mainline modules(APEX).
|
// Minimum sdk version that the artifact should support when it runs as part of mainline modules(APEX).
|
||||||
Min_sdk_version *string
|
Min_sdk_version *string
|
||||||
|
|
||||||
@@ -807,6 +811,8 @@ func (mod *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
|
|||||||
mod.Properties.SubName += cc.VendorSuffix
|
mod.Properties.SubName += cc.VendorSuffix
|
||||||
} else if mod.InVendorRamdisk() && !mod.OnlyInVendorRamdisk() {
|
} else if mod.InVendorRamdisk() && !mod.OnlyInVendorRamdisk() {
|
||||||
mod.Properties.SubName += cc.VendorRamdiskSuffix
|
mod.Properties.SubName += cc.VendorRamdiskSuffix
|
||||||
|
} else if mod.InRecovery() && !mod.OnlyInRecovery() {
|
||||||
|
mod.Properties.SubName += cc.RecoverySuffix
|
||||||
}
|
}
|
||||||
|
|
||||||
if !toolchain.Supported() {
|
if !toolchain.Supported() {
|
||||||
|
Reference in New Issue
Block a user