Verified Commit c5f26eeb authored by Bart Ribbers's avatar Bart Ribbers Committed by Oliver Smith
Browse files

temp/u-boot-pinephone: add crust firmware (MR 1163)

(cherry picked from commit a1aae9ff)
parent 3c868bc2
# U-boot with patches to make the PinePhone boot faster and have control over the ddr clock speed
pkgname=u-boot-pinephone
pkgver=2020.04_git20200421
pkgrel=1
_commit="e813d3d71d0edf1f1522ccfd1e689d35f3e9a0f6"
pkgver=2020.07_git20200612
pkgrel=0
_commit="78c99d82596fef01444c076f4c975b60e084a09b"
pkgdesc="u-boot bootloader for the PINE64 PinePhone"
url="https://gitlab.com/pine64-org/u-boot"
arch="aarch64"
license="GPL-2.0-or-later OFL-1.1 BSD-2-Clause BSD-3-Clause eCos-2.0 IBM-pibs
ISC LGPL-2.0-only LGPL-2.1-only X11"
makedepends="$depends_dev bc dtc python3-dev swig bison flex openssl-dev arm-trusted-firmware-sun50i"
makedepends="$depends_dev bc dtc python3-dev swig bison flex openssl-dev arm-trusted-firmware-sun50i crust"
options="!check"
source="
$pkgname-$_commit.tar.gz::https://gitlab.com/pine64-org/u-boot/-/archive/$_commit/u-boot-$_commit.tar.gz
"
builddir="$srcdir"/u-boot-$_commit
https://github.com/crust-firmware/u-boot/archive/$_commit/u-boot-$_commit.tar.gz
update-u-boot
"
builddir="$srcdir/u-boot-$_commit"
build() {
touch include/config.h
......@@ -22,6 +22,7 @@ build() {
LC_ALL=C date +'#define U_BOOT_TIME "%T"' >> include/timestamp_autogenerated.h
export BL31="/usr/share/arm-trusted-firmware-sun50i/bl31.bin"
export SCP="/usr/share/crust/pinephone/scp.bin"
export BUILD_DIR="$builddir"/build
mkdir -p "$BUILD_DIR"
make O="$BUILD_DIR" HOSTCC=gcc ARCH=arm pinephone_defconfig
......@@ -29,10 +30,10 @@ build() {
}
package() {
cd "$builddir"/build
cd build
install -D -m644 "u-boot-sunxi-with-spl.bin" \
"$pkgdir"/usr/share/u-boot/pine64-pinephone/u-boot-sunxi-with-spl.bin
install -D -m 755 "$srcdir"/update-u-boot "$pkgdir"/usr/sbin/update-u-boot
}
sha512sums="afcd9409713bc46cb978641d8c64f5fbee992c89520e7f2626a3a9a8d61837c78bbf4bf3fc6ea5e468cafaeeda9c532b64e154fec7c9f4032783eca97e113ac7 u-boot-pinephone-e813d3d71d0edf1f1522ccfd1e689d35f3e9a0f6.tar.gz"
sha512sums="3fe43a9d3364a68ba88f5c895da5fbc2e309461d64be0fb0493840ef70fe07e89c71ce13f5ae97b61526ba223ea1a5efa505f97f40bc9c74fe336019973e27bc u-boot-78c99d82596fef01444c076f4c975b60e084a09b.tar.gz
4a3a1772a7309d44e7977dee4aca499d5c79675d99cda1395d8765abb415b8456260c7a989650f0bd2dfda0377af2346917fbcbf3e356a36265ed07e161ddc3b update-u-boot"
#!/bin/sh
verbose=
board=
device=
dryrun=
imagedir=
get_boot_blockdev() {
# Find the blockdevice where /boot is mounted from
mount | sed -n -E 's:.*(/dev/mmcblk\d)p\d on /boot .*:\1:p'
}
get_defaults() {
if [ -z "$board" -a -e /sys/firmware/devicetree/base/compatible ]; then
case "$(cat /sys/firmware/devicetree/base/compatible 2>/dev/null)" in
wand,*) board=wand ;;
pine64,pinebook-pro*) board=pinebookpro ;;
pine64,rockpro64*) board=rockpro64 ;;
pine64,pinephone*) board=pinephone ;;
esac
fi
if [ -z "$device" ]; then
case "$board" in
wand|cubie|cubie2) device=/dev/mmcblk0p0 ;;
mx6cuboxi) device=/dev/mmcblk0 ;;
pinebookpro|rockpro64) device=/dev/mmcblk2 ;;
pinephone) device=$(get_boot_blockdev) ;;
esac
fi
if [ -z "$imagedir" ]; then
imagedir="$(realpath $(dirname $0))"
[ -f "$imagedir/README.txt" ] || imagedir="/usr/share/u-boot"
fi
}
die() {
echo "ERROR: $@"
exit 1
}
usage() {
get_defaults
cat <<EOF
usage: $0 [-n,--dry-run] [-i,--imagedir <imagedir>] [-b|--board <board-type>] [-d|--device <device>]
options:
-b,--board <board> Specify the board type: wand, cubie, cubie2, cuboxi, pinebookpro, rockpro64
(current default: ${board:-none})
-d,--device <device> Specify the device where to install u-boot
(current default: ${device:-none})
-i,--imagedir <imagedir> Specify u-boot image directory
(current default: ${imagedir:-none})
-n,--dry-run Print commands but don't execute them
EOF
}
while [ $# -gt 0 ]; do
opt="$1"
shift
case "$opt" in
-b|--board)
case "$1" in
wand|wandboard) board="wand" ;;
cubie|cubieboard) board="cubie" ;;
cuboxi|mx6cuboxi) board="mx6cuboxi" ;;
pinebookpro) board="pinebookpro" ;;
rockpro64) board="rockpro64" ;;
pinephone) board="pinephone" ;;
*) usage; exit 1;;
esac
shift
;;
-d|--device)
device="$1"
shift
;;
-i|--imagedir)
imagedir="$1"
shift
;;
-n|--dry-run)
dryrun="echo"
;;
--)
break
;;
-*)
usage
exit 1
;;
esac
done
get_defaults
if [ -z "$board" -o -z "$device" -o -z "$imagedir" -o ! -e "$imagedir" ]; then
usage
exit 1
fi
if [ -z "$dryrun" ]; then
echo "Updating $board u-boot in $device in 3 seconds..."
sleep 3
fi
(
set -e
case "$board" in
wand)
[ -e "$imagedir/wandboard" ] || die "wandboard images not installed, apk add u-boot-wandboard"
$dryrun dd if=$imagedir/wandboard/SPL of=$device bs=1k seek=1 status=none
$dryrun dd if=$imagedir/wandboard/u-boot.img of=$device bs=1k seek=69 status=none
;;
cubie|cubie2)
[ -e "$imagedir/Cubieboard${board#cubie}" ] || die "Cubieboard images not installed, apk add u-boot-cubieboard"
$dryrun dd if=$imagedir/Cubieboard${board#cubie}/u-boot-sunxi-with-spl.bin of=$device bs=1024 seek=8 status=none
;;
mx6cuboxi)
[ -e "$imagedir/mx6cuboxi" ] || die "iMX6 Cubox-i images not installed, apk add u-boot-cuboxi"
$dryrun dd if=$imagedir/mx6cuboxi/SPL of=$device bs=1k seek=1 status=none
$dryrun dd if=$imagedir/mx6cuboxi/u-boot.img of=$device bs=1k seek=69 status=none
;;
pinebookpro|rockpro64)
[ -e "$imagedir/pine64-rockpro64/" ] || die "rockpro64 images not installed, apk add u-boot-rockpro64"
$dryrun dd if=$imagedir/pine64-rockpro64/u-boot-rockchip.bin of=$device bs=1024 seek=32 status=none
;;
pinephone)
[ -e "$imagedir/pine64-pinephone/" ] || die "pinephone images not installed, apk add u-boot-pinephone"
$dryrun dd if=$imagedir/pine64-pinephone/u-boot-sunxi-with-spl.bin of=$device bs=1024 seek=8 status=none
;;
esac
$dryrun sync
) || die "U-Boot installation in $device failed"
[ -z "$dryrun" ] && echo "Completed successfully."
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment