Andreas Gampe | 31782c1 | 2019-02-06 09:47:25 -0800 | [diff] [blame] | 1 | #!/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 | |
| 20 | log_info "Preparing boot image compilation parameters" |
| 21 | |
| 22 | # Prefer DEX2OATBOOTCLASSPATH, then BOOTCLASSPATH. |
| 23 | USED_CLASSPATH=$DEX2OATBOOTCLASSPATH |
| 24 | if [ -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 |
| 30 | fi |
| 31 | BOOTCP=`echo $USED_CLASSPATH | tr ":" "\n"` |
| 32 | |
| 33 | DEX_FILES= |
| 34 | DEX_LOCATIONS= |
| 35 | for component in $BOOTCP ; do |
| 36 | DEX_FILES="$DEX_FILES --dex-file=$component" |
| 37 | DEX_LOCATIONS="$DEX_LOCATIONS --dex-location=$component" |
| 38 | done |
| 39 | |
| 40 | PROFILING= |
| 41 | if [ -f "/system/etc/boot-image.prof" ] ; then |
| 42 | PROFILING="--compiler-filter=speed-profile --profile-file=/system/etc/boot-image.prof" |
Andreas Gampe | 31782c1 | 2019-02-06 09:47:25 -0800 | [diff] [blame] | 43 | fi |
| 44 | if [ -f "/system/etc/dirty-image-objects" ] ; then |
| 45 | PROFILING="$PROFILING --dirty-image-objects=/system/etc/dirty-image-objects" |
| 46 | fi |
| 47 | |
| 48 | DEX2OAT_IMAGE_XMX=`getprop dalvik.vm.image-dex2oat-Xmx` |
| 49 | |
| 50 | DEX2OAT_TARGET_ARCH=$1 |
| 51 | DEX2OAT_TARGET_CPU_VARIANT=`getprop dalvik.vm.isa.${DEX2OAT_TARGET_ARCH}.variant` |
| 52 | DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES=`getprop dalvik.vm.isa.${DEX2OAT_TARGET_ARCH}.features` |
| 53 | |
| 54 | log_info "Compiling boot image for $DEX2OAT_TARGET_ARCH" |
| 55 | |
| 56 | dex2oat \ |
| 57 | --avoid-storing-invocation \ |
| 58 | --runtime-arg -Xmx$DEX2OAT_IMAGE_XMX \ |
| 59 | $PROFILING \ |
| 60 | $DEX_FILES \ |
| 61 | $DEX_LOCATIONS \ |
Andreas Gampe | 0985eb1 | 2019-03-19 17:42:57 -0700 | [diff] [blame] | 62 | --generate-mini-debug-info \ |
Andreas Gampe | 31782c1 | 2019-02-06 09:47:25 -0800 | [diff] [blame] | 63 | --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 ; } |