u-boot-rock64: new package (MR 2328)
This commit is contained in:
parent
451b93ef73
commit
8874185abf
2 changed files with 150 additions and 0 deletions
41
temp/u-boot-rock64/APKBUILD
Normal file
41
temp/u-boot-rock64/APKBUILD
Normal file
|
@ -0,0 +1,41 @@
|
|||
# U-boot built for rk3328
|
||||
|
||||
pkgname=u-boot-rock64
|
||||
pkgver=2021.07
|
||||
pkgrel=0
|
||||
pkgdesc="u-boot bootloader for the rk3328"
|
||||
url="https://gitlab.com/u-boot/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"
|
||||
options="!check"
|
||||
source="
|
||||
ftp://ftp.denx.de/pub/u-boot/u-boot-${pkgver//_/-}.tar.bz2
|
||||
update-u-boot
|
||||
"
|
||||
builddir="$srcdir"/u-boot-${pkgver//_/-}
|
||||
|
||||
build() {
|
||||
touch include/config.h
|
||||
LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"' > include/timestamp_autogenerated.h
|
||||
LC_ALL=C date +'#define U_BOOT_TIME "%T"' >> include/timestamp_autogenerated.h
|
||||
|
||||
export BL31="/usr/share/arm-trusted-firmware/rk3328/bl31.elf"
|
||||
export BUILD_DIR="$builddir"/build
|
||||
mkdir -p "$BUILD_DIR"
|
||||
make O="$BUILD_DIR" HOSTCC=gcc ARCH=arm rock64-rk3328_defconfig
|
||||
make O="$BUILD_DIR" HOSTCC=gcc ARCH=arm all
|
||||
}
|
||||
|
||||
package() {
|
||||
install -D -m644 build/u-boot-rockchip.bin \
|
||||
"$pkgdir"/usr/share/u-boot/pine64-rock64/u-boot-rockchip.bin
|
||||
install -D -m755 "$srcdir"/update-u-boot "$pkgdir"/usr/sbin/update-u-boot
|
||||
}
|
||||
|
||||
|
||||
sha512sums="
|
||||
210b206a4626feb0985580d9448a97b499b09bf9b9313ca847a66624785e9e9b0fae8f2e329acd344f5f75cb722d2093dd0ee394311ddd1fde05e400ee71a24d u-boot-2021.07.tar.bz2
|
||||
5ffa497122f3fd23b0b1c055229d650895fd03ca415ba6fb6df2ba848023d523fc14caaaf13d5409cc4b03e73cb92493eac1d8952738376c46395de827cad509 update-u-boot
|
||||
"
|
109
temp/u-boot-rock64/update-u-boot
Normal file
109
temp/u-boot-rock64/update-u-boot
Normal file
|
@ -0,0 +1,109 @@
|
|||
#!/bin/sh
|
||||
|
||||
verbose=
|
||||
board=
|
||||
device=
|
||||
dryrun=
|
||||
imagedir=
|
||||
|
||||
get_defaults() {
|
||||
if [ -z "$board" -a -e /sys/firmware/devicetree/base/compatible ]; then
|
||||
case "$(cat /sys/firmware/devicetree/base/compatible 2>/dev/null)" in
|
||||
pine64,rock64*) board=rock64 ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if [ -z "$device" ]; then
|
||||
case "$board" in
|
||||
rockpro64) device=/dev/mmcblk2 ;;
|
||||
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: rock64
|
||||
(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
|
||||
rock64) board="rock64" ;;
|
||||
*) 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
|
||||
rock64)
|
||||
[ -e "$imagedir/pine64-rock64/" ] || die "rock64 images not installed, apk add u-boot-rock64"
|
||||
$dryrun dd if=$imagedir/pine64-rock64/u-boot-rockchip.bin of=$device bs=1024 seek=32 status=none
|
||||
;;
|
||||
esac
|
||||
$dryrun sync
|
||||
) || die "U-Boot installation in $device failed"
|
||||
|
||||
[ -z "$dryrun" ] && echo "Completed successfully."
|
Loading…
Add table
Reference in a new issue