summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Rossi <nathan.rossi@xilinx.com>2014-07-08 16:44:57 +1000
committerNathan Rossi <nathan.rossi@xilinx.com>2014-10-27 17:58:43 +1000
commitad44189328569608bb50f7c7fdcac1c7466ce893 (patch)
treeece7ec15fb9a3cb6901db71c8b0e18a618c476c0
parent2add7980d34bf9f558c7ea87b79d07479d50c600 (diff)
downloadmeta-xilinx-ad44189328569608bb50f7c7fdcac1c7466ce893.tar.gz
device-tree: Add recipe for creating device tree blobs
* Using the linux-dtb.inc steps, create a recipe external from the kernel recipe to handle the building of device tree blobs. * For backwards compatibility create a symlink with the kernel imagetype Signed-off-by: Nathan Rossi <nathan.rossi@xilinx.com>
-rw-r--r--recipes-bsp/device-tree/device-tree.bb81
1 files changed, 81 insertions, 0 deletions
diff --git a/recipes-bsp/device-tree/device-tree.bb b/recipes-bsp/device-tree/device-tree.bb
new file mode 100644
index 00000000..f32566f1
--- /dev/null
+++ b/recipes-bsp/device-tree/device-tree.bb
@@ -0,0 +1,81 @@
1SUMMARY = "Device Trees for BSPs"
2DESCRIPTION = "Device Tree generation and packaging for BSP Device Trees."
3SECTION = "bsp"
4
5LICENSE = "MIT"
6LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
7
8INHIBIT_DEFAULT_DEPS = "1"
9PACKAGE_ARCH = "all"
10
11DEPENDS += "dtc-native"
12
13FILES_${PN} = "/boot/devicetree*"
14DEVICETREE_FLAGS ?= "-R 8 -p 0x3000"
15
16do_compile() {
17 if test -n "${MACHINE_DEVICETREE}"; then
18 mkdir -p ${WORKDIR}/devicetree
19 for i in ${MACHINE_DEVICETREE}; do
20 if test -e ${WORKDIR}/$i; then
21 echo cp ${WORKDIR}/$i ${WORKDIR}/devicetree
22 cp ${WORKDIR}/$i ${WORKDIR}/devicetree
23 fi
24 done
25 fi
26
27 for DTS_FILE in ${DEVICETREE}; do
28 DTS_NAME=`basename ${DTS_FILE} | awk -F "." '{print $1}'`
29 dtc -I dts -O dtb ${DEVICETREE_FLAGS} -o ${DTS_NAME}.dtb ${DTS_FILE}
30 done
31}
32
33do_install() {
34 for DTS_FILE in ${DEVICETREE}; do
35 if [ ! -f ${DTS_FILE} ]; then
36 echo "Warning: ${DTS_FILE} is not available!"
37 continue
38 fi
39 DTS_NAME=`basename ${DTS_FILE} | awk -F "." '{print $1}'`
40 install -d ${D}/boot/devicetree
41 install -m 0644 ${B}/${DTS_NAME}.dtb ${D}/boot/devicetree/${DTS_NAME}.dtb
42 done
43}
44
45do_deploy() {
46 for DTS_FILE in ${DEVICETREE}; do
47 if [ ! -f ${DTS_FILE} ]; then
48 echo "Warning: ${DTS_FILE} is not available!"
49 continue
50 fi
51 DTS_NAME=`basename ${DTS_FILE} | awk -F "." '{print $1}'`
52 install -d ${DEPLOY_DIR_IMAGE}
53 install -m 0644 ${B}/${DTS_NAME}.dtb ${DEPLOY_DIR_IMAGE}/${DTS_NAME}.dtb
54 done
55}
56
57# Deploy ${KERNEL_IMAGETYPE}-${DTS_NAME}.dtb for compatibility with runqemu
58DEPLOY_KERNEL_DTB_qemuzynq = "1"
59DEPLOY_KERNEL_DTB_qemumicroblaze = "1"
60do_deploy_append() {
61 if [ ! -z "${DEPLOY_KERNEL_DTB}" -a ! -z "${KERNEL_IMAGETYPE}" ]; then
62 for DTS_FILE in ${DEVICETREE}; do
63 DTS_NAME=`basename ${DTS_FILE} | awk -F "." '{print $1}'`
64 KERNELDTBPATH=${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTS_NAME}.dtb
65 if [ ! -e ${KERNELDTBPATH} -o -h ${KERNELDTBPATH} ]; then
66 ln -sf ${DTS_NAME}.dtb ${KERNELDTBPATH}
67 fi
68 done
69 fi
70}
71
72addtask deploy before do_build after do_install
73
74inherit xilinx-utils
75
76DEVICETREE ?= "${@expand_dir_basepaths_by_extension("MACHINE_DEVICETREE", os.path.join(d.getVar("WORKDIR", True), 'devicetree'), '.dts', d)}"
77FILESEXTRAPATHS_append := "${@get_additional_bbpath_filespath('conf/machine/boards', d)}"
78
79# Using the MACHINE_DEVICETREE and MACHINE_KCONFIG vars, append them to SRC_URI
80SRC_URI += "${@paths_affix(d.getVar("MACHINE_DEVICETREE", True) or '', prefix = 'file://')}"
81