source: mainline/tools/deploy/hikey960/fastboot@ 8fd0675f

Last change on this file since 8fd0675f was 8fd0675f, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 4 years ago

Update files with /bin/sh shebang and an extra space

  • Property mode set to 100755
File size: 1.9 KB
Line 
1#!/bin/sh
2#
3# SPDX-FileCopyrightText: 2021 Martin Decky
4#
5# SPDX-License-Identifier: BSD-3-Clause
6#
7
8# This script allows to deploy HelenOS conveniently to the HiKey 960 board
9# using the fastboot protocol. The fastboot mechanism is provided as a part
10# of the default UEFI firmware on HiKey 960.
11#
12# The implementation of the fastboot mechanism on HiKey 960 has several
13# quirks and this script tries to accommodate for them:
14#
15# * The boot image must be compressed by GZip. Uncompressed boot images are
16# rejected.
17#
18# * The compressed boot image must end with a device tree blob (even if
19# the device tree is not actually processed). A missing device tree blob
20# crashes the fastboot mechanism.
21#
22# * A RAM disk must be included in the final fastboot image. A missing RAM
23# disk crashes the fastboot mechanism. We use a fake blob for that purpose.
24
25check_error() {
26 if [ "$1" -ne "0" ] ; then
27 echo
28 echo "Error: $2"
29
30 exit 1
31 fi
32}
33
34SCRIPT_DIR="$(readlink -f $(dirname "$0"))"
35
36if [ "$#" -lt "1" ] ; then
37 echo "Usage: $0 <image.boot>"
38 exit 2
39fi
40
41IMAGE="$1"
42IMAGE_GZ="${IMAGE}.gz"
43IMAGE_GZ_DTB="${IMAGE_GZ}+dtb"
44IMAGE_FASTBOOT="${IMAGE}.fastboot"
45
46if [ ! -f "${IMAGE}" ] ; then
47 echo "Error: ${IMAGE} is not a file"
48 exit 3
49fi
50
51# Compress the image
52gzip -c "${IMAGE}" > "${IMAGE_GZ}"
53check_error $? "Compressing ${IMAGE}"
54
55# Append the DTB
56cat "${IMAGE_GZ}" "${SCRIPT_DIR}/hi3660-hikey960.dtb" > "${IMAGE_GZ_DTB}"
57check_error $? "Appending DTB to ${IMAGE_GZ}"
58
59# Create the fastboot image with a fake "RAM disk"
60"${SCRIPT_DIR}/mkfastboot" --kernel ${IMAGE_GZ_DTB} --ramdisk "${SCRIPT_DIR}/hikey960.rd" --base 0x0 --tags-addr 0x07a00000 --kernel_offset 0x00080000 --ramdisk_offset 0x07c00000 --output "${IMAGE_FASTBOOT}"
61check_error $? "Converting ${IMAGE_GZ_DTB} to a fastboot image"
62
63# Deploy the fastboot image on a HiKey 960 board connected to the host machine
64fastboot boot "${IMAGE_FASTBOOT}"
65check_error $? "Deploying ${IMAGE_FASTBOOT}"
Note: See TracBrowser for help on using the repository browser.