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

Commit 920809ad authored by Jooyung Han's avatar Jooyung Han
Browse files

Use PRODUCT variable for default payload fs type

ext4 was hard-coded, but now it can be configured with
{OVERRIDE_}PRODUCT_DEFAULT_APEX_PAYLOAD_TYPE variables.

Previously, it was hard-coded as 'ext4', which makes it difficult to use a different filesystem for apex payload: for example, erofs.

Using erofs for apex payload can help to make apexes smaller on read-only partitions. (When testing with the cuttlefish, it was ~40% smaller for all apexes) This is more important for those devices using erofs on their read-only partitions (like system) because it's recommend to use "not compress .apex files" for erofs partitions (to open apex files with Direct-IO enabled).

Besides, we want to make erofs as a default filesystem for apex payload. (and hopefully deprecate .capex) However, we will need to support ext4 apexes for those older devices especially for mainline modules. Hence, we need a way to switch the default filesystem type for apex payload.

Bug: 377388109
Test: OVERRIDE_PRODUCT_DEFAULT_APEX_PAYLOAD_TYPE=erofs \
      m com.android.runtime  # The runtime APEX has erofs payload.
Change-Id: Ia42ad913cdaeb52b5617f71017aca3b051a61508
parent 098743d0
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1834,6 +1834,10 @@ func (c *config) ApexCompressionEnabled() bool {
	return Bool(c.productVariables.CompressedApex) && !c.UnbundledBuildApps()
}

func (c *config) DefaultApexPayloadType() string {
	return StringDefault(c.productVariables.DefaultApexPayloadType, "ext4")
}

func (c *config) UseSoongSystemImage() bool {
	return Bool(c.productVariables.UseSoongSystemImage)
}
+4 −3
Original line number Diff line number Diff line
@@ -410,6 +410,7 @@ type ProductVariables struct {

	ForceApexSymlinkOptimization *bool   `json:",omitempty"`
	CompressedApex               *bool   `json:",omitempty"`
	DefaultApexPayloadType       *string `json:",omitempty"`
	Aml_abis                     *bool   `json:",omitempty"`

	DexpreoptGlobalConfig *string `json:",omitempty"`
+2 −1
Original line number Diff line number Diff line
@@ -1752,7 +1752,8 @@ func (a *apexBundle) setSystemLibLink(ctx android.ModuleContext) {
}

func (a *apexBundle) setPayloadFsType(ctx android.ModuleContext) {
	switch proptools.StringDefault(a.properties.Payload_fs_type, ext4FsType) {
	defaultFsType := ctx.Config().DefaultApexPayloadType()
	switch proptools.StringDefault(a.properties.Payload_fs_type, defaultFsType) {
	case ext4FsType:
		a.payloadFsType = ext4
	case f2fsFsType: