Add install_in_root to prebuilt_root module
This is to support installing to real root "/", not a root of partition
(e.g. "/system/").
Bug: 351258461
Test: build
Change-Id: I56993aceddfd988d2d10040f50f838b89c9bdc67
diff --git a/etc/prebuilt_etc.go b/etc/prebuilt_etc.go
index d04b2d1..fc6d1f7 100644
--- a/etc/prebuilt_etc.go
+++ b/etc/prebuilt_etc.go
@@ -126,6 +126,15 @@
Relative_install_path *string `android:"arch_variant"`
}
+type prebuiltRootProperties struct {
+ // Install this module to the root directory, without partition subdirs. When this module is
+ // added to PRODUCT_PACKAGES, this module will be installed to $PRODUCT_OUT/root, which will
+ // then be copied to the root of system.img. When this module is packaged by other modules like
+ // android_filesystem, this module will be installed to the root ("/"), unlike normal
+ // prebuilt_root modules which are installed to the partition subdir (e.g. "/system/").
+ Install_in_root *bool
+}
+
type PrebuiltEtcModule interface {
android.Module
@@ -140,7 +149,12 @@
android.ModuleBase
android.DefaultableModuleBase
- properties prebuiltEtcProperties
+ properties prebuiltEtcProperties
+
+ // rootProperties is used to return the value of the InstallInRoot() method. Currently, only
+ // prebuilt_avb and prebuilt_root modules use this.
+ rootProperties prebuiltRootProperties
+
subdirProperties prebuiltSubdirProperties
sourceFilePaths android.Paths
@@ -156,9 +170,6 @@
additionalDependencies *android.Paths
usedSrcsProperty bool
- // installInRoot is used to return the value of the InstallInRoot() method. The default value is false.
- // Currently, only prebuilt_avb can be set to true.
- installInRoot bool
makeClass string
}
@@ -246,7 +257,7 @@
}
func (p *PrebuiltEtc) InstallInRoot() bool {
- return p.installInRoot
+ return proptools.Bool(p.rootProperties.Install_in_root)
}
func (p *PrebuiltEtc) RecoveryVariantNeeded(ctx android.BaseModuleContext) bool {
@@ -502,21 +513,20 @@
func InitPrebuiltEtcModule(p *PrebuiltEtc, dirBase string) {
p.installDirBase = dirBase
- p.installInRoot = false
p.AddProperties(&p.properties)
p.AddProperties(&p.subdirProperties)
}
func InitPrebuiltRootModule(p *PrebuiltEtc) {
p.installDirBase = "."
- p.installInRoot = false
p.AddProperties(&p.properties)
+ p.AddProperties(&p.rootProperties)
}
func InitPrebuiltAvbModule(p *PrebuiltEtc) {
p.installDirBase = "avb"
- p.installInRoot = true
p.AddProperties(&p.properties)
+ p.rootProperties.Install_in_root = proptools.BoolPtr(true)
}
// prebuilt_etc is for a prebuilt artifact that is installed in