HOMEPAGE = "http://www.denx.de/wiki/U-Boot/WebHome"
DESCRIPTION = "U-Boot, a boot loader for Embedded boards based on PowerPC, \
ARM, MIPS and several other processors, which can be installed in a boot \
ROM and used to initialize and test the hardware or to download and run \
application code."
SECTION = "bootloaders"
DEPENDS += "flex-native bison-native"

COMPATIBLE_MACHINE = "cn913x"

LICENSE = "GPLv2+"
LIC_FILES_CHKSUM = "file://Licenses/README;md5=30503fd321432fc713238f582193b78e"
PE = "1"

FILESEXTRAPATHS:prepend := "${THISDIR}/files_2019.10-solidrun:"

# We use the revision in order to avoid having to fetch it from the
# repo during parse
SRCREV = "61ba1244b548463dbfb3c5285b6b22e7c772c5bd"

# Patch from https://github.com/SolidRun/cn913x_build
# Git SHA: f33e2aeb01c7ee061be7b053035ae87ce30fce4a
SRC_URI = "git://git.denx.de/u-boot.git;branch=master \
           file://solidrun/0001-cmd-add-tlv_eeprom-command.patch \
           file://solidrun/0002-cmd-tlv_eeprom.patch \
           file://solidrun/0003-cmd-tlv_eeprom-remove-use-of-global-variable-current.patch \
           file://solidrun/0004-cmd-tlv_eeprom-remove-use-of-global-variable-has_bee.patch \
           file://solidrun/0005-cmd-tlv_eeprom-do_tlv_eeprom-stop-using-non-api-read.patch \
           file://solidrun/0006-cmd-tlv_eeprom-convert-functions-used-by-command-to-.patch \
           file://solidrun/0007-cmd-tlv_eeprom-remove-empty-function-implementations.patch \
           file://solidrun/0008-cmd-tlv_eeprom-split-off-tlv-library-from-command.patch \
           file://solidrun/0009-lib-tlv_eeprom-add-function-for-reading-one-entry-in.patch \
           file://solidrun/0010-uboot-marvell-patches.patch \
           file://solidrun/0011-uboot-support-cn913x-solidrun-paltfroms.patch \
           file://solidrun/0012-add-SoM-and-Carrier-eeproms.patch \
           file://solidrun/0013-find-fdtfile-from-tlv-eeprom.patch \
           file://solidrun/0014-octeontx2_cn913x-support-distro-boot.patch \
           file://solidrun/0015-octeontx2_cn913x-remove-console-variable.patch \
           file://solidrun/0016-octeontx2_cn913x-enable-mmc-partconf-command.patch \
           file://solidrun/0017-uboot-add-support-cn9131-cf-solidwan.patch \
           file://solidrun/0018-uboot-add-support-bldn-mbv.patch \
           file://0001-Remove-redundant-YYLOC-global-declaration.patch \
           file://0001-sr_cn913x_cex7-enable-more-image-formats.patch \
           file://0021-octeontx2_cn913x-increase-CONFIG_SYS_BOOTM_LEN-to-32.patch \
           file://0001-sr_cn913x_cex7-enable-VERSION_VARIABLE.patch \
           file://cn913x.cfg \
           file://0001-cn9130-fix-compatible-node-inside-dts.patch \
           file://0001-cn9130-fix-compatible-node-inside-dts-pt-2.patch \
           "

S = "${WORKDIR}/git"

require recipes-bsp/u-boot/u-boot.inc
require recipes-bsp/u-boot/u-boot-coreos.inc

# Solidrun patches require to build out-of-the-tree
B = "${WORKDIR}/build"

DEPENDS += "bc-native dtc-native u-boot-mkimage-native"

do_compile:prepend() {
    export DEVICE_TREE="${UBOOT_BUILDENV_DEVICE_TREE}"
}

SYSROOT_DIRS +=  " /boot "
