Use boot image extension for framework libraries.

This patch splits the system boot image in two parts:

  - The ART boot image. This is the primary boot image that is
    included in the ART apex and contains dexpreopted Core Libraries.

  - The framweork boot image extension. It depends on the ART boot
    image and contains framework libraries.

The third "apex" boot image (used in the JIT-zygote experiment)
remains unchanged; it is a monolithic primary boot image that
contains both libcore and framework libraries.

Dexpreopting of APKs now uses the framework boot image extension
(which in turn pulls in the ART boot image as a dependency).

Test: m
Test: phone boots:
    lunch aosp_walleye-userdebug && m \
        && adb reboot bootloader && fastboot flashall -w

Bug: b/119800099

Exempt-From-Owner-Approval: rebased after getting approval.

Change-Id: Ida40dfae8c83bf7c2e737d5c7ea418e1197ad826
This commit is contained in:
Ulya Trafimovich
2019-11-08 10:54:21 +00:00
committed by Ulyana Trafimovich
parent 3ae3b17083
commit 4d2eeed0da
8 changed files with 270 additions and 175 deletions

View File

@@ -86,10 +86,8 @@ func GenerateDexpreoptRule(ctx android.PathContext,
generateDM := shouldGenerateDM(module, global)
for i, arch := range module.Archs {
image := module.DexPreoptImages[i]
imageDeps := module.DexPreoptImagesDeps[i]
dexpreoptCommand(ctx, global, module, rule, arch, profile, image, imageDeps, appImage, generateDM)
for archIdx, _ := range module.Archs {
dexpreoptCommand(ctx, global, module, rule, archIdx, profile, appImage, generateDM)
}
}
}
@@ -193,7 +191,9 @@ func bootProfileCommand(ctx android.PathContext, global GlobalConfig, module Mod
}
func dexpreoptCommand(ctx android.PathContext, global GlobalConfig, module ModuleConfig, rule *android.RuleBuilder,
arch android.ArchType, profile, bootImage android.Path, bootImageDeps android.Paths, appImage, generateDM bool) {
archIdx int, profile android.WritablePath, appImage bool, generateDM bool) {
arch := module.Archs[archIdx]
// HACK: make soname in Soong-generated .odex files match Make.
base := filepath.Base(module.DexLocation)
@@ -222,13 +222,6 @@ func dexpreoptCommand(ctx android.PathContext, global GlobalConfig, module Modul
invocationPath := odexPath.ReplaceExtension(ctx, "invocation")
// bootImage is .../dex_bootjars/system/framework/arm64/boot.art, but dex2oat wants
// .../dex_bootjars/system/framework/boot.art on the command line
var bootImageLocation string
if bootImage != nil {
bootImageLocation = PathToLocation(bootImage, arch)
}
// The class loader context using paths in the build
var classLoaderContextHost android.Paths
@@ -356,7 +349,7 @@ func dexpreoptCommand(ctx android.PathContext, global GlobalConfig, module Modul
Flag("--runtime-arg").FlagWithList("-Xbootclasspath-locations:", module.PreoptBootClassPathDexLocations, ":").
Flag("${class_loader_context_arg}").
Flag("${stored_class_loader_context_arg}").
FlagWithArg("--boot-image=", bootImageLocation).Implicits(bootImageDeps).
FlagWithArg("--boot-image=", strings.Join(module.DexPreoptImageLocations, ":")).Implicits(module.DexPreoptImagesDeps[archIdx].Paths()).
FlagWithInput("--dex-file=", module.DexPath).
FlagWithArg("--dex-location=", dexLocationArg).
FlagWithOutput("--oat-file=", odexPath).ImplicitOutput(vdexPath).
@@ -555,9 +548,9 @@ func SplitApexJarPair(apexJarValue string) (string, string) {
}
// Expected format for apexJarValue = <apex name>:<jar name>
func GetJarLocationFromApexJarPair(apexJarValue string) (string) {
func GetJarLocationFromApexJarPair(apexJarValue string) string {
apex, jar := SplitApexJarPair(apexJarValue)
return filepath.Join("/apex", apex, "javalib", jar + ".jar")
return filepath.Join("/apex", apex, "javalib", jar+".jar")
}
func contains(l []string, s string) bool {