blob: 4f84c50b6d7b2b826638c6fed4ba11b245bcab14 (
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
DESCRIPTION = "Recipe to copy and install externally built XSA to deploy"
LICENSE = "CLOSED"
PROVIDES = "virtual/hdf"
INHIBIT_DEFAULT_DEPS = "1"
inherit deploy
# HDF_BASE - file protocol
# HDF_PATH - Path to git repository, or file in question
# HDF_NAME - Path to the XSA file once downloaded (must be inside WORKDIR) (See anon python)
HDF_BASE ??= "git://"
HDF_PATH ??= "github.com/Xilinx/hdf-examples.git"
HDF_NAME ??= ""
BRANCH ??= "xlnx_rel_v2022.1"
SRCREV ??= "e7669d3aaca520c0c1bc2c9a64c67864daafb499"
BRANCHARG ??= "${@['nobranch=1', 'branch=${BRANCH}'][d.getVar('BRANCH', True) != '']}"
# Only 'xsa' is currently supported here
HDF_EXT ?= "xsa"
# Provide a way to extend the SRC_URI, default to adding protocol=https for git:// usage.
HDF_EXTENSION ?= "${@';protocol=https' if d.getVar('HDF_BASE') == 'git://' else ''}"
SRC_URI = "${HDF_BASE}${HDF_PATH};${BRANCHARG}${HDF_EXTENSION}"
# Above is the last change fallback. The include file, if it exists, is the current xsa files
include hdf-repository.inc
COMPATIBLE_HOST:xilinx-standalone = "${HOST_SYS}"
PACKAGE_ARCH ?= "${MACHINE_ARCH}"
# Don't set S = "${WORKDIR}/git" as we need this to work for other protocols
# HDF_NAME will be adjusted to include /git if needed
S = "${WORKDIR}"
do_configure[noexec] = "1"
do_compile[noexec] = "1"
do_install[noexec] = "1"
python () {
if (d.getVar('HDF_EXT') != 'xsa'):
raise bb.parse.SkipRecipe("Only XSA format is supported in Vivado tool starting from 2019.2 release")
if (not d.getVar("HDF_NAME")):
if d.getVar('HDF_BASE') == 'git://':
# git:// default to ${HDF_MACHINE}/system.xsa
hdf_name = '${S}/git/${HDF_MACHINE}/system.xsa'
elif d.getVar('HDF_BASE') == 'file://':
# file:// default to the full path
hdf_name = "${S}/${HDF_PATH}"
else:
# Look for the downloadfilename and user it if defined
# the key is that HDF_MACHINE is the name= field.
hdf_filename = os.path.basename(d.getVar('HDF_PATH'))
for url in d.getVar('SRC_URI').split():
filename = hdf_filename
done = False
for chunk in url.split(';'):
if chunk.startswith('downloadfilename='):
filename=chunk[17:]
continue
if chunk.startswith('name='):
if chunk[5:] == d.getVar('HDF_MACHINE'):
done = True
if done:
hdf_filename = filename
break
# Everyone else default to the basename of the HDF_PATH
hdf_name = "${S}/%s" % hdf_filename
d.setVar('HDF_NAME', hdf_name)
# Must be in S, this ensures that the build environment is aware of the file for checksuming
# set HDF_BASE = "file://" and HDF_PATH to the local disk path instead
if not d.getVar('HDF_NAME').startswith(d.getVar('S')):
raise bb.parse.SkipRecipe("HDF_NAME must be in the S directory, did you mean to set HDF_PATH instead?")
}
do_check() {
if [ ! -f ${HDF_NAME} ]; then
bbfatal "Unable to find ${HDF_NAME}. Verify HDF_BASE, HDF_PATH and HDF_NAME."
fi
}
HDF_MACHINE ?= "${MACHINE}"
do_install() {
install -d ${D}/opt/xilinx/hw-design
install -m 0644 ${HDF_NAME} ${D}/opt/xilinx/hw-design/design.${HDF_EXT}
}
do_deploy() {
install -d ${DEPLOYDIR}
install -m 0644 ${HDF_NAME} ${DEPLOYDIR}/Xilinx-${MACHINE}.${HDF_EXT}
}
addtask do_check before do_deploy after do_patch
addtask do_deploy after do_install
PACKAGES = ""
FILES:${PN}= "/opt/xilinx/hw-design/design.${HDF_EXT}"
SYSROOT_DIRS += "/opt"
|