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

Commit 420e16a5 authored by Spandan Das's avatar Spandan Das
Browse files

Reapply "Use partition intead of "root" to assemble filesystem artifacts"

This reverts commit 13590446.

The revert will be applied alongside a change in build/make that ensures
that the correct intermediates dir for aosp_shared_system_image is
packged into target_files.zip

Test: Previously failing OTA test now passes https://android-build.corp.google.com/builds/abtd/run/L04100030008317770
Change-Id: Ibdf3ae42348ec5840dcada8ce3182f87d4619cac
parent f7bbd2fe
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -465,7 +465,7 @@ func (f *filesystem) validateVintfFragments(ctx android.ModuleContext) {
}

func (f *filesystem) appendToEntry(ctx android.ModuleContext, installedFile android.Path) {
	partitionBaseDir := android.PathForModuleOut(ctx, "root", proptools.String(f.properties.Base_dir)).String() + "/"
	partitionBaseDir := android.PathForModuleOut(ctx, f.rootDirString(), proptools.String(f.properties.Base_dir)).String() + "/"

	relPath, inTargetPartition := strings.CutPrefix(installedFile.String(), partitionBaseDir)
	if inTargetPartition {
@@ -555,8 +555,12 @@ func (f *filesystem) copyFilesToProductOut(ctx android.ModuleContext, builder *a
	builder.Command().Textf("cp -prf %s/* %s", rebasedDir, installPath)
}

func (f *filesystem) rootDirString() string {
	return f.partitionName()
}

func (f *filesystem) buildImageUsingBuildImage(ctx android.ModuleContext) android.Path {
	rootDir := android.PathForModuleOut(ctx, "root").OutputPath
	rootDir := android.PathForModuleOut(ctx, f.rootDirString()).OutputPath
	rebasedDir := rootDir
	if f.properties.Base_dir != nil {
		rebasedDir = rootDir.Join(ctx, *f.properties.Base_dir)
@@ -783,7 +787,7 @@ func (f *filesystem) buildCpioImage(ctx android.ModuleContext, compressed bool)
		ctx.PropertyErrorf("include_make_built_files", "include_make_built_files is not supported for compressed cpio image.")
	}

	rootDir := android.PathForModuleOut(ctx, "root").OutputPath
	rootDir := android.PathForModuleOut(ctx, f.rootDirString()).OutputPath
	rebasedDir := rootDir
	if f.properties.Base_dir != nil {
		rebasedDir = rootDir.Join(ctx, *f.properties.Base_dir)
+1 −1
Original line number Diff line number Diff line
@@ -181,7 +181,7 @@ func TestFileSystemFillsLinkerConfigWithStubLibs(t *testing.T) {
	`)

	module := result.ModuleForTests("myfilesystem", "android_common")
	output := module.Output("out/soong/.intermediates/myfilesystem/android_common/root/system/etc/linker.config.pb")
	output := module.Output("out/soong/.intermediates/myfilesystem/android_common/myfilesystem/system/etc/linker.config.pb")

	fullCommand := output.RuleParams.Command
	startIndex := strings.Index(fullCommand, "conv_linker_config")
+13 −1
Original line number Diff line number Diff line
@@ -85,6 +85,18 @@ func (f *filesystem) buildFsverityMetadataFiles(ctx android.ModuleContext, build
		f.appendToEntry(ctx, destPath)
	}

	fsVerityBaseDir := rootDir.String()
	if f.PartitionType() == "system_ext" {
		// Use the equivalent of $PRODUCT_OUT as the base dir.
		// This ensures that the paths in build_manifest.pb contain on-device paths
		// e.g. system_ext/framework/javalib.jar
		// and not framework/javalib.jar.
		//
		// Although base-dir is outside the rootdir provided for packaging, this action
		// is hermetic since it uses `manifestGeneratorListPath` to filter the files to be written to build_manifest.pb
		fsVerityBaseDir = filepath.Dir(rootDir.String())
	}

	// STEP 2: generate signed BuildManifest.apk
	// STEP 2-1: generate build_manifest.pb
	manifestGeneratorListPath := android.PathForModuleOut(ctx, "fsverity_manifest.list")
@@ -96,7 +108,7 @@ func (f *filesystem) buildFsverityMetadataFiles(ctx android.ModuleContext, build
	builder.Command().
		BuiltTool("fsverity_manifest_generator").
		FlagWithInput("--fsverity-path ", fsverityPath).
		FlagWithArg("--base-dir ", rootDir.String()).
		FlagWithArg("--base-dir ", fsVerityBaseDir).
		FlagWithArg("--output ", manifestPbPath.String()).
		FlagWithInput("@", manifestGeneratorListPath)