diff --git a/device/testing/u-boot-mangopi-mq-pro/APKBUILD b/device/testing/u-boot-mangopi-mq-pro/APKBUILD new file mode 100644 index 000000000..0996512f8 --- /dev/null +++ b/device/testing/u-boot-mangopi-mq-pro/APKBUILD @@ -0,0 +1,41 @@ +pkgname=u-boot-mangopi-mq-pro +pkgver=2022.11.01 +pkgrel=0 +pkgdesc="u-boot bootloader for mangopi mq pro" +url="https://github.com/smaeul/u-boot/a" +arch="riscv64" +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 py3-setuptools bc dtc python3-dev swig bison flex openssl-dev opensbi" +options="!check" +#The lastest tag dont had mangopi mq pro support so we use this commit +_commit="528ae9bc6c55edd3ffe642734b4132a8246ea777" +source="u-boot-$_commit.tar.gz::https://github.com/smaeul/u-boot/archive/$_commit.tar.gz + update-u-boot + " +builddir="$srcdir"/u-boot-$_commit + +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 OPENSBI="/usr/share/opensbi/generic/firmware/fw_dynamic.bin" + export BUILD_DIR="$builddir"/build + mkdir -p "$BUILD_DIR" + make O="$BUILD_DIR" HOSTCC=gcc ARCH=riscv mangopi_mq_pro_defconfig + make O="$BUILD_DIR" HOSTCC=gcc ARCH=riscv all +} + +package() { + install -D -m644 build/u-boot-sunxi-with-spl.bin \ + "$pkgdir"/usr/share/u-boot/mangopi_mq_pro/u-boot-sunxi-with-spl.bin + install -D -m755 "$srcdir"/update-u-boot "$pkgdir"/usr/sbin/update-u-boot +} + + +sha512sums=" +41cac25c10c6a1ac951a10af336df96ad77283b036cf17d7aca64bf81bc7e04b8c145778fb250b429cae71ac3350e1ba42ef8d9604d52d03c5fe8715901994b3 u-boot-$_commit.tar.gz +7a683d22073223cab7b65783ee4f8dc2c0c1b2c651be8da885bc657dc2442959c67b581984d6e6830d329fbaacf747da0fbec2ee36da6ff17930fed6dfa7abbb update-u-boot +" + diff --git a/device/testing/u-boot-mangopi-mq-pro/update-u-boot b/device/testing/u-boot-mangopi-mq-pro/update-u-boot new file mode 100644 index 000000000..aa6362d1d --- /dev/null +++ b/device/testing/u-boot-mangopi-mq-pro/update-u-boot @@ -0,0 +1,90 @@ +#!/bin/sh + +verbose= +board= +device= +dryrun= +imagedir= + + +die() { + echo "ERROR: $@" + exit 1 +} + +usage() { + get_defaults + + cat <] [-b|--board ] [-d|--device ] + +options: + + -b,--board Specify the board type: mangopi-mq-pro + (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 + mangopi-mq-pro) board="mangopi-mq-pro" ;; + *) 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 + +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 +mangopi_mq_pro) + [ -e "$imagedir/mangopi_mq_pro" ] || die "mangopi-mq-pro images not installed, apk add u-boot-mangopi-mq-pro" + $dryrun dd if=$imagedir/mangopi_mq_pro/u-boot-sunxi-with-spl.bin of=$device bs=8192 seek=16 status=none + ;; +esac +$dryrun sync +) || die "U-Boot installation in $device failed" + +[ -z "$dryrun" ] && echo "Completed successfully."