# Copyright (C) 2012-2016 O.S. Systems Software LTDA.
# Released under the MIT license (see COPYING.MIT for the terms)

SUMMARY = "U-boot recipe for Rigado Vesta board"

require recipes-bsp/u-boot/u-boot.inc
inherit fsl-u-boot-localversion

DEBUG_BUILD="1"

LICENSE = "GPLv2+"
LIC_FILES_CHKSUM = "file://Licenses/README;md5=a2c678cfd4a4d97135585cad908541c6"

LOCALVERSION = "+vesta"

PV = "v2016.03+git${SRCPV}"

PROVIDES += "u-boot"

SRCBRANCH = "imx_v2016.03_4.1.15_2.0.0_ga"

#Always update SRCREV based on your last commit
SRCREV = "a57b13b942d59719e3621179e98bd8a0ab235088"

SRC_URI = "git://git.freescale.com/imx/uboot-imx.git;protocol=git;branch=${SRCBRANCH}"
SRC_URI += "file://0001-Initial-commit-of-porting-efforts-from-Rigado.patch"
SRC_URI += "file://0002-Added-changes-to-detect-board-type-in-run-time.patch"
SRC_URI += "file://0003-Changes-to-individual-defconfigs.patch"
SRC_URI += "file://0004-Removed-redundant-environment-variable-entries.patch"
SRC_URI += "file://0005-Added-CPU-based-board-detection-logic.patch"
SRC_URI += "file://0006-Added-defconfig-for-general-machine.patch"
SRC_URI += "file://0007-GCC-6.4-compatibility-fix.patch"
SRC_URI += "file://0008-Added-support-for-SPI-flash-chips-MACRONIX-SPANSION.patch"
SRC_URI += "file://0009-Added-defconfig-for-boards-with-qspi-flash.patch"
SRC_URI += "file://0010-BugFix-Added-board-id-of-300B.patch"
SRC_URI += "file://0011-Enable_retry_Disable_bootdelay.patch"
SRC_URI += "file://0012-Fix_multiple_definition_warning.patch"
SRC_URI += "file://0013-Rename-300B-to-500.patch"
SRC_URI += "file://qspi-header"

S = "${WORKDIR}/git"

PACKAGE_ARCH = "${MACHINE_ARCH}"

COMPATIBLE_MACHINE = "(vesta|imx6ul|imx6ull)"

do_pack_uboot () {
	install -m 0777 ${WORKDIR}/qspi-header ${DEPLOY_DIR_IMAGE}

	cd ${DEPLOY_DIR_IMAGE}
	cp u-boot-vesta-general.imx-qspi u-boot.qspi
	cp u-boot-vesta-general.imx-sd u-boot.sd
	tar -czvf u-boot.tar.bz2 u-boot.sd u-boot.qspi qspi-header
}

addtask do_pack_uboot after do_deploy before do_build