Calin Juravle | c7bcda8 | 2020-06-17 19:40:47 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # Copyright (C) 2020 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 | # This script configures a device for boot image profile |
| 19 | # |
| 20 | |
| 21 | if [[ -z "$ANDROID_BUILD_TOP" ]]; then |
| 22 | echo "You must run on this after running envsetup.sh and launch target" |
| 23 | exit 1 |
| 24 | fi |
| 25 | |
| 26 | if [[ "$#" -lt 1 ]]; then |
| 27 | echo "Usage $0 <output-for-boot-zip>" |
| 28 | echo "Example: $0 boot.zip" |
| 29 | exit 1 |
| 30 | fi |
| 31 | |
| 32 | OUT_BOOT_ZIP="$1" |
| 33 | |
| 34 | echo "Changing dirs to the build top" |
| 35 | cd "$ANDROID_BUILD_TOP" |
| 36 | |
| 37 | # Make dist in order to easily get the boot and system server dex files |
| 38 | # This will be stored in $ANDROID_PRODUCT_OUT/boot.zip |
| 39 | echo "Make dist" |
| 40 | m dist |
| 41 | echo "Copy boot.zip to $OUT_BOOT_ZIP" |
| 42 | cp "$ANDROID_PRODUCT_OUT"/boot.zip $OUT_BOOT_ZIP |
| 43 | |
| 44 | echo "Setting properties and clearing existing profiles" |
| 45 | # If the device needs to be rebooted, it is better to set the properties |
| 46 | # via a local.prop file: |
| 47 | # 1) create a local.prop file with the content |
| 48 | # dalvik.vm.profilebootclasspath=true |
| 49 | # dalvik.vm.profilesystemserver=true |
| 50 | # 2) adb push local.prop /data/ |
| 51 | # adb shell chmod 0750 /data/local.prop |
| 52 | # adb reboot |
| 53 | |
| 54 | adb root |
| 55 | adb shell stop |
| 56 | adb shell setprop dalvik.vm.profilebootclasspath true |
| 57 | adb shell setprop dalvik.vm.profilesystemserver true |
| 58 | adb shell find "/data/misc/profiles -name *.prof -exec truncate -s 0 {} \;" |
| 59 | adb shell start |