From ad44189328569608bb50f7c7fdcac1c7466ce893 Mon Sep 17 00:00:00 2001 From: Nathan Rossi Date: Tue, 8 Jul 2014 16:44:57 +1000 Subject: 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 --- recipes-bsp/device-tree/device-tree.bb | 81 ++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 recipes-bsp/device-tree/device-tree.bb 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 @@ +SUMMARY = "Device Trees for BSPs" +DESCRIPTION = "Device Tree generation and packaging for BSP Device Trees." +SECTION = "bsp" + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +INHIBIT_DEFAULT_DEPS = "1" +PACKAGE_ARCH = "all" + +DEPENDS += "dtc-native" + +FILES_${PN} = "/boot/devicetree*" +DEVICETREE_FLAGS ?= "-R 8 -p 0x3000" + +do_compile() { + if test -n "${MACHINE_DEVICETREE}"; then + mkdir -p ${WORKDIR}/devicetree + for i in ${MACHINE_DEVICETREE}; do + if test -e ${WORKDIR}/$i; then + echo cp ${WORKDIR}/$i ${WORKDIR}/devicetree + cp ${WORKDIR}/$i ${WORKDIR}/devicetree + fi + done + fi + + for DTS_FILE in ${DEVICETREE}; do + DTS_NAME=`basename ${DTS_FILE} | awk -F "." '{print $1}'` + dtc -I dts -O dtb ${DEVICETREE_FLAGS} -o ${DTS_NAME}.dtb ${DTS_FILE} + done +} + +do_install() { + for DTS_FILE in ${DEVICETREE}; do + if [ ! -f ${DTS_FILE} ]; then + echo "Warning: ${DTS_FILE} is not available!" + continue + fi + DTS_NAME=`basename ${DTS_FILE} | awk -F "." '{print $1}'` + install -d ${D}/boot/devicetree + install -m 0644 ${B}/${DTS_NAME}.dtb ${D}/boot/devicetree/${DTS_NAME}.dtb + done +} + +do_deploy() { + for DTS_FILE in ${DEVICETREE}; do + if [ ! -f ${DTS_FILE} ]; then + echo "Warning: ${DTS_FILE} is not available!" + continue + fi + DTS_NAME=`basename ${DTS_FILE} | awk -F "." '{print $1}'` + install -d ${DEPLOY_DIR_IMAGE} + install -m 0644 ${B}/${DTS_NAME}.dtb ${DEPLOY_DIR_IMAGE}/${DTS_NAME}.dtb + done +} + +# Deploy ${KERNEL_IMAGETYPE}-${DTS_NAME}.dtb for compatibility with runqemu +DEPLOY_KERNEL_DTB_qemuzynq = "1" +DEPLOY_KERNEL_DTB_qemumicroblaze = "1" +do_deploy_append() { + if [ ! -z "${DEPLOY_KERNEL_DTB}" -a ! -z "${KERNEL_IMAGETYPE}" ]; then + for DTS_FILE in ${DEVICETREE}; do + DTS_NAME=`basename ${DTS_FILE} | awk -F "." '{print $1}'` + KERNELDTBPATH=${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}-${DTS_NAME}.dtb + if [ ! -e ${KERNELDTBPATH} -o -h ${KERNELDTBPATH} ]; then + ln -sf ${DTS_NAME}.dtb ${KERNELDTBPATH} + fi + done + fi +} + +addtask deploy before do_build after do_install + +inherit xilinx-utils + +DEVICETREE ?= "${@expand_dir_basepaths_by_extension("MACHINE_DEVICETREE", os.path.join(d.getVar("WORKDIR", True), 'devicetree'), '.dts', d)}" +FILESEXTRAPATHS_append := "${@get_additional_bbpath_filespath('conf/machine/boards', d)}" + +# Using the MACHINE_DEVICETREE and MACHINE_KCONFIG vars, append them to SRC_URI +SRC_URI += "${@paths_affix(d.getVar("MACHINE_DEVICETREE", True) or '', prefix = 'file://')}" + -- cgit v1.2.3-54-g00ecf