# U-Boot: TrimSlice
# Maintainer: André Silva <emulatorman@hyperbola.info>

buildarch=4

pkgname=uboot-trimslice
pkgver=2014.10
pkgrel=1.parabola1
pkgdesc="U-Boot for TrimSlice"
arch=('armv7h')
url="http://git.denx.de/u-boot.git/"
makedepends=('cbootimage' 'dtc' 'uboot-tools')
depends=('linux-libre')
replaces=('uboot-trimslice-linux-libre')
conflicts=('uboot4extlinux-trimslice' 'uboot4grub-trimslice')
license=('GPL')
source=("ftp://ftp.denx.de/pub/u-boot/u-boot-${pkgver}.tar.bz2"
        "git+https://github.com/NVIDIA/cbootimage-configs.git"
        "boot.txt"
        "0001-kernel-add-support-for-gcc-5.patch")
md5sums=('3ddcaee2f05b7c464778112ec83664b5'
         'SKIP'
         '9374fbadb4b4c1298ea050ad4ea79f46'
         '721a46867e189d8dedc6b6f86a536a34')

prepare() {
  cd u-boot-${pkgver}

  patch -Np1 -i ../0001-kernel-add-support-for-gcc-5.patch
}

build() {
  cd u-boot-${pkgver}

  unset LDFLAGS

  make distclean 
  make trimslice_config
  make
}

package() {
  mkdir -p "${pkgdir}"/boot
  mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "TrimSlice" -d boot.txt "${pkgdir}"/boot/boot.scr
  cp boot.txt "${pkgdir}"/boot

  cd cbootimage-configs/tegra20/compulab/trimslice
  ln -s ${srcdir}/u-boot-${pkgver}/u-boot-dtb-tegra.bin u-boot.bin
  ./build.sh

  cp trimslice-mmc.img trimslice-spi.img "${pkgdir}"/boot
}
