# Reference: <https://postmarketos.org/devicepkg>
pkgname=u-boot-tolino-shine2hd
pkgver=2020.10
pkgrel=0
pkgdesc="U-Boot for Tolino Shine 2 HD, based on freescale fork"
arch="armv7"
_carch="arm"
license="GPL-2.0"
url="https://github.com/akemnade/u-boot-fslc"
makedepends="$depends_dev bc dtc bison flex"
options="!check"

_repository="u-boot-fslc"
_commit="fcf25705fc8b57cb22c81b2d352e9a06269911be"
source="
	$pkgname-$_commit.tar.gz::https://github.com/akemnade/$_repository/archive/$_commit.tar.gz
	u-boot-env.txt
"

builddir="$srcdir/$_repository-$_commit"

build() {
	make ARCH="$_carch" mx6sltolinoshine3_defconfig
	make ARCH="$_carch" DEVICE_TREE=imx6sl-tolino-shine2hd
	tools/mkenvimage -p 0 -s 8192 -o u-boot-env.bin "$srcdir/u-boot-env.txt"
}

package() {
	install -D -m644 "$builddir/u-boot-dtb.bin" "$pkgdir/usr/share/u-boot/tolino-shine2hd/u-boot.bin"
	install -D -m644 "$builddir/u-boot-dtb.imx" "$pkgdir/usr/share/u-boot/tolino-shine2hd/u-boot.imx"
	install -D -m644 "$builddir/u-boot-env.bin" "$pkgdir/usr/share/u-boot/tolino-shine2hd/u-boot-env.bin"
}

sha512sums="
6a9c3f5d2ad806ab9529f0c8fc19213098aae620c5bf34e5cc273453bf007266a674489deff18ffa82e8826280192dbc443b024a3f878836021ae6c062be4189  u-boot-tolino-shine2hd-fcf25705fc8b57cb22c81b2d352e9a06269911be.tar.gz
ca8237a86da93dfea62355cfbb8dbe4104c2f3aea71b4c36d5418e6aef6ead32e9d23e4731b8ff64b4a73ca563b0323087384de10d4946afd657dce4cc7c6fee  u-boot-env.txt
"
