From 2ed4a88f8791d8a3e0e56d8e4f847d94f81a8556 Mon Sep 17 00:00:00 2001
From: "@exkc" <exkc@exkc.moe>
Date: Sun, 12 Feb 2023 16:57:19 +0800
Subject: [PATCH] u-boot-radxa-zero: new aport

Reference: https://u-boot.readthedocs.io/en/latest/board/amlogic/radxa-zero.html
---
 device/testing/u-boot-radxa-zero/APKBUILD | 62 +++++++++++++++++++++++
 1 file changed, 62 insertions(+)
 create mode 100644 device/testing/u-boot-radxa-zero/APKBUILD

diff --git a/device/testing/u-boot-radxa-zero/APKBUILD b/device/testing/u-boot-radxa-zero/APKBUILD
new file mode 100644
index 00000000000..de3ed17abab
--- /dev/null
+++ b/device/testing/u-boot-radxa-zero/APKBUILD
@@ -0,0 +1,62 @@
+# Reference: <https://u-boot.readthedocs.io/en/latest/board/amlogic/radxa-zero.html>
+# Maintainer: exkc <exxxxkc@getgoogleoff.me>
+pkgname=u-boot-radxa-zero
+pkgver=2023.01
+pkgrel=0
+pkgdesc="U-Boot bootloader for the PINE64 PinePhone"
+url="https://source.denx.de/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 proprietary"
+makedepends="$depends_dev
+	bc
+	bison
+	crust
+	dtc
+	flex
+	openssl-dev
+	py3-setuptools
+	python3-dev
+	swig
+	bash
+	"
+options="!check"
+_amlogicblob_commit="5b8beba2f50ce06219c4e4844101226a81aef854"
+source="https://source.denx.de/u-boot/u-boot/-/archive/v$pkgver/u-boot-v$pkgver.tar.gz
+	amlogicblob.tar.gz::https://github.com/radxa/fip/archive/$_amlogicblob_commit.tar.gz
+	"
+builddir="$srcdir/u-boot-v$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 BUILD_DIR="$builddir"/build
+	mkdir -p "$BUILD_DIR"
+	make O="$BUILD_DIR" HOSTCC=gcc ARCH=arm radxa-zero_defconfig
+	make O="$BUILD_DIR" HOSTCC=gcc ARCH=arm all
+	cd $srcdir/fip-$_amlogicblob_commit/radxa-zero
+	cp $srcdir/u-boot-v$pkgver/build/u-boot.bin ./bl33.bin
+	make
+	dd if=u-boot.bin.sd.bin of=u-boot.bin.sd-stripped.bin conv=fsync,notrunc bs=512 skip=1
+
+}
+
+package() {
+	install -D -m644 "$srcdir/fip-$_amlogicblob_commit/radxa-zero/u-boot.bin.sd-stripped.bin" \
+		"$pkgdir/usr/share/u-boot/radxa-zero/u-boot.bin.sd-stripped.bin"
+	install -D -m644 "$srcdir/fip-$_amlogicblob_commit/radxa-zero/u-boot.bin.sd.bin" \
+		"$pkgdir/usr/share/u-boot/radxa-zero/u-boot.bin.sd.bin"
+	install -D -m644 "$srcdir/fip-$_amlogicblob_commit/radxa-zero/u-boot.bin" \
+		"$pkgdir/usr/share/u-boot/radxa-zero/u-boot.bin"
+	install -D -m644 "$srcdir/fip-$_amlogicblob_commit/radxa-zero/u-boot.bin.usb.bl2" \
+		"$pkgdir/usr/share/u-boot/radxa-zero/u-boot.bin.usb.bl2"
+	install -D -m644 "$srcdir/fip-$_amlogicblob_commit/radxa-zero/u-boot.bin.usb.tpl" \
+		"$pkgdir/usr/share/u-boot/radxa-zero/u-boot.bin.usb.tpl"
+}
+
+sha512sums="
+c25aae1b0d2f677d295587c6d318f23d52bc3a79e968bed9093645943a9840c56b1f6f44e5649d236e76e3dc85f0473c1da4a5205c02dcf437bca820acaf6fb8  u-boot-v2023.01.tar.gz
+3ac5fa8f0ef702585de71a8e0364088639b1163e84d5159b7768dda0016eeb97229bd089acfd0559b0ac32ea0d4ee15945c53e5684c0030e089414ff4135aed9  amlogicblob.tar.gz
+"
-- 
GitLab