Create an installation rule to copy vdex to common arch device directory

The installation rules for soong built system images are generated by
soong, but the installation rules rules for make built images are still
generated by make in dex_preopt_libart.mk. There is an existing
discrepancy between the two. Make built images generates three
installation rules for
1. system/framework/<primary_arch>/$bootjar.vdex (symlink)
2. system/framework/<secondary_arch>/$bootjar.vdex (symlink)
3. system/framework/$bootjar.vdex (actual file)

Soong copies the file to (1), creates a symlink from (2) to (1) and
skips (3) altogether. This CL makes the Soong installation rules match
Make installation rules. This will eventually allow
us to build devices by skipping `katiBuild` and moving straight to
`katiPackaging`.

Test: no diff in make built installed files
target/product/vsoc_x86_64/obj/PACKAGING/system_intermediates/file_list.txt
(top of stack)

Test: debugfs out/target/product/vsoc_x86_64/system/etc/aosp_cf_system_x86_64.img
verified system/framework/boot-apache-xml.vdex exists
verified system/framework/x86/boot-apache-xml.vdex exists as a symlink
verified system/framework/x86_64/boot-apache-xml.vdex exists as a symlink

Bug: 355700341

Change-Id: I52853c07674b77a984b5a5ac5dcd69236b642b46
This commit is contained in:
Spandan Das
2024-07-30 23:28:17 +00:00
parent 5089a18035
commit 715594304d

View File

@@ -943,20 +943,17 @@ func packageFileForTargetImage(ctx android.ModuleContext, image *bootImageVarian
} }
for _, install := range image.vdexInstalls { for _, install := range image.vdexInstalls {
if image.target.Arch.ArchType.Name != ctx.DeviceConfig().DeviceArch() { installPath, relDir, name := getModuleInstallPathInfo(ctx, install.To)
// Note that the vdex files are identical between architectures. If the target image is if name == "" {
// not for the primary architecture create symlinks to share the vdex of the primary continue
// architecture with the other architectures. }
// // Note that the vdex files are identical between architectures. Copy the vdex to a no arch directory
// Assuming that the install path has the architecture name with it, replace the // and create symlinks for both the primary and secondary arches.
// architecture name with the primary architecture name to find the source vdex file. ctx.InstallSymlink(installPath.Join(ctx, relDir), name, installPath.Join(ctx, "framework", name))
installPath, relDir, name := getModuleInstallPathInfo(ctx, install.To) if image.target.Arch.ArchType.Name == ctx.DeviceConfig().DeviceArch() {
if name != "" { // Copy the vdex from the primary arch to the no-arch directory
srcRelDir := strings.Replace(relDir, image.target.Arch.ArchType.Name, ctx.DeviceConfig().DeviceArch(), 1) // e.g. /system/framework/$bootjar.vdex
ctx.InstallSymlink(installPath.Join(ctx, relDir), name, installPath.Join(ctx, srcRelDir, name)) ctx.InstallFile(installPath.Join(ctx, "framework"), name, install.From)
}
} else {
packageFile(ctx, install)
} }
} }
} }