• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
23set -e
24
25TEMP_IMG_DIR=./sample_images
26OLD_KERNEL="${TEMP_IMG_DIR}/disk_ext2_4k_empty.img"
27OLD_ROOT="${TEMP_IMG_DIR}/disk_sqfs_empty.img"
28NEW_KERNEL="${TEMP_IMG_DIR}/disk_ext2_4k.img"
29NEW_ROOT="${TEMP_IMG_DIR}/disk_sqfs_default.img"
30
31
32mkdir -p "${TEMP_IMG_DIR}"
33tar -xvf sample_images.tar.bz2 -C "${TEMP_IMG_DIR}"
34
35echo "Generating full payload"
36delta_generator --out_file=full_payload.bin \
37                --partition_names=kernel:root \
38                --new_partitions="${NEW_KERNEL}":"${NEW_ROOT}"
39
40echo "Generating delta payload"
41delta_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
46echo "Creating sample_payloads.tar"
47tar -cJf sample_payloads.tar.xz {delta,full}_payload.bin
48
49rm -rf "${TEMP_IMG_DIR}" {delta,full}_payload.bin
50
51echo "Done"
52