diff --git a/temp/u-boot-rockpro64/APKBUILD b/temp/u-boot-rockpro64/APKBUILD index fb36161c7..61d359fad 100644 --- a/temp/u-boot-rockpro64/APKBUILD +++ b/temp/u-boot-rockpro64/APKBUILD @@ -1,7 +1,7 @@ # U-boot RC built for rk3399, can be upstreamed to alpine soon when 2020.04 is released pkgname=u-boot-rockpro64 -pkgver=2020.04_rc3 +pkgver=2020.04 pkgrel=0 pkgdesc="u-boot bootloader for the rk3399" url="https://gitlab.com/pine64-org/u-boot" @@ -12,6 +12,8 @@ makedepends="$depends_dev bc dtc python3-dev swig bison flex openssl-dev arm-tru options="!check" source=" ftp://ftp.denx.de/pub/u-boot/u-boot-${pkgver//_/-}.tar.bz2 + rk3399-power-led.patch + update-u-boot " builddir="$srcdir"/u-boot-${pkgver//_/-} @@ -30,7 +32,10 @@ build() { package() { install -D -m644 build/u-boot-rockchip.bin \ "$pkgdir"/usr/share/u-boot/pine64-rockpro64/u-boot-rockchip.bin + install -D -m755 "$srcdir"/update-u-boot "$pkgdir"/usr/sbin/update-u-boot } -sha512sums="6e617472bd38dd1f681db121bcb565abea7a15fcdb7a5920ec6dffd283d4a4580d81134768454a7c954ac7f5cbee8493879452991b6cf35de31afcd2d9448a11 u-boot-2020.04-rc3.tar.bz2" +sha512sums="e04fe54883149123730605b084324ac0d1d72ce6913467bbe587a5a2675bcf7bb393405d9a446dc0c64ba42abc1e862ae5a132e9e51aa7390e2e9fce045af8d8 u-boot-2020.04.tar.bz2 +4495dbaceac1cc42b3506dda81e0920f8eca19e11e0d717637dba6e4623e95cd4c3c94e7fc3aa8f3cbfe5fcaf0c0c109d1699eb7f278a69fa8e209c7cd6e4c02 rk3399-power-led.patch +3fb94ae63b122b85d8a4822bbcfc4e4d12beff1c752dd93e45dc49458dc5ccc5483b1ff3ac8cd628859b9d19fe95aa6b2d050df557ba2715737fa8322833ef6a update-u-boot" diff --git a/temp/u-boot-rockpro64/rk3399-power-led.patch b/temp/u-boot-rockpro64/rk3399-power-led.patch new file mode 100644 index 000000000..f3c08bf33 --- /dev/null +++ b/temp/u-boot-rockpro64/rk3399-power-led.patch @@ -0,0 +1,51 @@ +From 1a01021c9361c4e017cb5b032300f5555c393710 Mon Sep 17 00:00:00 2001 +From: dhivael +Date: Sat, 11 Jan 2020 15:04:46 +0100 +Subject: rk3399: light pinebook power and standby leds during early boot + +this is a hack, but it works for now. +--- + arch/arm/mach-rockchip/rk3399/rk3399.c | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +diff --git a/arch/arm/mach-rockchip/rk3399/rk3399.c b/arch/arm/mach-rockchip/rk3399/rk3399.c +index 863024d071..cf37129d55 100644 +--- a/arch/arm/mach-rockchip/rk3399/rk3399.c ++++ b/arch/arm/mach-rockchip/rk3399/rk3399.c +@@ -15,6 +15,8 @@ + #include + #include + #include ++#include ++#include + + DECLARE_GLOBAL_DATA_PTR; + +@@ -115,8 +117,8 @@ void board_debug_uart_init(void) + struct rk3399_grf_regs * const grf = (void *)GRF_BASE; + #ifdef CONFIG_TARGET_CHROMEBOOK_BOB + struct rk3399_pmugrf_regs * const pmugrf = (void *)PMUGRF_BASE; +- struct rockchip_gpio_regs * const gpio = (void *)GPIO0_BASE; + #endif ++ struct rockchip_gpio_regs * const gpio = (void *)GPIO0_BASE; + + #if defined(CONFIG_DEBUG_UART_BASE) && (CONFIG_DEBUG_UART_BASE == 0xff180000) + /* Enable early UART0 on the RK3399 */ +@@ -149,6 +151,14 @@ void board_debug_uart_init(void) + spl_gpio_set_pull(&pmugrf->gpio0_p, GPIO(BANK_B, 4), GPIO_PULL_NORMAL); + #endif /* CONFIG_TARGET_CHROMEBOOK_BOB */ + ++ { ++ // set GPIO0_A2/B3 to GPIO_ACTIVE_HIGH ++ // set GPIO0_A2/B3 to OUTPUT ++ int mask = (1UL << RK_PA2) | (1UL << RK_PB3); ++ setbits_le32(&gpio->swport_dr, mask); ++ setbits_le32(&gpio->swport_ddr, mask); ++ } ++ + /* Enable early UART2 channel C on the RK3399 */ + rk_clrsetreg(&grf->gpio4c_iomux, + GRF_GPIO4C3_SEL_MASK, +-- +cgit v1.2.3 + diff --git a/temp/u-boot-rockpro64/update-u-boot b/temp/u-boot-rockpro64/update-u-boot new file mode 100644 index 000000000..52a2bc0f4 --- /dev/null +++ b/temp/u-boot-rockpro64/update-u-boot @@ -0,0 +1,131 @@ +#!/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 + wand,*) board=wand ;; + pine64,pinebook-pro*) board=pinebookpro ;; + pine64,rockpro64*) board=rockpro64 ;; + esac + fi + + if [ -z "$device" ]; then + case "$board" in + wand|cubie|cubie2) device=/dev/mmcblk0p0 ;; + mx6cuboxi) device=/dev/mmcblk0 ;; + pinebookpro|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 <] [-b|--board ] [-d|--device ] + +options: + + -b,--board Specify the board type: wand, cubie, cubie2, cuboxi, pinebookpro, rockpro64 + (current default: ${board:-none}) + + -d,--device Specify the device where to install u-boot + (current default: ${device:-none}) + + -i,--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" ;; + *) 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 + ;; +esac +$dryrun sync +) || die "U-Boot installation in $device failed" + +[ -z "$dryrun" ] && echo "Completed successfully."