summaryrefslogtreecommitdiffstats
path: root/meta-xilinx-standalone-sdt/recipes-bsp/sdt-artifacts/sdt-artifacts.bb
blob: c4f59ad5449a30fc889c45c614dbd2c7acdc52dd (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
SUMMARY = "Recipe to download SDT artifacts and extract to directory"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

PROVIDES = "virtual/sdt"

INHIBIT_DEFAULT_DEPS = "1"

inherit deploy image-artifact-names

# The user is expected to define SDT_URI, and SDT_URI[sha256sum].  Optionally
# they may also define SDT_URI[S] to define the unpacking path.
SDT_URI[doc] = "URI for the System Device Tree file(s), usually a tarball bundle of files"

# Add compatibility with previous gen-machine-conf output
SYSTEM_DTFILE_DIR ??= ""

SDT_URI ??= "${@'file://${SYSTEM_DTFILE_DIR}' if d.getVar('SYSTEM_DTFILE_DIR') else ''}"

SRC_URI = "${SDT_URI}"
SRC_URI[sha256sum] = "${@d.getVarFlag('SDT_URI', 'sha256sum') or 'undefined'}"

COMPATIBLE_HOST:xilinx-standalone = "${HOST_SYS}"
PACKAGE_ARCH ?= "${MACHINE_ARCH}"

# Don't set S = "${UNPACKDIR}/git" as we need this to work for other protocols
S = "${@d.getVarFlag('SDT_URI', 'S') or '${UNPACKDIR}'}"

do_configure[noexec] = "1"
do_compile[noexec] = "1"

python () {
    if not d.getVar('SDT_URI'):
        raise bb.parse.SkipRecipe("SDT_URI must be specified.  See recipe for instructions.")
}

do_install() {
    install -d ${D}${datadir}/sdt/${MACHINE}
    if [ "${S}" = "${UNPACKDIR}" ]; then
        # If we just copying everything, then we'll copy build components.
        # This fallback is for the case where the user provides each of the
        # files instead of a tarball.  It shouldn't be used, but is here just
        # in case.
        for files in ${S}/* ; do
            if [ -f $files ]; then
                cp --preserve=mode,timestamps $files ${D}${datadir}/sdt/${MACHINE}/.
            fi
        done
    else
        cp --preserve=mode,timestamps -R ${S}/* ${D}${datadir}/sdt/${MACHINE}/.
    fi
}

# Artifacts has plm.elf, psm.elf or other aie elf hence we need to strip and skip
# the packages.
INSANE_SKIP += "arch"
INHIBIT_SYSROOT_STRIP = "1"
INHIBIT_PACKAGE_STRIP = "1"
INHIBIT_PACKAGE_DEBUG_SPLIT = "1"

FILES:${PN} = "${datadir}/sdt/${MACHINE}"

do_deploy() {
    install -d ${DEPLOYDIR}/system-dt${IMAGE_VERSION_SUFFIX}
    if [ "${S}" = "${UNPACKDIR}" ]; then
        # If we just copying everything, then we'll copy build components.
        # This fallback is for the case where the user provides each of the
        # files instead of a tarball.  It shouldn't be used, but is here just
        # in case.
        for files in ${S}/* ; do
            if [ -f $files ]; then
                cp --preserve=mode,timestamps $files ${DEPLOYDIR}/system-dt${IMAGE_VERSION_SUFFIX}/.
            fi
        done
    else
        cp --preserve=mode,timestamps -R ${S}/* ${DEPLOYDIR}/system-dt${IMAGE_VERSION_SUFFIX}/.
    fi
    ln -s system-dt${IMAGE_VERSION_SUFFIX} ${DEPLOYDIR}/system-dt
}

addtask deploy after do_install before do_build