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 = "GPL-2.0-or-later"
LIC_FILES_CHKSUM = "file://Licenses/README;md5=2ca5f2c35c8cc335f0a19756634782f1"
PE = "1"

FILESEXTRAPATHS:prepend := "${THISDIR}/files_2023.04-marvell:"

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

# Patch from https://github.com/SolidRun/cn913x_build
# Git SHA: f33e2aeb01c7ee061be7b053035ae87ce30fce4a
SRC_URI = "git://source.denx.de/u-boot/custodians/u-boot-marvell.git;branch=master;protocol=https \
           ${@bb.utils.contains("IMAGE_FEATURES", "debug-tweaks", "file://debug-tweaks.cfg", "", d)} \
           file://uefi.cfg \
           file://uefi-secureboot.cfg \
           file://0001-add-support-for-cn9130-cf-pro-and-cn9130-bldn-mbv.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 "
