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
This commit is contained in:
@@ -237,6 +237,7 @@ func createInitFirstStageRules() []Rule {
|
|||||||
Without("name", "init_first_stage").
|
Without("name", "init_first_stage").
|
||||||
Without("name", "init_first_stage.microdroid").
|
Without("name", "init_first_stage.microdroid").
|
||||||
With("install_in_root", "true").
|
With("install_in_root", "true").
|
||||||
|
NotModuleType("prebuilt_root").
|
||||||
Because("install_in_root is only for init_first_stage."),
|
Because("install_in_root is only for init_first_stage."),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -126,6 +126,15 @@ type prebuiltSubdirProperties struct {
|
|||||||
Relative_install_path *string `android:"arch_variant"`
|
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 {
|
type PrebuiltEtcModule interface {
|
||||||
android.Module
|
android.Module
|
||||||
|
|
||||||
@@ -140,7 +149,12 @@ type PrebuiltEtc struct {
|
|||||||
android.ModuleBase
|
android.ModuleBase
|
||||||
android.DefaultableModuleBase
|
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
|
subdirProperties prebuiltSubdirProperties
|
||||||
|
|
||||||
sourceFilePaths android.Paths
|
sourceFilePaths android.Paths
|
||||||
@@ -156,9 +170,6 @@ type PrebuiltEtc struct {
|
|||||||
additionalDependencies *android.Paths
|
additionalDependencies *android.Paths
|
||||||
|
|
||||||
usedSrcsProperty bool
|
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
|
makeClass string
|
||||||
}
|
}
|
||||||
@@ -246,7 +257,7 @@ func (p *PrebuiltEtc) DebugRamdiskVariantNeeded(ctx android.BaseModuleContext) b
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *PrebuiltEtc) InstallInRoot() bool {
|
func (p *PrebuiltEtc) InstallInRoot() bool {
|
||||||
return p.installInRoot
|
return proptools.Bool(p.rootProperties.Install_in_root)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *PrebuiltEtc) RecoveryVariantNeeded(ctx android.BaseModuleContext) bool {
|
func (p *PrebuiltEtc) RecoveryVariantNeeded(ctx android.BaseModuleContext) bool {
|
||||||
@@ -502,21 +513,20 @@ func (p *PrebuiltEtc) AndroidModuleBase() *android.ModuleBase {
|
|||||||
|
|
||||||
func InitPrebuiltEtcModule(p *PrebuiltEtc, dirBase string) {
|
func InitPrebuiltEtcModule(p *PrebuiltEtc, dirBase string) {
|
||||||
p.installDirBase = dirBase
|
p.installDirBase = dirBase
|
||||||
p.installInRoot = false
|
|
||||||
p.AddProperties(&p.properties)
|
p.AddProperties(&p.properties)
|
||||||
p.AddProperties(&p.subdirProperties)
|
p.AddProperties(&p.subdirProperties)
|
||||||
}
|
}
|
||||||
|
|
||||||
func InitPrebuiltRootModule(p *PrebuiltEtc) {
|
func InitPrebuiltRootModule(p *PrebuiltEtc) {
|
||||||
p.installDirBase = "."
|
p.installDirBase = "."
|
||||||
p.installInRoot = false
|
|
||||||
p.AddProperties(&p.properties)
|
p.AddProperties(&p.properties)
|
||||||
|
p.AddProperties(&p.rootProperties)
|
||||||
}
|
}
|
||||||
|
|
||||||
func InitPrebuiltAvbModule(p *PrebuiltEtc) {
|
func InitPrebuiltAvbModule(p *PrebuiltEtc) {
|
||||||
p.installDirBase = "avb"
|
p.installDirBase = "avb"
|
||||||
p.installInRoot = true
|
|
||||||
p.AddProperties(&p.properties)
|
p.AddProperties(&p.properties)
|
||||||
|
p.rootProperties.Install_in_root = proptools.BoolPtr(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
// prebuilt_etc is for a prebuilt artifact that is installed in
|
// prebuilt_etc is for a prebuilt artifact that is installed in
|
||||||
|
Reference in New Issue
Block a user