maintainer=""
pkgname=u-boot-samsung-i9100
pkgver=2025.10_rc2
pkgrel=0
pkgdesc="u-boot bootloader for i9100 (close to mainline)"
url="https://www.denx.de/wiki/U-Boot/"
arch="armv7"
license="GPL-2.0-or-later OFL-1.1 BSD-2-Clause BSD-3-Clause WITH eCos-exception-2.0 IBM-pibs
	ISC LGPL-2.0-only LGPL-2.1-only X11"
options="!check !strip !tracedeps pmb:cross-native" # no tests
makedepends="
	bc
	bison
	dtc
	flex
	gawk
	gnutls-dev
	linux-headers
	ncurses-dev
	openssl-dev
	py3-elftools
	py3-setuptools
	python3-dev
	swig
	util-linux-dev
	"
_tag="v${pkgver//_/-}"
source="
	https://gitlab.com/u-boot/u-boot/-/archive/${_tag}/u-boot-${_tag}.tar.bz2
	0001-DONOTMERGE-configs-trats-update-values-for-i9100.patch
	0002-DONOTMERGE-Revert-most-of-board-samsung-trats-remove.patch
	0003-DONOTMERGE-board-samsung-trats-enable-ldo17.patch
	0004-ARM-dts-exynos4210-trats-i9100-fix-eMMC-and-sdcard.patch
	0005-configs-trats-add-some-variables-necessary-for-extli.patch
	0006-configs-trats-disable-BOOTCOMMAND-so-that-autoboot-c.patch
	0007-configs-trats-increase-env_size.patch
	0008-trats-clk-enable-most-of-CLK_GATE_BLOCK.patch
"
builddir="$srcdir/u-boot-$_tag"

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

	make O="$builddir/build" trats_config
	make O="$builddir/build" all
}

package() {
	install -D -m644 build/u-boot.bin \
		"$pkgdir"/usr/share/u-boot/trats/u-boot.bin
}

sha512sums="
2b06e462f77131bdb303a23e92d1086d0b8ffd4fd98ead1e3700d3b5eea5857478f63c98dc4760f2d9199750ac549cb5367cd6162d20c26333b92dbb5eab2361  u-boot-v2025.10-rc2.tar.bz2
b85b61b5c83adb11fc4ed91092dd73cdf7f8a92558071856b6c3491ee293a3000736bc0bf6c0164a56098754cda49431c023e5adc344ca7df098069da2e1e5a5  0001-DONOTMERGE-configs-trats-update-values-for-i9100.patch
0d54643ce6670116bc130bca71c500e0e3af956f917544e6574878091e7ddfb96753eea34686a8c81d297cdf75a3beba67a26735cfb601bfb5e3cdceb3a97e0c  0002-DONOTMERGE-Revert-most-of-board-samsung-trats-remove.patch
68ac00258f05b0e266b35c5406571dfde69a5aae37468e659f5cd1430ea3af5a92b527592b46d90af7cc704782f9ced570fbb76dafa2e83d2a6429b4fee9862b  0003-DONOTMERGE-board-samsung-trats-enable-ldo17.patch
9960e08783dc35acfc25374c5f2e2a8b3a091e42474de505d860335c8ac90d05ceae746bac3abe6a2a6d3f8dcac5242c95f2aea14412cdfda0d1dcd874f52744  0004-ARM-dts-exynos4210-trats-i9100-fix-eMMC-and-sdcard.patch
5e334ed2378688f85e6634bcddbe22ac5a2c2eb463e86965a84daececb8ddc0a3eef75bf1700de210c433e65087707c864ff2d1829e99f1baeee6a42ad6071f8  0005-configs-trats-add-some-variables-necessary-for-extli.patch
52f1c15fc74d574613823380d41ba635f5e806470956eca0e08724af182788d8545011946599bf8306ce99136c55be7e291c606a10bf75a58b3a857eee8f0c05  0006-configs-trats-disable-BOOTCOMMAND-so-that-autoboot-c.patch
6f5a0a3e068ba60ca557cdf1b449c769f7ca3763cf32cc13e05ec06d7f56c732e4073e87a79fabf73300b5d541b6046d30e355bc07039dedba5a5bc8a6726ffa  0007-configs-trats-increase-env_size.patch
6d28220ddb972fc9bc14cd9396feaf9a7a15e7b87c81af02f739f621f07e37b24e3e8da2015bec1f4557f49c43670e367618a39abd686fb18e1433c3a6be918d  0008-trats-clk-enable-most-of-CLK_GATE_BLOCK.patch
"
