Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 077cb63f authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge changes from topic "recovery_soong_export" into main

* changes:
  Support auto-generating prebuilt_* modules for recovery partition
  Support auto gen module type matching in neverallow
  Introduce prebuilt_vendor module type
  Auto generate recovery partition
parents 4e305cec 7e44feb5
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -1519,6 +1519,13 @@ func (c *deviceConfig) BinderBitness() string {
	return "64"
}

func (c *deviceConfig) RecoveryPath() string {
	if c.config.productVariables.RecoveryPath != nil {
		return *c.config.productVariables.RecoveryPath
	}
	return "recovery"
}

func (c *deviceConfig) VendorPath() string {
	if c.config.productVariables.VendorPath != nil {
		return *c.config.productVariables.VendorPath
@@ -1614,6 +1621,10 @@ func (c *deviceConfig) BuildingUserdataImage() bool {
	return proptools.Bool(c.config.productVariables.BuildingUserdataImage)
}

func (c *deviceConfig) BuildingRecoveryImage() bool {
	return proptools.Bool(c.config.productVariables.BuildingRecoveryImage)
}

func (c *deviceConfig) BtConfigIncludeDir() string {
	return String(c.config.productVariables.BtConfigIncludeDir)
}
+2 −0
Original line number Diff line number Diff line
@@ -1387,6 +1387,8 @@ func (m *ModuleBase) PartitionTag(config DeviceConfig) string {
		partition = "ramdisk"
	} else if m.InstallInVendorRamdisk() {
		partition = "vendor_ramdisk"
	} else if m.InstallInRecovery() {
		partition = "recovery"
	}
	return partition
}
+5 −0
Original line number Diff line number Diff line
@@ -245,6 +245,7 @@ func createInstallInRootAllowingRules() []Rule {
			Without("name", "librecovery_ui_ext").
			With("install_in_root", "true").
			NotModuleType("prebuilt_root").
			NotModuleType("prebuilt_vendor").
			Because("install_in_root is only for init_first_stage or librecovery_ui_ext."),
	}
}
@@ -341,6 +342,7 @@ func createPrebuiltEtcBpDefineRule() Rule {
			"prebuilt_tvservice",
			"prebuilt_optee",
			"prebuilt_tvconfig",
			"prebuilt_vendor",
		).
		DefinedInBpFile().
		Because("module type not allowed to be defined in bp file")
@@ -705,6 +707,9 @@ func (r *rule) appliesToOsClass(osClass OsClass) bool {
}

func (r *rule) appliesToModuleType(moduleType string) bool {
	// Remove prefix for auto-generated modules
	moduleType = strings.TrimSuffix(moduleType, "__loadHookModule")
	moduleType = strings.TrimSuffix(moduleType, "__bottomUpMutatorModule")
	return (len(r.moduleTypes) == 0 || InList(moduleType, r.moduleTypes)) && !InList(moduleType, r.unlessModuleTypes)
}

+2 −0
Original line number Diff line number Diff line
@@ -351,6 +351,8 @@ type ProductVariables struct {
	OemPath               *string `json:",omitempty"`
	UserdataPath          *string `json:",omitempty"`
	BuildingUserdataImage *bool   `json:",omitempty"`
	RecoveryPath          *string `json:",omitempty"`
	BuildingRecoveryImage *bool   `json:",omitempty"`

	ClangTidy  *bool   `json:",omitempty"`
	TidyChecks *string `json:",omitempty"`
+12 −0
Original line number Diff line number Diff line
@@ -81,6 +81,7 @@ func RegisterPrebuiltEtcBuildComponents(ctx android.RegistrationContext) {
	ctx.RegisterModuleType("prebuilt_tvservice", PrebuiltTvServiceFactory)
	ctx.RegisterModuleType("prebuilt_optee", PrebuiltOpteeFactory)
	ctx.RegisterModuleType("prebuilt_tvconfig", PrebuiltTvConfigFactory)
	ctx.RegisterModuleType("prebuilt_vendor", PrebuiltVendorFactory)

	ctx.RegisterModuleType("prebuilt_defaults", defaultsFactory)

@@ -573,6 +574,7 @@ func InitPrebuiltEtcModule(p *PrebuiltEtc, dirBase string) {
	p.installDirBase = dirBase
	p.AddProperties(&p.properties)
	p.AddProperties(&p.subdirProperties)
	p.AddProperties(&p.rootProperties)
}

func InitPrebuiltRootModule(p *PrebuiltEtc) {
@@ -972,3 +974,13 @@ func PrebuiltTvConfigFactory() android.Module {
	android.InitDefaultableModule(module)
	return module
}

// prebuilt_vendor installs files in <partition>/vendor directory.
func PrebuiltVendorFactory() android.Module {
	module := &PrebuiltEtc{}
	InitPrebuiltEtcModule(module, "vendor")
	// This module is device-only
	android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
	android.InitDefaultableModule(module)
	return module
}
Loading