blob: 0985befb9d6b58e8d8448db490e61e2520679932 [file] [log] [blame]
Andreas Gampe31782c12019-02-06 09:47:25 -08001#!/system/bin/sh
2
3# Copyright (C) 2019 The Android Open Source Project
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#
17
18. `dirname $0`/art_prepostinstall_utils || exit 100
19
20log_info "Preparing boot image compilation parameters"
21
22# Prefer DEX2OATBOOTCLASSPATH, then BOOTCLASSPATH.
23USED_CLASSPATH=$DEX2OATBOOTCLASSPATH
24if [ -z "$USED_CLASSPATH" ] ; then
25 USED_CLASSPATH=$BOOTCLASSPATH
26 if [ -z "$USED_CLASSPATH" ] ; then
27 log_error "Could not find boot class-path to compile"
28 exit 101
29 fi
30fi
31BOOTCP=`echo $USED_CLASSPATH | tr ":" "\n"`
32
33DEX_FILES=
34DEX_LOCATIONS=
35for component in $BOOTCP ; do
36 DEX_FILES="$DEX_FILES --dex-file=$component"
37 DEX_LOCATIONS="$DEX_LOCATIONS --dex-location=$component"
38done
39
40PROFILING=
41if [ -f "/system/etc/boot-image.prof" ] ; then
42 PROFILING="--compiler-filter=speed-profile --profile-file=/system/etc/boot-image.prof"
Andreas Gampe31782c12019-02-06 09:47:25 -080043fi
44if [ -f "/system/etc/dirty-image-objects" ] ; then
45 PROFILING="$PROFILING --dirty-image-objects=/system/etc/dirty-image-objects"
46fi
47
48DEX2OAT_IMAGE_XMX=`getprop dalvik.vm.image-dex2oat-Xmx`
49
50DEX2OAT_TARGET_ARCH=$1
51DEX2OAT_TARGET_CPU_VARIANT=`getprop dalvik.vm.isa.${DEX2OAT_TARGET_ARCH}.variant`
52DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES=`getprop dalvik.vm.isa.${DEX2OAT_TARGET_ARCH}.features`
53
54log_info "Compiling boot image for $DEX2OAT_TARGET_ARCH"
55
56dex2oat \
57 --avoid-storing-invocation \
58 --runtime-arg -Xmx$DEX2OAT_IMAGE_XMX \
59 $PROFILING \
60 $DEX_FILES \
61 $DEX_LOCATIONS \
Andreas Gampe0985eb12019-03-19 17:42:57 -070062 --generate-mini-debug-info \
Andreas Gampe31782c12019-02-06 09:47:25 -080063 --strip \
64 --oat-file=/data/dalvik-cache/$DEX2OAT_TARGET_ARCH/system@framework@boot.oat \
65 --oat-location=/data/dalvik-cache/$DEX2OAT_TARGET_ARCH/system@framework@boot.oat \
66 --image=/data/dalvik-cache/$DEX2OAT_TARGET_ARCH/system@framework@boot.art --base=0x70000000 \
67 --instruction-set=$DEX2OAT_TARGET_ARCH \
68 --instruction-set-variant=$DEX2OAT_TARGET_CPU_VARIANT \
69 --instruction-set-features=$DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES \
70 --android-root=/system \
71 --no-inline-from=core-oj.jar \
72 --abort-on-hard-verifier-error \
73 --force-determinism || { log_error "Dex2oat failed" ; exit 102 ; }