From b36763e0814c14cec402e2739ddaa7d5c3b9b7f9 Mon Sep 17 00:00:00 2001 From: Cole Faust Date: Tue, 18 Feb 2025 15:21:44 -0800 Subject: Handle the ramdisk implicitly in target-file.zip We should not be checking ctx.DeviceConfig().BoardMoveRecoveryResourcesToVendorBoot() in android_device, because there may be multiple android_devices in the tree with different partition layouts. Instead, get the recovery image files transitively from the vendor_boot image. Bug: 376539388 Test: Built target_files.zip, checked all the files are still there. Change-Id: I1837aedacf71063879b26b51b8fe28b684b96d78 --- filesystem/filesystem.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'filesystem/filesystem.go') diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go index f84993de7..c78061ab8 100644 --- a/filesystem/filesystem.go +++ b/filesystem/filesystem.go @@ -397,6 +397,9 @@ type FilesystemInfo struct { // to add a dependency on the Output file, as you cannot add dependencies on directories // in ninja. RootDir android.Path + // Extra root directories that are also built into the partition. Currently only used for + // including the recovery partition files into the vendor_boot image. + ExtraRootDirs android.Paths // The rebased staging directory used to build the output filesystem. If consuming this, make // sure to add a dependency on the Output file, as you cannot add dependencies on directories // in ninja. In many cases this is the same as RootDir, only in the system partition is it @@ -612,6 +615,7 @@ func (f *filesystem) GenerateAndroidBuildActions(ctx android.ModuleContext) { var outputHermetic android.WritablePath var buildImagePropFile android.Path var buildImagePropFileDeps android.Paths + var extraRootDirs android.Paths switch f.fsType(ctx) { case ext4Type, erofsType, f2fsType: buildImagePropFile, buildImagePropFileDeps = f.buildPropFile(ctx) @@ -625,9 +629,9 @@ func (f *filesystem) GenerateAndroidBuildActions(ctx android.ModuleContext) { f.buildImageUsingBuildImage(ctx, hermeticBuilder, buildImageParams{rootDir, propFileHermetic, buildImagePropFileDeps, outputHermetic}) mapFile = f.getMapFile(ctx) case compressedCpioType: - f.output = f.buildCpioImage(ctx, builder, rootDir, true) + f.output, extraRootDirs = f.buildCpioImage(ctx, builder, rootDir, true) case cpioType: - f.output = f.buildCpioImage(ctx, builder, rootDir, false) + f.output, extraRootDirs = f.buildCpioImage(ctx, builder, rootDir, false) default: return } @@ -659,6 +663,7 @@ func (f *filesystem) GenerateAndroidBuildActions(ctx android.ModuleContext) { OutputHermetic: outputHermetic, FileListFile: fileListFile, RootDir: rootDir, + ExtraRootDirs: extraRootDirs, RebasedDir: rebasedDir, MapFile: mapFile, ModuleName: ctx.ModuleName(), @@ -1157,7 +1162,7 @@ func (f *filesystem) buildCpioImage( builder *android.RuleBuilder, rootDir android.OutputPath, compressed bool, -) android.Path { +) (android.Path, android.Paths) { if proptools.Bool(f.properties.Use_avb) { ctx.PropertyErrorf("use_avb", "signing compresed cpio image using avbtool is not supported."+ "Consider adding this to bootimg module and signing the entire boot image.") @@ -1197,7 +1202,7 @@ func (f *filesystem) buildCpioImage( // rootDir is not deleted. Might be useful for quick inspection. builder.Build("build_cpio_image", fmt.Sprintf("Creating filesystem %s", f.BaseModuleName())) - return output + return output, rootDirs } var validPartitions = []string{ -- cgit v1.2.3-59-g8ed1b