# Contributor: He Yangxuan # Contributor: William Pitcock # Contributor: Timo Teras # Maintainer: Leonardo Arena pkgname=u-boot pkgver=2018.05 pkgrel=3 _atfversion="c9f55c023164a6c8c49f70f7ac6c68c626839d6f" pkgdesc="u-boot bootloader common files" url="http://www.denx.de/wiki/U-Boot/" arch="armhf aarch64" license="GPL-2.0" depends="" depends_dev="" makedepends="$depends_dev bc dtc python2-dev swig binutils coreutils" install="" source="ftp://ftp.denx.de/pub/u-boot/u-boot-${pkgver//_/-}.tar.bz2 arm-trusted-firmware-${_atfversion}.tar.gz::https://github.com/apritzel/arm-trusted-firmware/archive/${_atfversion}.tar.gz README.txt update-u-boot sopine-baseboard.patch " builddir="$srcdir"/u-boot-${pkgver//_/-} atfbuilddir="$srcdir"/arm-trusted-firmware-${_atfversion} case "$CARCH" in armhf) board_configs=" beagleboard:am335x_boneblack cubieboard:Cubieboard,Cubieboard2 cuboxi:mx6cuboxi raspberrypi:rpi_0_w,rpi,rpi_2,rpi_3_32b wandboard:wandboard ";; aarch64) board_configs=" thunderx:thunderx_88xx raspberrypi:rpi_3 pine64:sopine_baseboard ";; esac _allboards="" for board_config in $board_configs; do _allboards="$_allboards $pkgname-${board_config%%:*}" done subpackages="$pkgname-all:_all $_allboards" build() { if [ "$CARCH" = "aarch64" ]; then export LDFLAGS="" msg "Building ARM trusted firmware for allwinner" cd "$atfbuilddir" make PLAT=sun50iw1p1 DEBUG=1 bl31 export BL31="$atfbuilddir"/build/sun50iw1p1/debug/bl31.bin fi cd "$builddir" 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"/build/$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"/build mkdir -p "$pkgdir"/usr/share/$pkgname "$pkgdir"/usr/sbin install "$srcdir"/README.txt "$pkgdir"/usr/share/$pkgname/README.txt || return 1 install "$srcdir"/update-u-boot "$pkgdir"/usr/sbin || return 1 } _all() { pkgdesc="u-boot for all boards (meta package)" depends="$_allboards" mkdir -p "$subpkgdir"/ } _split_boards() { cd "$builddir"/build pkgdesc="u-boot for $1" depends="u-boot" shift local board for board; do msg "Including board $board" mkdir -p "$subpkgdir"/usr/share/$pkgname/$board export BUILD_DIR="$builddir"/build/$board local ok=no for image in u-boot-sunxi-with-spl.bin -- MLO SPL u-boot.img -- u-boot.bin; do if [ "$image" = "--" ]; then [ "$ok" = yes ] && break continue fi if [ -e "$BUILD_DIR"/$image ]; then cp "$BUILD_DIR"/$image "$subpkgdir"/usr/share/$pkgname/$board \ || return 1 ok=yes fi done [ "$ok" = yes ] || return 1 done } for board_config in $board_configs; do _board="${board_config%%:*}" _configs="${board_config#*:}" eval "${_board}() { _split_boards $_board ${_configs//,/ }; }" done sha512sums="218f71282c9d027b0faf210ce2d4d713779e0c61ea4a23f03d5dec0ca8836a3c26b46c5e258d583834f5b5a2f4663f98729ca4b0101a60f85457eb892f8370d2 u-boot-2018.05.tar.bz2 e964f0903f29a08d3a4a3177bcbfa9df68f47d30cac7f0d2597a7101c00632efdcd2c6ecba7f8be2e66a9689388bf2fa03087c0023ef99a5e1d080af5518d53c arm-trusted-firmware-c9f55c023164a6c8c49f70f7ac6c68c626839d6f.tar.gz f8c9bb6e84d6f0620c976ac7ad5dd7ec7ff9dfdd4b1d03d2bf6653e7beccf80bdf2debfc92fb1f696dba92fb40287d3c45897e0078951451d0835cb61a5f16d1 README.txt f3bb656bbd13caf10a8ea619bc08b439e7dc27526c9cbdfa0374f4f8e277632ff4df06b34d441d6723a93d4a54aa03465d4270c44219d6a150d416b9c56edbbe update-u-boot 50b19c0452d58ff80dfd2643330bbfe2349db687af258e5cb61f3872e0cac800df160baee7d6b0133bcc8b60d743a03e513db62a1917388101cfdea634424ae4 sopine-baseboard.patch"