Support Rust in Ramdisk
Bug: 178565008
Bug: 165791368
Test: Build and link a Rust library into a ramdisk binary
Change-Id: I9682b978936624133e5a62e94caace0e8958fd0f
diff --git a/rust/rust.go b/rust/rust.go
index 70721fb..ba395ec 100644
--- a/rust/rust.go
+++ b/rust/rust.go
@@ -84,6 +84,7 @@
// Set by imageMutator
CoreVariantNeeded bool `blueprint:"mutated"`
VendorRamdiskVariantNeeded bool `blueprint:"mutated"`
+ RamdiskVariantNeeded bool `blueprint:"mutated"`
RecoveryVariantNeeded bool `blueprint:"mutated"`
ExtraVariants []string `blueprint:"mutated"`
@@ -95,6 +96,13 @@
SnapshotSharedLibs []string `blueprint:"mutated"`
SnapshotStaticLibs []string `blueprint:"mutated"`
+ // Make this module available when building for ramdisk.
+ // On device without a dedicated recovery partition, the module is only
+ // available after switching root into
+ // /first_stage_ramdisk. To expose the module before switching root, install
+ // the recovery variant instead.
+ Ramdisk_available *bool
+
// Make this module available when building for vendor ramdisk.
// On device without a dedicated recovery partition, the module is only
// available after switching root into
@@ -817,6 +825,8 @@
} else {
mod.Properties.SubName += cc.VendorSuffix
}
+ } else if mod.InRamdisk() && !mod.OnlyInRamdisk() {
+ mod.Properties.SubName += cc.RamdiskSuffix
} else if mod.InVendorRamdisk() && !mod.OnlyInVendorRamdisk() {
mod.Properties.SubName += cc.VendorRamdiskSuffix
} else if mod.InRecovery() && !mod.OnlyInRecovery() {