# Adaptation from u-boot-common_${PV}.inc

HOMEPAGE = "http://www.denx.de/wiki/U-Boot/WebHome"
SECTION = "bootloaders"

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

DEPENDS += "dtc-native bc-native"
DEPENDS += "flex-native bison-native"

COMPATIBLE_MACHINE = "(stm32mpcommon)"

SRC_URI = "https://github.com/u-boot/u-boot/archive/v${PV}.tar.gz"
SRC_URI[md5sum] = "7ee14909d5d4d701fd3a6b12aad4d762"
SRC_URI[sha256sum] = "33b5cf99bac91d678ed6708be7b7cbbed36c45eb071e6228f83c25ad3a1de13a"

SRC_URI += " \
    file://0001-ARM-v2018.11-stm32mp-r1-MACHINE.patch \
    file://0002-ARM-v2018.11-stm32mp-r1-BOARD.patch \
    file://0003-ARM-v2018.11-stm32mp-r1-DEVICETREE.patch \
    file://0004-ARM-v2018.11-stm32mp-r1-CONFIG.patch \
    file://0005-ARM-v2018.11-stm32mp-r1-MISC.patch \
    file://0006-ARM-v2018.11-stm32mp-r2-MACHINE.patch \
    file://0007-ARM-v2018.11-stm32mp-r2-DEVICETREE.patch \
    file://0008-ARM-v2018.11-stm32mp-r2-MISC.patch \
    "

PV = "2018.11"

S = "${WORKDIR}/u-boot-${PV}"

# ---------------------------------
# Configure devupstream class usage
# ---------------------------------
BBCLASSEXTEND = "devupstream:target"

SRC_URI_class-devupstream = "git://github.com/STMicroelectronics/u-boot.git;protocol=https;branch=v2018.11-stm32mp"
SRCREV_class-devupstream = "a120b9bdb3e656bb2f0485924d77d58e2281311a"

# ---------------------------------
# Configure default preference to manage dynamic selection between tarball and github
# ---------------------------------
STM32MP_SOURCE_SELECTION ?= "tarball"

DEFAULT_PREFERENCE = "${@bb.utils.contains('STM32MP_SOURCE_SELECTION', 'github', '-1', '1', d)}"
