# U-Boot: Wandboard
# Maintainer: Isaac David <isacdaavid@at@isacdaavid@dot@info>
# Contributor: André Silva <emulatorman@hyperbola.info>

pkgname=uboot4extlinux-wandboard
pkgver=2015.10
pkgrel=4.1
pkgdesc="U-Boot with Extlinux support for Wandboard"
arch=('armv7h')
url="http://git.denx.de/u-boot.git/"
license=('GPL')
makedepends=('bc')
conflicts=('uboot-wandboard' 'uboot4grub-wandboard')
install=${pkgname}.install
source=("ftp://ftp.denx.de/pub/u-boot/u-boot-${pkgver}.tar.bz2"
        '0001-parabola-arm-modifications.patch'
        '0002-kernel-add-support-for-gcc-7.patch'
        'extlinux.conf')
sha256sums=('bdc68d5f9455ad933b059c735d983f2c8b6b552dafb062e5ff1444f623021955'
            'a49c942b3cd676ce3550d0f2cdb80086b5df0f74c669b11ba2420ebfc878dc8c'
            '9e80aa27cccdb07b03d56a970f247c91d586d0b936868c076c20acc2e68a3968'
            '6423fe8e131298f9827fecd48da5859bc876c27c7ed1e11bf95844f258c04626')

prepare() {
  cd u-boot-${pkgver}
  patch -Np1 -i ../0001-parabola-arm-modifications.patch
  patch -Np1 -i ../0002-kernel-add-support-for-gcc-7.patch
}

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

  unset LDFLAGS

  make distclean
  make wandboard_defconfig
  make
}

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

  mkdir -p "${pkgdir}"/boot/extlinux
  cp SPL u-boot.img "${pkgdir}"/boot
  cp "${srcdir}"/extlinux.conf "${pkgdir}"/boot/extlinux
}
