Commit graph

77 commits

Author SHA1 Message Date
bowen_lai
4570fdbb4c Create symbolic boot vdex files for different ISAs
Create only one vdex file and share between different ISAs.
By sharing vdex file, zygote32 and zygote64 can share the same file and
the system partition size is reduced by about 32MB.

Test: make framework & check boot.vdex and boot-*.vdex files
Test: test system boots with no selinux violations

Bug: 64211239

Change-Id: I31ede4b6aa342f2047d9309b8c631217e6699202
2018-02-12 19:45:21 -08:00
David Brazdil
b8fa6dd104 Revert "Revert "Apply hiddenapi build tool on boot jars""
This reverts commit 4a2926a44e.

Reason for revert: The original CL caused two issues:
1) Increased app startup because `profman` failed to verify boot
jars and created an empty profile for the boot image. All methods
in the framework therefore ran interpreted/JITed. New flag
"--skip-apk-verification" has been added to `profman` to fix
the issue in CL Iad614e47feada293218c11cff985a8012ca49a0f.
2) Caused a crash in Mockito CTS tests because jvmti did not
remove hiddenapi access flags from boot jars before using them.
This has been fixed with CL Ibc9a96a6b541c06844f276db009ac29514f7a3bb.

Bug: 64382372
Bug: 72550707
Test: make test-art-host
Change-Id: Ie8c58714455662f042f56b2977b01b75c5ec7d2f
2018-01-30 18:25:46 +00:00
Alex Klyubin
a1b5dfe151 Reland: Add boot.art.rel files to system image
This file is used to verify that all differences between /system
boot*.art and /data/dalvik-cache boot*.art only consist of relocation
changes. The goal is to mitigate /data/dalvik-cache boot*.art files
being a persistence vector.

Test: Build and ensure boot.art.rel files are on the image.
Bug: 66697305
Change-Id: I68c445da46b2d3099ee347a04af4fbb84da85b0d
2018-01-19 14:34:32 -08:00
Treehugger Robot
d3a6ff9bdb Merge "Revert "Add boot.art.rel files to system image"" 2018-01-19 14:35:01 +00:00
Ian Pedowitz
74076b7556 Revert "Add boot.art.rel files to system image"
This reverts commit d616e0e820.

Reason for revert: b/72207339 - user builds are failing with this change

Bug: 72207339
Bug: 66697305
Change-Id: Ia309d04d837851ae11518f05aca468ecca895e6f
Test: Before the revert, taimen-user does not build.  After the revert taimen-user builds
2018-01-19 12:43:38 +00:00
Treehugger Robot
eb38b51733 Merge "Add boot.art.rel files to system image" 2018-01-19 05:14:36 +00:00
Alex Klyubin
d616e0e820 Add boot.art.rel files to system image
This file is used to verify that all differences between /system
boot*.art and /data/dalvik-cache boot*.art only consist of relocation
changes. The goal is to mitigate /data/dalvik-cache boot*.art files
being a persistence vector.

Test: Build and ensure boot.art.rel files are on the image.
Bug: 66697305
Change-Id: I41486dd541e429f2f2b4c4a521009ee5e81e50b9
2018-01-17 15:20:06 -08:00
Mathieu Chartier
8fd29b3653 Don't default my_use_profile_for_boot_image to true for PDK builds
This causes an unsatisfiable dependency on frameworks/base.

Bug: 67663308
Test: make

(cherry-picked from commit 83bae866e6)

Change-Id: Iba0c3893b49386591f84eb893abf0b577b9716a0
Merged-In: I06e45e8ca66ab6547bf1df25119dda80d44e50f6
2018-01-16 20:02:27 -08:00
Mathieu Chartier
ce94494b93 Enable profile based boot image by default
Use profile based boot image instead of the compiled classes version.

Results using profile from ag/2815407
Storage savings:
Boot art+vdex+oat size: 78305556->61539326 (-17MB)

New system server profile has more methods (1.5MB -> 4MB oat) since it
has more coverage from use cases.

Ram savings (sample averages for CUJ test):
Average PSS of 3 runs (~100 samples total):
.Boot_vdex: 9359K -> 9902K
.oat_mmap: 21857K -> 13372K
.Heap: 29779K -> 29483K
.Boot_art: 15736K -> 18096K
.LinearAlloc: 9112K -> 8965K
Total PSS: 85846K -> 79819K (-6MB)

Average pages read from flash (512MB device) for CUJ tests (3 samples):
1508MB -> 1183MB

Bug: 37966211
Test: make and flash

(cherry-picked from commit bf9023ae7a)

Change-Id: Icf3039ef871b68d806ef7b7c8ad2220c3a37ce90
Merged-In: Id8f9b08490a50e2ccf39e8acc00b0c4e8ec782b0
2018-01-16 20:02:18 -08:00
Jaekyun Seok
5fb6a3eb9f Move ART default properties into system partition
Bug: 64661857
Bug: 68755013
Test: confirmed that ART default properties were stored in
/system/etc/prop.default on sailfish device

Change-Id: Ie07d3049de5ac395cfb9105e208fe7825080fa15
2017-11-08 00:56:43 +00:00
Treehugger Robot
57048cd455 Merge "Build: Move preopt classpath to private variable" 2017-10-20 00:01:20 +00:00
Mathieu Chartier
a2cc65b099 Fix boot image profile in make files
Update location to framework/base/config instead of frameworks/base

Fixed dex2oat dependency to my_out_boot_image_profile_location
instead of my_out_profile_location.

Bug: 37966211
Test: make and flash

Merged-In: I446f11216cf6342861bbbf56ac5c4da2f36fb755

(cherry picked from commit 75edf540e2)

Change-Id: I4a34be8a344880d3e2ccaea3ed0e6390616e0d6c
2017-09-02 23:47:32 +00:00
Andreas Gampe
1207c86cd6 Build: Move preopt classpath to private variable
Move DEX2OAT_CLASS_LOADER_CONTEXT to
PRIVATE_DEX2OAT_CLASS_LOADER_CONTEXT in preparation for actual
classpaths.

Bug: 65256727
Test: m
Test: oatdump --oat-file=$OUT/system/framework/oat/arm64/wifi-service.odex --header-only
Change-Id: I5bcfebcd3be1a187954f550dbe1d3aa1d5099052
2017-09-02 15:22:43 -07:00
Treehugger Robot
5848fedea8 Merge "Add dirty-images-objects handling to boot image build." 2017-08-05 00:55:48 +00:00
Jeff Hao
b454ee195a Add dirty-images-objects handling to boot image build.
Allows grouping of classes with dirty static fields to be grouped
together in the image to have fewer dirty pages.

(cherry-picked from commit 865d54caf2)

Bug: 62554875
Test: mm test-art-host

Merged-In: I2486d2704d74a192f1ecdc02589e569b61efa4ae
Change-Id: I2486d2704d74a192f1ecdc02589e569b61efa4ae
2017-08-03 11:04:11 -07:00
Calin Juravle
965f8aec4c Replace -classpath with --class-loader-context for preopt
Use --class-loader-context to pass the context to dex2oat instead of using
runtime arguments.

In preparation to simplify dex2oat handling of contexts.

Bug: 38138251
Test: make & check that the prebuilds have '&' as their classpath key
Change-Id: Iad2fc4364173f59f41886556222ec69f87a0bd52
2017-08-02 17:19:27 -07:00
Mathieu Chartier
a61acf62c9 Add support for using profiles for boot images
Added two product flags:
PRODUCT_USE_PROFILE_FOR_BOOT_IMAGE
PRODUCT_DEX_PREOPT_BOOT_IMAGE_PROFILE_LOCATION

If PRODUCT_USE_PROFILE_FOR_BOOT_IMAGE is enabled (default false), a
art profile is used to create the preopted boot image. This profile
is also passed to the runtime in AndroidRuntime.cpp.

The profile is created from the
PRODUCT_DEX_PREOPT_BOOT_IMAGE_PROFILE_LOCATION variable that defaults
to "frameworks/base/boot-image-profile.txt".

(cherry picked from commit 77226f6333)

Bug: 37966211
Test: make and flash

Merged-In: Ic89cc4c0c4d39aa9726843f5d9c2fb1dedeb7885
Change-Id: Ic89cc4c0c4d39aa9726843f5d9c2fb1dedeb7885
2017-07-28 11:17:32 -07:00
Nicolas Geoffray
a65a41dcdb Merge "Pass --force-determinism to prebuilts." 2017-05-08 09:29:55 +00:00
Nicolas Geoffray
a5bb180a89 Pass --force-determinism to prebuilts.
bug: b/37442966
Test: build
Change-Id: I231803874f6f2a7245a4ef03d50a271d3c29fc9f
2017-04-28 15:01:22 +01:00
Nicolas Geoffray
cdd4343bb2 Don't preopt system server apps in system_other.
bug:36532541
bug:33799337

Test: m -j32 && find out/target -name \*.odex

(cherry picked from commit a2c6c0b11e)

Change-Id: Ic4396bb6c543af1c05f56030495caafb245ea304
2017-04-28 12:34:53 +01:00
Mathieu Chartier
fea31c0b9e Merge "Add local preopt options for generating app image and profile" 2017-03-03 01:14:03 +00:00
Mathieu Chartier
a4b993b5b9 Add local preopt options for generating app image and profile
If true, LOCAL_DEX_PREOPT_APP_IMAGE cause dex2oat to generate an app
image.

If true, LOCAL_DEX_PREOPT_GENERATE_PROFILE generates a profile based
on a class listing. LOCAL_DEX_PREOPT_PROFILE_CLASS_LISTING must be
defined in this case.

Bug: 34929159

Test: device booting, image loaded

(cherry picked from commit 9968fdcd85)

Change-Id: Ib79ada86a4ac617491723f80d99a3add3d52a7f4
2017-03-02 15:17:04 -08:00
Richard Uhler
41408b0e1a Don't include patch information for dex preopt.
Because we always compile pic, patch information is not needed.

Test: phone boots.
Bug: 33192586
Change-Id: I46a6db713e0ce21300e3f4b86bd771a68eeed0c4
2017-02-28 17:05:12 +00:00
Mathieu Chartier
192b91c97f Add support for preopted app images
Enable iff WITH_DEXPREOPT_APP_IMAGE is true.

Test: Clean + build with the flag on and off. Tested Sailfish
booting.

Bug: 34927277

(cherry picked from commit e8ab2a71d7)

Change-Id: I63f98a85c69d99746b11bb6e85c23cf5e48910cf
2017-02-10 13:39:08 -08:00
Richard Uhler
c30981e2d0 Remove option for non-pic dex preopt.
Test: make checkbuild, aosp_bullhead-userdebug boots.
Bug: 33192586

Change-Id: I4dd179fac33d777fb10cc85a99ff68c3b0d0e03d
2016-12-19 09:52:25 +00:00
David Srbecky
a17e3542b2 Merge "Generate SHA-1 build ID for host-generated *.oat files (2/2)." am: 5ccc874ba1 am: 53502853b0
am: eeabe6cfbf

Change-Id: Ie9034b118f21c42ad631f6d06d7e29afa8ac8bff
2016-10-13 13:16:41 +00:00
Alexey Alexandrov
e469063a93 Generate SHA-1 build ID for host-generated *.oat files (2/2).
For host-generated *.oat files, generate a SHA-1 build ID based on the
file content and write it to .note.gnu.build-id ELF section.  This
should allow various developer tools like profilers correlate the data
captured for files like boot.oat on the device with the corresponding
known version of the file during an offline analysis.

Test: Verified that boot.oat contains the build ID section now.
Test: make test-art-host
Bug: 31292208
Change-Id: Iee48e437009488f20995e73868d5059d349701c0
2016-10-05 19:20:36 -07:00
Dan Willemsen
823097d57b Merge "Remove redundant LIBART_IMG_{HOST,TARGET}_BASE_ADDRESS" am: 2849d4f9d9 am: bd1232517d
am: d0d4c9ad9a

Change-Id: Id050ecbcb5192fb0a5370f18c87d329fffdcd176
2016-10-05 17:07:06 +00:00
Dan Willemsen
6f21a29a2c Remove redundant LIBART_IMG_{HOST,TARGET}_BASE_ADDRESS
These are exported by Soong. Caught by an upcoming change to mark
Soong-exported variables as readonly.

Test: Manual checking that the values are still the same.
Change-Id: I18e2bca588c57809c16a9f0c386aad432bfbee2c
2016-10-04 22:28:49 -07:00
David Brazdil
29441f934d resolve merge conflicts of 0976590 to nyc-mr1-dev-plus-aosp
Change-Id: I67a45fd1d034f143e9605cc2576c16aea4f8dbc9
2016-09-12 16:58:12 +01:00
David Brazdil
70470166c7 Update build rules for VDEX
ART now produces a new output file called VDEX, produced alongside the
existing OAT file. This patch updates the relevant build rules.

Bug: 30937355
Change-Id: Ib6be9f8f36c8f061dbbebd72cb55a5d4b6dc27eb
2016-09-09 09:41:10 +01:00
Alex Light
a3e8e9c6f3 resolve merge conflicts of 3f7c348 to nyc-mr1-dev-plus-aosp
Bug: 29278988

Change-Id: Icffb9a280311c7d3c45f096243ddf18f7ebecd9d
2016-06-29 15:43:54 -07:00
Alex Light
4e358ab2c3 Add system_other partition, install odex files
For AB devices, support flashing two system partitions for factory use.
The normal system image on one partition, but without dex preopt. And a
system_other image that just contains the odex files. The dex files will
not be stripped out of the system image, in case the second system
partition is wiped.

Setting BOARD_USES_SYSTEM_OTHER_ODEX := true in the BoardConfig.mk
enables this behavior.

One can control which directories are placed in system_other by the
SYSTEM_OTHER_ODEX_FILTER configuration variable. Currently we default
to only copying only app and priv-app odexs.

Bug: 29278988
Change-Id: I7f4e87da919e7dc6a89fd8c668193cd4e98631bc
2016-06-24 11:07:15 -07:00
Jeff Hao
7d49d21ac5 Skip uses-library check for preopted apps.
am: b00263f96a

Change-Id: Icc9170bc494750eac12f141e7afd09d36564a2cc
2016-06-14 02:15:53 +00:00
Jeff Hao
b00263f96a Skip uses-library check for preopted apps.
Bug: 26880306
Change-Id: I97c75cceca30624b5f0c984a5032fdfaf632a90a
2016-06-13 17:32:06 -07:00
Ying Wang
77f67cd048 Merge "Support x86+arm multilib build."
am: d314805

* commit 'd314805c29fdbee3508b99c14ca63e1a8d170c3b':
  Support x86+arm multilib build.
2016-03-25 21:51:21 +00:00
Ying Wang
87538e4f8b Support x86+arm multilib build.
Support TARGET_2ND_ARCH as the binary translation arch.
See target/board/generic_x86_arm/BoardConfig.mk and
target/product/aosp_x86_arm.mk as example for the setup.

In BoardConfig, use the TARGET_2ND_ARCH/etc. variables to set up the
binary translation arch;
Set "TARGET_TRANSLATE_2ND_ARCH := true" to tell the build system it's
not a typical 64-bit multilib configuration.
In product makefile, use "PRODUCT_PACKAGES += libfoo_<2nd_arch>" to
install the TARGET_2ND_ARCH libraries. This also pulls in any dependency
libraries.
By default we don't install any TARGET_2ND_ARCH modules, unless it's
pulled in by PRODUCT_PACKAGES.

Bug: 27526885
Change-Id: I0578e9c80da0532d2fa886a8fcdb140bbc703009
(cherry-pick from commit 277e75a488)
2016-03-25 13:29:53 -07:00
Ying Wang
fbc5b9f56b Rebuild odex files in PDK fusion build.
To rebuild odex files of Java libraries and apps,
we store the jars/apks without stripping the classes.dex inside the
platform.zip. We also save the build variables that may affect how we
rebuild an odex in pdk_dexpreopt_config.mk in the platform.zip.
We store the files and configuration only for libraries/apps that get
installed to the system.img (or vendor.img).

In PDK fusion build, we auto-generate prebuilt module definitions for
the javalib.jar and package.dex.apk carried in the platform.zip, using
configuration stored in pdk_dexpreopt_config.mk.
With the prebult modules, we override the implicit rule that directly
copies the odex from the platform.zip.
To rebuild odex of javalib.jar, we added support for prebuilt shared Java
library to prebiult_internal.mk. An installable prebuilt Java library is
treated as shared Java library, i.e. with classes.dex in the jar instead
of a set of .class files.
For apks in the platform.zip, we install the stripped version from
platform files inside platform.zip, instead of the package.dex.apk,
using a new variable LOCAL_REPLACE_PREBUILT_APK_INSTALLED. We can't
strip package.dex.apk because we can't re-sign the stripped apk at this
point.

We generate prebuilt module only if it's not already defined in the
source tree.

Bug: 27543283
Change-Id: I9e146f8b713d6f57c397fd28d88c9ab700757ca1
(cherry-pick from commit 3a61eeb6cb)
2016-03-25 11:06:04 -07:00
Ying Wang
fc16dca602 Merge "Rebuild odex files in PDK fusion build." into nyc-dev 2016-03-15 21:23:50 +00:00
Ying Wang
222ebac10c Fix warning of "overriding commands for target ...boot.oat".
There seems to be bug in Kati that when we write it as:
LIBART_TARGET_BOOT_ART_EXTRA_FILES += boot.oat $(patsubst
%.art,%.oat,$(LIBART_TARGET_BOOT_ART_EXTRA_FILES))

boot.oat ends up in the value twice.
This works around the bug, filed as bug/27676615.

Bug: 27546601
Change-Id: Ifc330280496083a4c817e53bc5c77c86e48a2426
2016-03-15 12:26:55 -07:00
Ying Wang
3a61eeb6cb Rebuild odex files in PDK fusion build.
To rebuild odex files of Java libraries and apps,
we store the jars/apks without stripping the classes.dex inside the
platform.zip. We also save the build variables that may affect how we
rebuild an odex in pdk_dexpreopt_config.mk in the platform.zip.
We store the files and configuration only for libraries/apps that get
installed to the system.img (or vendor.img).

In PDK fusion build, we auto-generate prebuilt module definitions for
the javalib.jar and package.dex.apk carried in the platform.zip, using
configuration stored in pdk_dexpreopt_config.mk.
With the prebult modules, we override the implicit rule that directly
copies the odex from the platform.zip.
To rebuild odex of javalib.jar, we added support for prebuilt shared Java
library to prebiult_internal.mk. An installable prebuilt Java library is
treated as shared Java library, i.e. with classes.dex in the jar instead
of a set of .class files.
For apks in the platform.zip, we install the stripped version from
platform files inside platform.zip, instead of the package.dex.apk,
using a new variable LOCAL_REPLACE_PREBUILT_APK_INSTALLED. We can't
strip package.dex.apk because we can't re-sign the stripped apk at this
point.

We generate prebuilt module only if it's not already defined in the
source tree.

Bug: 27543283
Change-Id: I9e146f8b713d6f57c397fd28d88c9ab700757ca1
2016-03-14 21:01:46 -07:00
Joe Onorato
fcec686a25 Turn off excess printing during the build which makes errors harder to find.
Change-Id: I588de5ddc0aa7dcaacc4ea185c13c2fa3748888a
(cherry-pick from commit 401ffaeb75)
2016-03-09 18:09:02 -08:00
Joe Onorato
401ffaeb75 Turn off excess printing during the build which makes errors harder to find.
Change-Id: I588de5ddc0aa7dcaacc4ea185c13c2fa3748888a
2016-03-09 15:25:07 -08:00
Colin Cross
52dcb2f816 Install boot.art extra files individually
The rule that builds boot.art also produces boot.oat, boot-*.art, and
boot-*.oat as a side effect, and the install rule for boot.art was
installing them using *.art and *.oat.  This meant that PDK builds had
no rule to install the extra files, so it used the ones from the
platform.zip file instead of the locally built ones.

Generate a list of the files that should be produced by the boot.art
build, and manually create install rules for them that depend on the
built boot.art and are depended on by the installed boot.art.

Bug: 27546601
Change-Id: I9734491c3179bca2d4b2ae13b0c6a03e4c26b0b2
2016-03-08 18:00:05 -08:00
Jeff Hao
5aabca204f Build: Build changes for multi oat/image support.
Use the --multi-image option to generate a preopted boot image. This
generates a separate oat file and image file output for each dex file
input.

Stop inlining core.

(cherry picked from commit d1d3fd933f)

Change-Id: Ibd23bc06d346ff404cabd88f7461f041af6016dd
2015-12-24 10:10:55 +00:00
Jeff Hao
d1d3fd933f Build: Build changes for multi oat/image support.
Use the --multi-image option to generate a preopted boot image. This
generates a separate oat file and image file output for each dex file
input.

Stop inlining core.

Change-Id: I4437a2d43bc9b9695516bc4b90a5b59a147e13d5
2015-12-23 17:37:35 -08:00
Ying Wang
c01f2dcb10 Disable .toc optimization for host modules.
Host binaries may be run during the build process and the internal
implementation of the shared libraries makes a difference for the build
result. This change makes sure host tools get re-linked and re-run when
any of its dependency libraries gets updated.
DEX2OAT is such a host tool. We also changed DEX2OAT as full dependency
of dex-preoptimization, so we rebuild the odex files if DEX2OAT itself,
or any dependency libraries changed.

Bug: 24597504
Change-Id: Idf0d9be82ccebd826d9c5b405a39cff437e0af29
2015-12-15 10:00:19 -08:00
Fredrik Roubert
8a3dd242ac Remove $(DEX2OAT) from DEX2OAT_DEPENDENCY when USE_DEX2OAT_DEBUG is set.
Currently, DEX2OATD_DEPENDENCY is created by appending $(DEX2OATD) to
the value of DEX2OAT_DEPENDENCY and then if USE_DEX2OAT_DEBUG is set,
DEX2OAT_DEPENDENCY is set to DEX2OATD_DEPENDENCY, adding a dependency
on $(DEX2OAT) even in configurations where this will not be built.

This change removes DEX2OATD and DEX2OATD_DEPENDENCY entirely to instead
assign dex2oat or dex2oatd to DEX2OAT depending on USE_DEX2OAT_DEBUG,
making it possible to build with these flags set:

USE_DEX2OAT_DEBUG=true
ART_BUILD_HOST_NDEBUG=false
ART_BUILD_HOST_DEBUG=true
ART_BUILD_TARGET_NDEBUG=false
ART_BUILD_TARGET_DEBUG=true
make build-art-host

Change-Id: I4fa75d1b7e9751c73c43ec943fd8446cc231a070
2015-07-28 11:54:08 -07:00
David Srbecky
d8fae9a6a6 Pass --no-generate-debug-info to dex2oat.
The two flags have been merged and renamed in ART.

Change-Id: Iffc1dcc6764367239d6f45a3598cdb2c5d5d5013
2015-05-28 16:32:55 +01:00
David Srbecky
299d3f4960 Add --include-cfi compiler option.
Decouple generation of CFI from the rest of debug symbols.
This makes it possible to generate oat with CFI but without
the rest of debug symbols.

This is in line with intention of the .eh_frame section.
The section does not have the .debug_ prefix because it
is considered somewhat different to the rest of debug symbols.

Change-Id: I32816ecd4f30ac4e0dc69d69a4993e349c737f96
2015-04-13 19:50:51 +01:00