# Contributor: William Pitcock # Contributor: Timo Teras # Maintainer: Leonardo Arena pkgname=u-boot pkgver=2016.07 pkgrel=1 pkgdesc="Bootloader for ARM" url="http://www.denx.de/wiki/U-Boot/" arch="armhf" license="GPL2" depends="" depends_dev="" makedepends="$depends_dev bc dtc" install="" subpackages="" source="ftp://ftp.denx.de/pub/u-boot/u-boot-${pkgver//_/-}.tar.bz2 README.txt " _srcdir="$srcdir"/u-boot-${pkgver//_/-} builddir="$srcdir"/build board_configs=" beagleboard:am335x_boneblack cubieboard:Cubieboard,Cubieboard2 raspberrypi:rpi,rpi_2,rpi_3_32b wandboard:wandboard " for board_config in $board_configs; do subpackages="$subpackages $pkgname-${board_config%%:*}" done depends="$subpackages" build() { cd "$_srcdir" 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 local board_config board for board_config in $board_configs; do local configs="${board_config#*:}" for board in ${configs//,/ }; do msg "Building u-boot for $board" export BUILD_DIR="$builddir"/$board mkdir -p "$BUILD_DIR" make O="$BUILD_DIR" ${board}_config || return 1 make O="$BUILD_DIR" all || return 1 done done } package() { cd "$builddir" mkdir -p "$pkgdir"/usr/share/$pkgname install "$srcdir"/README.txt "$pkgdir"/usr/share/$pkgname/README.txt } _split_boards() { cd "$builddir" pkgdesc="u-boot for $1" depends="" shift local board for board; do msg "Including board $board" mkdir -p "$subpkgdir"/usr/share/$pkgname/$board export BUILD_DIR="$builddir"/$board local ok=no for image in MLO SPL u-boot.img u-boot-sunxi-with-spl.bin; do if [ -e "$BUILD_DIR"/$image ]; then cp "$BUILD_DIR"/$image "$subpkgdir"/usr/share/$pkgname/$board \ || return 1 ok=yes fi done if [ "$ok" = "no" ]; then cp "$BUILD_DIR"/u-boot.bin "$subpkgdir"/usr/share/$pkgname/$board \ || return 1 fi done } for board_config in $board_configs; do local board="${board_config%%:*}" local configs="${board_config#*:}" eval "${board}() { _split_boards $board ${configs//,/ }; }" done md5sums="425a3fa610a7d972e5092a0e92276c70 u-boot-2016.07.tar.bz2 13684d0a2495da42144e1805fc5492d1 README.txt" sha256sums="974fb7225c0af6a721307631f66b81e20dbda82a4d7cc32aba2a625727231253 u-boot-2016.07.tar.bz2 80538ab8339bf84b8e3cfe8eb1cab9cb5d25bbecc6ba45824fb83e868df9160e README.txt" sha512sums="fa76dbd7e654ff9e4b3166162be6c0a77ecf2eb2a952b4865df3c818ebcdca7e2bb75e5ba19bf0346000c3d185888552193bb74510b115426cfe444b78efd3ef u-boot-2016.07.tar.bz2 f8c9bb6e84d6f0620c976ac7ad5dd7ec7ff9dfdd4b1d03d2bf6653e7beccf80bdf2debfc92fb1f696dba92fb40287d3c45897e0078951451d0835cb61a5f16d1 README.txt"