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

Commit 13cac63c authored by Huang Jianan's avatar Huang Jianan
Browse files

Add EROFS support for APEX build system



Bug: 195274797
Test: mmm system/apex/apexer/testdata
Change-Id: I21dbe8b1bfe02d267c710f3c0dd4abaa737cffe0
Signed-off-by: default avatarHuang Jianan <huangjianan@oppo.com>
parent db45fb25
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -169,8 +169,8 @@ type apexBundleProperties struct {
	// is 'image'.
	Payload_type *string

	// The type of filesystem to use when the payload_type is 'image'. Either 'ext4' or 'f2fs'.
	// Default 'ext4'.
	// The type of filesystem to use when the payload_type is 'image'. Either 'ext4', 'f2fs'
	// or 'erofs'. Default 'ext4'.
	Payload_fs_type *string

	// For telling the APEX to ignore special handling for system libraries such as bionic.
@@ -1169,6 +1169,7 @@ const (

	ext4FsType = "ext4"
	f2fsFsType = "f2fs"
	erofsFsType = "erofs"
)

// The suffix for the output "file", not the module
@@ -1670,6 +1671,7 @@ type fsType int
const (
	ext4 fsType = iota
	f2fs
	erofs
)

func (f fsType) string() string {
@@ -1678,6 +1680,8 @@ func (f fsType) string() string {
		return ext4FsType
	case f2fs:
		return f2fsFsType
	case erofs:
		return erofsFsType
	default:
		panic(fmt.Errorf("unknown APEX payload type %d", f))
	}
@@ -2106,8 +2110,10 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
		a.payloadFsType = ext4
	case f2fsFsType:
		a.payloadFsType = f2fs
	case erofsFsType:
		a.payloadFsType = erofs
	default:
		ctx.PropertyErrorf("payload_fs_type", "%q is not a valid filesystem for apex [ext4, f2fs]", *a.properties.Payload_fs_type)
		ctx.PropertyErrorf("payload_fs_type", "%q is not a valid filesystem for apex [ext4, f2fs, erofs]", *a.properties.Payload_fs_type)
	}

	// Optimization. If we are building bundled APEX, for the files that are gathered due to the
+2 −1
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@ func init() {
	pctx.HostBinToolVariable("extract_apks", "extract_apks")
	pctx.HostBinToolVariable("make_f2fs", "make_f2fs")
	pctx.HostBinToolVariable("sload_f2fs", "sload_f2fs")
	pctx.HostBinToolVariable("make_erofs", "make_erofs")
	pctx.HostBinToolVariable("apex_compression_tool", "apex_compression_tool")
	pctx.SourcePathVariable("genNdkUsedbyApexPath", "build/soong/scripts/gen_ndk_usedby_apex.sh")
}
@@ -121,7 +122,7 @@ var (
			`--payload_type image ` +
			`--key ${key} ${opt_flags} ${image_dir} ${out} `,
		CommandDeps: []string{"${apexer}", "${avbtool}", "${e2fsdroid}", "${merge_zips}",
			"${mke2fs}", "${resize2fs}", "${sefcontext_compile}", "${make_f2fs}", "${sload_f2fs}",
			"${mke2fs}", "${resize2fs}", "${sefcontext_compile}", "${make_f2fs}", "${sload_f2fs}", "${make_erofs}",
			"${soong_zip}", "${zipalign}", "${aapt2}", "prebuilts/sdk/current/public/android.jar"},
		Rspfile:        "${out}.copy_commands",
		RspfileContent: "${copy_commands}",