Lines Matching full:boot

31 // The build support for boot images is currently being migrated away from singleton to modules so
38 // 2) Boot images are now represented by the boot_image module type.
39 // 3) The art boot image is called "art-boot-image", the framework boot image is called
40 // "framework-boot-image".
41 // 4) They are defined in art/build/boot/Android.bp and frameworks/base/boot/Android.bp
43 // 5) Each boot_image retrieves the appropriate boot image configuration from the map returned by
48 // 1. ART boot images in general (their types, structure, file layout, etc.)
49 // 2. build system support for boot images
51 // 1. ART boot images
54 // A boot image in ART is a set of files that contain AOT-compiled native code and a heap snapshot
55 // of AOT-initialized classes for the bootclasspath Java libraries. A boot image is compiled from a
56 // set of DEX jars by the dex2oat compiler. A boot image is used for two purposes: 1) it is
61 // A boot image is not a single file, but a collection of interrelated files. Each boot image has a
68 // *.vdex files for the boot images do not contain the DEX bytecode itself, because the
69 // bootclasspath DEX files are stored on disk in uncompressed and aligned form. Consequently a boot
71 // of boot image files, ART uses a certain naming scheme and associates the following metadata with
72 // each boot image:
73 // - A stem, which is a symbolic name that is prepended to boot image file names.
74 // - A location (on-device path to the boot image files).
75 // - A list of boot image locations (on-device paths to dependency boot images).
77 // to compile the boot image).
79 // There are two kinds of boot images:
80 // - primary boot images
81 // - boot image extensions
83 // 1.1. Primary boot images
86 // A primary boot image is compiled for a core subset of bootclasspath Java libraries. It does not
87 // depend on any other images, and other boot images may depend on it.
89 // For example, assuming that the stem is "boot", the location is /apex/com.android.art/javalib/,
90 // the set of core bootclasspath libraries is A B C, and the boot image is compiled for ARM targets
92 // - /apex/com.android.art/javalib/{arm,arm64}/boot.{art,oat,vdex}
93 // - /apex/com.android.art/javalib/{arm,arm64}/boot-B.{art,oat,vdex}
94 // - /apex/com.android.art/javalib/{arm,arm64}/boot-C.{art,oat,vdex}
97 // the stem. This naming convention dates back to the times when the boot image was not split into
98 // components, and there were just boot.oat and boot.art. The decision to split was motivated by
101 // As of November 2020 the only primary boot image in Android is the image in the ART APEX
102 // com.android.art. The primary ART boot image contains the Core libraries that are part of the ART
103 // module. When the ART module gets updated, the primary boot image will be updated with it, and all
107 // 1.2. Boot image extensions
110 // A boot image extension is compiled for a subset of bootclasspath Java libraries (in particular,
111 // this subset does not include the Core bootclasspath libraries that go into the primary boot
112 // image). A boot image extension depends on the primary boot image and optionally some other boot
113 // image extensions. Other images may depend on it. In other words, boot image extensions can form
116 // The motivation for boot image extensions comes from the Mainline project. Consider a situation
119 // code for C might have changed compared to the code that was used to compile the boot image.
120 // Consequently, the whole boot image is obsolete and invalidated (even though the code for A and B
121 // that does not depend on C is up to date). To avoid this, the original monolithic boot image is
122 // split in two parts: the primary boot image that contains A B, and the boot image extension that
123 // contains C and depends on the primary boot image (extends it).
125 // For example, assuming that the stem is "boot", the location is /system/framework, the set of
128 // /apex/com.android.E/javalib), and the boot image is compiled for ARM targets (32 and 64 bits),
130 // - /system/framework/{arm,arm64}/boot-D.{art,oat,vdex}
131 // - /system/framework/{arm,arm64}/boot-E.{art,oat,vdex}
133 // As of November 2020 the only boot image extension in Android is the Framework boot image
134 // extension. It extends the primary ART boot image and contains Framework libraries and other
136 // ART image. The Framework boot image extension is updated together with the platform. In the
137 // future other boot image extensions may be added for some updatable modules.
140 // 2. Build system support for boot images
143 // The primary ART boot image needs to be compiled with one dex2oat invocation that depends on DEX
144 // jars for the core libraries. Framework boot image extension needs to be compiled with one dex2oat
145 // invocation that depends on the primary ART boot image and all bootclasspath DEX jars except the
146 // core libraries as they are already part of the primary ART boot image.
148 // 2.1. Libraries that go in the boot images
151 // The contents of each boot image are determined by the PRODUCT variables. The primary ART APEX
152 // boot image contains libraries listed in the ART_APEX_JARS variable in the AOSP makefiles. The
153 // Framework boot image extension contains libraries specified in the PRODUCT_BOOT_JARS and
171 // They are not included in the boot image. The only exception here are ART jars and core-icu4j.jar
172 // that have been historically part of the boot image and are now in apexes; they are in boot images
177 // boot image libraries is instrumented, which means that the instrumentation library (jacocoagent)
180 // In general, there is a requirement that the source code for a boot image library must be
186 // Because boot images are used to dexpreopt other Java modules, the paths to boot image files must
187 // be known by the time dexpreopt build rules for the dependent modules are generated. Boot image
189 // provide predefined paths to boot image files (these paths depend only on static build
195 // Build rules for the boot images are generated with a Soong singleton. Because a singleton has no
199 // locations to the hard-coded locations predefined in the boot image configs.
210 // The primary boot image and the Framework extension are installed in different ways. The primary
211 // boot image is part of the ART APEX: it is copied into the APEX intermediate files, packaged
212 // together with other APEX contents, extracted and mounted on device. The Framework boot image
214 // writes out a few DEXPREOPT_IMAGE_* variables for Make; these variables contain boot image names,
228 dexpreoptBootJarDepTag = bootclasspathDependencyTag{name: "dexpreopt-boot-jar"}
237 // Target-independent description of a boot image.
298 // Target-dependent description of a boot image.
351 // Get target-specific boot image variant for the given boot image config and target.
371 // Return the name of a boot image module given a boot image config and a component (module) index.
372 // A module name is a combination of the Java library name, and the boot image stem (that is stored
375 // The first module of the primary boot image is special: its module name has only the stem, but
385 // Return the name of the first boot image module, or stem if the list of modules is empty.
394 // Return filenames for the given boot image component, given the output directory and a list of
414 // We also generate boot images for host (for testing), but we don't need those in the apex.
423 // Return boot image locations (as a list of symbolic paths).
426 // exist on the device. Typically it is /apex/com.android.art/javalib/boot.art and should be the
430 // For example a physical file /apex/com.android.art/javalib/x86/boot.art has "image location"
431 // /apex/com.android.art/javalib/boot.art (which is not an actual file).
433 // For a primary boot image the list of locations has a single element.
435 // For a boot image extension the list of locations contains a location for all dependency images
437 // Framework boot image extension that depends on the primary ART boot image the list contains two
477 // Singleton module for generating boot image build rules.
481 // Default boot image config (currently always the Framework boot image extension). It should be
482 // noted that JIT-Zygote builds use ART APEX image instead of the Framework boot image extension,
487 // Other boot image configs (currently the list contains only the primary ART APEX image. It
489 // the future other boot image extensions may be added.
493 // the default boot image).
496 // Build path to the boot framework profile.
513 // Add a dependency onto the dex2oat tool which is needed for creating the boot image. The
523 // For accessing the boot jars.
546 // This dependency will be used to get the path to the deapexed dex boot jars and profile (via a pr…
599 // GenerateAndroidBuildActions generates the build rules for boot images.
621 // Gather the install files of the host variant of the ART boot image.
643 // Set a provider containing the install files of the host variant of the ART boot image.
661 // shouldBuildBootImages determines whether boot images should be built.
663 // Skip recompiling the boot image for the second sanitization phase. We'll get separate paths
681 // then be used along with profiles imported from APEXes to build the boot image.
684 // If dexpreopt of boot image jars should be skipped, stop after generating a profile.
690 // Build boot image files for the android variants.
693 // Zip the android variant boot image files up.
696 // Build boot image files for the host variants. There are use directly by ART host side tests.
727 "Boot image '%s' module '%s' not added as a dependency of dex_bootjars",
757 ctx.ModuleErrorf("Apex %s does not provide a dex boot jar for library %s\n", apex, javalib)
783 // files or the dex jar extracted from a prebuilt APEX. We can't use this for a boot jar for
793 ctx.ModuleErrorf("Boot jar '%[1]s' is from APEX '%[2]s', but a bootclasspath_fragment for "+
808 // copyBootJarsToPredefinedLocations generates commands that will copy boot jars to predefined
821 // A dex boot jar should be provided by the source java module. It needs to be installable or
825 // a prebuilt java module with the same name. In that case the dex boot jar needs to be
827 // through a exported_(boot|systemserver)classpath_fragments property to a
828 // prebuilt_(boot|systemserver)classpath_fragment module, which in turn lists the prebuilt
832 …ctx.ModuleErrorf("module %s does not provide a dex boot jar (see comment next to this message in S…
837 ctx.ModuleErrorf("module %s is not part of the boot configuration", name)
848 // buildBootImageVariantsForAndroidOs generates rules to build the boot image variants for the
850 // boot image files.
857 // buildBootImageVariantsForBuildOs generates rules to build the boot image variants for the
868 // bootImageFilesByArch is a map from android.ArchType to the paths to the boot image files.
870 // The paths include the .art, .oat and .vdex files, one for each of the modules from which the boot
874 // bootImageOutputs encapsulates information about boot images that were created/obtained by
877 // Map from arch to the paths to the boot image files created/obtained for that arch.
882 // The path to the profile file created/obtained for the boot image.
887 // boot image files are required for and it creates rules to build the boot image
890 // It returns a map from android.ArchType to the predefined paths of the boot image files.
908 // buildBootImageZipInPredefinedLocation generates a zip file containing all the boot image files.
910 // The supplied filesByArch is nil when the boot image files have not been generated. Otherwise, it
949 ctx.ModuleErrorf("Boot image config imports profile from '%[2]s', but a "+
996 // artBootImageHostInfo contains the install locations of the host variant of ART boot image
1002 // Generate boot image build rules for a specific target.
1038 // ...unless the boot image is generated specifically for testing, then allow all logging.
1060 ctx.ModuleErrorf("Boot image config '%[1]s' imports profile from '%[2]s', but '%[2]s' "+
1077 // It is a boot image extension, so it needs the boot images that it depends on.
1085 // Add the path to the first file in the boot image with the arch specific directory removed,
1089 FlagWithList("--boot-image=", baseImageLocations, ":").Implicits(image.baseImages.Paths()).
1091 // boot image so make sure to add them as implicit dependencies to ensure that they are built
1208 const failureMessage = `ERROR: Dex2oat failed to compile a boot image.
1209 It is likely that the boot classpath is inconsistent.
1220 defaultProfile := "frameworks/base/boot/boot-image-profile.txt"
1225 artProfile := "art/build/boot/boot-image-profile.txt"
1226 extraProfile := "frameworks/base/boot/boot-image-profile-extra.txt"
1247 bootImageProfile := android.PathForModuleOut(ctx, name, "boot-image-profile.txt")
1250 profile := android.PathForModuleOut(ctx, name, "boot.prof")
1255 Flag("--output-profile-type=boot").
1261 rule.Build("bootJarsProfile_"+name, "profile boot jars "+name)
1285 rule.Install(profile, "/system/etc/boot-image.prof")
1291 // bootFrameworkProfileRule generates the rule to create the boot framework profile and
1301 defaultProfile := "frameworks/base/boot/boot-profile.txt"
1304 profile := image.dir.Join(ctx, "boot.bprof")
1316 rule.Install(profile, "/system/etc/boot-image.bprof")
1317 rule.Build("bootFrameworkProfile", "profile boot framework jars")
1376 // Define Make variables for boot image names, paths, etc. These variables are used in makefiles
1377 // (make/core/dex_preopt_libart.mk) to generate install rules that copy boot image files to the
1392 // The primary ART boot image is exposed to Make for testing (gtests) and benchmarking
1429 // it creates the installation rules for the host variant of the ART boot image.
1444 …// Create a dependency on `dex_bootjars` to access the intermediate locations of host art boot ima…
1452 ctx.ModuleErrorf("Could not find information about the host variant of ART boot image")
1467 // Creates an installation rule for host variant of ART boot image files.