aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-bsp/uboot-device-tree/uboot-device-tree.bb
blob: f251b8859360f3ff70b3dfe1b13e8e5bec7c6da6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
SUMMARY = "Xilinx BSP u-boot device trees"
DESCRIPTION = "Xilinx BSP u-boot device trees from within layer."
SECTION = "bsp"

LICENSE = "MIT & GPLv2"
LIC_FILES_CHKSUM = " \
                file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302 \
                file://${COMMON_LICENSE_DIR}/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6 \
                "

require recipes-bsp/device-tree/device-tree.inc
inherit devicetree xsctdt xsctyaml

PROVIDES = "virtual/uboot-dtb"

S = "${WORKDIR}/git"
DT_VERSION_EXTENSION ?= "xilinx-${XILINX_RELEASE_VERSION}"
PV = "${DT_VERSION_EXTENSION}+git${SRCPV}"

PACKAGE_ARCH ?= "${MACHINE_ARCH}"

COMPATIBLE_MACHINE ?= "^$"
COMPATIBLE_MACHINE:zynqmp = ".*"
COMPATIBLE_MACHINE:zynq = ".*"
COMPATIBLE_MACHINE:versal = ".*"

XSCTH_BUILD_CONFIG ?= ""

DT_FILES_PATH = "${XSCTH_WS}/${XSCTH_PROJ}"
DT_INCLUDE:append = " ${WORKDIR}"
DT_PADDING_SIZE = "0x1000"

UBOOT_DTS ?= ""
XSCTH_MISC = " -hdf_type ${HDF_EXT}"
XSCTH_APP = "device-tree"
YAML_DT_BOARD_FLAGS:zynqmp ?= ""
YAML_DT_BOARD_FLAGS:versal ?= ""
YAML_DT_BOARD_FLAGS:zynq ?= ""
UBOOT_DTS_NAME = "uboot-device-tree"

do_configure[dirs] += "${DT_FILES_PATH}"
SRC_URI:append = "${@" ".join(["file://%s" % f for f in (d.getVar('UBOOT_DTS') or "").split()])}"

do_configure:prepend () {
    if [ ! -z "${UBOOT_DTS}" ]; then
        for f in ${UBOOT_DTS}; do
            cp  ${WORKDIR}/${f} ${DT_FILES_PATH}/
        done
        return
    fi
}


SRC_URI:append = "${@bb.utils.contains('MACHINE_FEATURES', 'provencore', ' file://pnc.dtsi', '', d)}"
do_configure:append() {
    if [ ${@bb.utils.contains('MACHINE_FEATURES', 'provencore', 'true', '', d)} ]; then
        echo '#include "pnc.dtsi"' >> ${DT_FILES_PATH}/system-top.dts
    fi
}

#Both linux dtb and uboot dtb are installing
#system-top.dtb for uboot env recipe while do_prepare_recipe_sysroot
#moving system-top.dts to othername.
do_compile:prepend() {
    import shutil
    listpath = d.getVar("DT_FILES_PATH")
    if os.path.exists(os.path.join(listpath, "system.dts")):
        os.remove(os.path.join(listpath, "system.dts"))
    for file in os.listdir(listpath):
        try:
            if file.endswith(".dts"):
                shutil.move(os.path.join(listpath, file), os.path.join(listpath, d.getVar("UBOOT_DTS_NAME") + ".dts"))
        except OSError:
            pass
}

do_install() {
    for DTB_FILE in `ls *.dtb`; do
        install -Dm 0644 ${B}/${DTB_FILE} ${D}/boot/devicetree/${DTB_FILE}
    done
}


do_deploy() {
    for DTB_FILE in `ls *.dtb`; do
        install -Dm 0644 ${B}/${DTB_FILE} ${DEPLOYDIR}/${DTB_FILE}
    done
}