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

Commit 60e0cfb5 authored by Yifan Hong's avatar Yifan Hong
Browse files

Add vendor-ramdisk image to Soong.

Add vendor_ramdisk_available and vendor_ramdisk attribute to
various rules. When a vendor_ramdisk variant of a module is
generated, it is installed to $OUT/vendor-ramdisk.

It is similar to a ramdisk image.
Test: m nothing -j

Change-Id: Ib2d16459f3094dbe21c3bdb7c016cb4b2bf62765
parent 627ce867
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -914,8 +914,8 @@ func archMutator(bpctx blueprint.BottomUpMutatorContext) {
		osTargets = targets
	}

	// only the primary arch in the ramdisk / recovery partition
	if os == Android && (module.InstallInRecovery() || module.InstallInRamdisk()) {
	// only the primary arch in the ramdisk / vendor_ramdisk / recovery partition
	if os == Android && (module.InstallInRecovery() || module.InstallInRamdisk() || module.InstallInVendorRamdisk()) {
		osTargets = []Target{osTargets[0]}
	}

+10 −0
Original line number Diff line number Diff line
@@ -26,6 +26,10 @@ type ImageInterface interface {
	// ramdisk partition).
	RamdiskVariantNeeded(ctx BaseModuleContext) bool

	// VendorRamdiskVariantNeeded should return true if the module needs a vendor ramdisk variant (installed on the
	// vendor ramdisk partition).
	VendorRamdiskVariantNeeded(ctx BaseModuleContext) bool

	// RecoveryVariantNeeded should return true if the module needs a recovery variant (installed on the
	// recovery partition).
	RecoveryVariantNeeded(ctx BaseModuleContext) bool
@@ -53,6 +57,9 @@ const (

	// RamdiskVariation means a module to be installed to ramdisk image.
	RamdiskVariation string = "ramdisk"

	// VendorRamdiskVariation means a module to be installed to vendor ramdisk image.
	VendorRamdiskVariation string = "vendor_ramdisk"
)

// imageMutator creates variants for modules that implement the ImageInterface that
@@ -73,6 +80,9 @@ func imageMutator(ctx BottomUpMutatorContext) {
		if m.RamdiskVariantNeeded(ctx) {
			variations = append(variations, RamdiskVariation)
		}
		if m.VendorRamdiskVariantNeeded(ctx) {
			variations = append(variations, VendorRamdiskVariation)
		}
		if m.RecoveryVariantNeeded(ctx) {
			variations = append(variations, RecoveryVariation)
		}
+17 −0
Original line number Diff line number Diff line
@@ -348,6 +348,7 @@ type ModuleContext interface {
	InstallInTestcases() bool
	InstallInSanitizerDir() bool
	InstallInRamdisk() bool
	InstallInVendorRamdisk() bool
	InstallInRecovery() bool
	InstallInRoot() bool
	InstallBypassMake() bool
@@ -403,6 +404,7 @@ type Module interface {
	InstallInTestcases() bool
	InstallInSanitizerDir() bool
	InstallInRamdisk() bool
	InstallInVendorRamdisk() bool
	InstallInRecovery() bool
	InstallInRoot() bool
	InstallBypassMake() bool
@@ -623,6 +625,9 @@ type commonProperties struct {
	// Whether this module is installed to ramdisk
	Ramdisk *bool

	// Whether this module is installed to vendor ramdisk
	Vendor_ramdisk *bool

	// Whether this module is built for non-native architecures (also known as native bridge binary)
	Native_bridge_supported *bool `android:"arch_variant"`

@@ -1274,6 +1279,10 @@ func (m *ModuleBase) InstallInRamdisk() bool {
	return Bool(m.commonProperties.Ramdisk)
}

func (m *ModuleBase) InstallInVendorRamdisk() bool {
	return Bool(m.commonProperties.Vendor_ramdisk)
}

func (m *ModuleBase) InstallInRecovery() bool {
	return Bool(m.commonProperties.Recovery)
}
@@ -1323,6 +1332,10 @@ func (m *ModuleBase) InRamdisk() bool {
	return m.base().commonProperties.ImageVariation == RamdiskVariation
}

func (m *ModuleBase) InVendorRamdisk() bool {
	return m.base().commonProperties.ImageVariation == VendorRamdiskVariation
}

func (m *ModuleBase) InRecovery() bool {
	return m.base().commonProperties.ImageVariation == RecoveryVariation
}
@@ -2224,6 +2237,10 @@ func (m *moduleContext) InstallInRamdisk() bool {
	return m.module.InstallInRamdisk()
}

func (m *moduleContext) InstallInVendorRamdisk() bool {
	return m.module.InstallInVendorRamdisk()
}

func (m *moduleContext) InstallInRecovery() bool {
	return m.module.InstallInRecovery()
}
+4 −0
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@ type ModuleInstallPathContext interface {
	InstallInTestcases() bool
	InstallInSanitizerDir() bool
	InstallInRamdisk() bool
	InstallInVendorRamdisk() bool
	InstallInRecovery() bool
	InstallInRoot() bool
	InstallBypassMake() bool
@@ -1376,6 +1377,9 @@ func modulePartition(ctx ModuleInstallPathContext, os OsType) string {
			if !ctx.InstallInRoot() {
				partition += "/system"
			}
		} else if ctx.InstallInVendorRamdisk() {
			// TODO(elsk): Should be conditional on move_recovery_res_to_vendor_boot
			partition = "vendor-ramdisk"
		} else if ctx.InstallInRecovery() {
			if ctx.InstallInRoot() {
				partition = "recovery/root"
+13 −8
Original line number Diff line number Diff line
@@ -204,6 +204,7 @@ type moduleInstallPathContextImpl struct {
	inTestcases     bool
	inSanitizerDir  bool
	inRamdisk       bool
	inVendorRamdisk bool
	inRecovery      bool
	inRoot          bool
	forceOS         *OsType
@@ -232,6 +233,10 @@ func (m moduleInstallPathContextImpl) InstallInRamdisk() bool {
	return m.inRamdisk
}

func (m moduleInstallPathContextImpl) InstallInVendorRamdisk() bool {
	return m.inVendorRamdisk
}

func (m moduleInstallPathContextImpl) InstallInRecovery() bool {
	return m.inRecovery
}
Loading