Vyshu | fbc5735 | 2020-09-09 20:50:02 +0000 | [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 generates some sample payloads from the images in |
| 19 | # sample_images.tar.bz2. and packages them in the sample_payloads.tar.xz file. |
| 20 | # The payloads are then used in paycheck_unittests.py. The file names |
| 21 | # must match the ones used in update_payload ebuild and paycheck_unittests.py. |
| 22 | |
| 23 | set -e |
| 24 | |
| 25 | TEMP_IMG_DIR=./sample_images |
| 26 | OLD_KERNEL="${TEMP_IMG_DIR}/disk_ext2_4k_empty.img" |
| 27 | OLD_ROOT="${TEMP_IMG_DIR}/disk_sqfs_empty.img" |
| 28 | NEW_KERNEL="${TEMP_IMG_DIR}/disk_ext2_4k.img" |
| 29 | NEW_ROOT="${TEMP_IMG_DIR}/disk_sqfs_default.img" |
| 30 | |
| 31 | |
| 32 | mkdir -p "${TEMP_IMG_DIR}" |
| 33 | tar -xvf sample_images.tar.bz2 -C "${TEMP_IMG_DIR}" |
| 34 | |
| 35 | echo "Generating full payload" |
| 36 | delta_generator --out_file=full_payload.bin \ |
| 37 | --partition_names=kernel:root \ |
| 38 | --new_partitions="${NEW_KERNEL}":"${NEW_ROOT}" |
| 39 | |
| 40 | echo "Generating delta payload" |
| 41 | delta_generator --out_file=delta_payload.bin \ |
| 42 | --partition_names=kernel:root \ |
| 43 | --new_partitions="${NEW_KERNEL}":"${NEW_ROOT}" \ |
| 44 | --old_partitions="${OLD_KERNEL}":"${OLD_ROOT}" --minor_version=6 |
| 45 | |
| 46 | echo "Creating sample_payloads.tar" |
| 47 | tar -cJf sample_payloads.tar.xz {delta,full}_payload.bin |
| 48 | |
| 49 | rm -rf "${TEMP_IMG_DIR}" {delta,full}_payload.bin |
| 50 | |
| 51 | echo "Done" |