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

buildarch=4

pkgname=uboot4grub-am335x_bone
pkgver=2015.04
pkgrel=4
pkgdesc="U-Boot with GRUB support for BeagleBone and BeagleBone Black"
arch=('armv7h')
url="http://git.denx.de/u-boot.git/"
depends=('grub-am335x_bone')
conflicts=('uboot-beaglebone-linux-libre' 'uboot-beaglebone-linux-libre-lts'
           'uboot-beaglebone-linux-libre-grsec' 'uboot-beaglebone-linux-libre-pck'
           'uboot-beaglebone' 'uboot-am335x_bone' 'uboot4extlinux-am335x_bone')
makedepends=('bc')
license=('GPL')
install=${pkgname}.install
source=("ftp://ftp.denx.de/pub/u-boot/u-boot-${pkgver}.tar.bz2"
        '0001-parabola-arm-modifications+grub-support.patch'
        'uEnv.txt')
md5sums=('570bdc2c47270c2a98ca60ff6c5c74cd'
         '109779c2b15013d54dc2f576651219e4'
         'ccb79775b81654e16fca18825c7f2506')

prepare() {
  cd u-boot-${pkgver}
  patch -Np1 -i ../0001-parabola-arm-modifications+grub-support.patch
}

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

  unset CFLAGS CXXFLAGS LDFLAGS

  make distclean
  make am335x_evm_config
  make
}

package() {
  cd u-boot-${pkgver}
  mkdir -p "${pkgdir}"/boot
  cp MLO u-boot.img "${srcdir}"/uEnv.txt "${pkgdir}"/boot
}
