# Maintainer: Martijn Braam # Co-Maintainer: Luca Weiss # Co-Maintainer: Bart Ribbers # Co-Maintainer: Clayton Craft # Co-Maintainer: Dylan Van Assche # U-boot with patches to make the PinePhone boot faster and have control over the ddr clock speed pkgname=u-boot-pinephone pkgver=2022.07 pkgrel=1 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" depends="linux-postmarketos-allwinner>=5.12" makedepends="$depends_dev arm-trusted-firmware bc bison crust dtc flex openssl-dev py3-setuptools python3-dev swig " options="!check" source="https://source.denx.de/u-boot/u-boot/-/archive/v$pkgver/u-boot-v$pkgver.tar.gz update-u-boot 0001-common-expose-DRAM-clock-speed.patch 0002-disable-bootdelay.patch " builddir="$srcdir/u-boot-v$pkgver" _frequencies='528 552 624' 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 BL31="/usr/share/arm-trusted-firmware/sun50i_a64/bl31.bin" export SCP="/usr/share/crust/pinephone/scp.bin" export BUILD_DIR="$builddir"/build for freq in $_frequencies; do mkdir -p "$BUILD_DIR-$freq" sed -rie "s/^(CONFIG_DRAM_CLK=).*$/CONFIG_DRAM_CLK=$freq/" configs/pinephone_defconfig cat configs/pinephone_defconfig | grep CONFIG_DRAM_CLK make O="$BUILD_DIR-$freq" HOSTCC=gcc ARCH=arm pinephone_defconfig make O="$BUILD_DIR-$freq" HOSTCC=gcc ARCH=arm all sha512sum -b "$BUILD_DIR-$freq/u-boot-sunxi-with-spl.bin" > "$BUILD_DIR-$freq/u-boot-sunxi-with-spl.bin.sha512" done } package() { for freq in $_frequencies; do install -D -m644 "build-$freq/u-boot-sunxi-with-spl.bin" \ "$pkgdir/usr/share/u-boot/pine64-pinephone/u-boot-sunxi-with-spl-$freq.bin" install -D -m644 "build-$freq/u-boot-sunxi-with-spl.bin.sha512" \ "$pkgdir/usr/share/u-boot/pine64-pinephone/u-boot-sunxi-with-spl-$freq.bin.sha512" done install -D -m 755 "$srcdir"/update-u-boot "$pkgdir"/usr/sbin/update-u-boot } sha512sums=" 7cd524d5c4b692c99d61fae4e7d99287ce4bca06884dc02b62bd69dfdf594cc9232c13c5b8dbb3aeac125bf7907591dbc6a40e2ea3e39f024bd5a5d42aeaa4cd u-boot-v2022.07.tar.gz 8dc0a8847ed26d91d3acc9b7b9dd300f95a68049207b09c3cfca1ec485f6f976aa65e0d101a4b46ecc4e85e943cbdec35e81ab0da07b1d5d0b68b4b10858b44b update-u-boot 86d9587cb2b0ca99fb4090bd0daacd47c0043858654f6f7114c8d0ed6c660eb2b8bc0b37de6723e738df9b1137d62482f00764c284f4aa0a6054db9efe754db9 0001-common-expose-DRAM-clock-speed.patch 9b9a5bd2cb5c04715a5bb2d34bfc06e63817dba7ec40fa2b09000a0827590623e85ed5877d6b6bb39f2bb917e5e9d8e1379e3df9128e3304be06abc487c68df2 0002-disable-bootdelay.patch "