summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-kernel/linux/linux-dtb.inc58
1 files changed, 26 insertions, 32 deletions
diff --git a/meta/recipes-kernel/linux/linux-dtb.inc b/meta/recipes-kernel/linux/linux-dtb.inc
index 41dd599cae..cebc76a9a9 100644
--- a/meta/recipes-kernel/linux/linux-dtb.inc
+++ b/meta/recipes-kernel/linux/linux-dtb.inc
@@ -1,44 +1,38 @@
1# Support for device tree generation 1# Support for device tree generation
2FILES_kernel-devicetree = "/${KERNEL_IMAGEDEST}/devicetree*" 2FILES_kernel-devicetree = "/${KERNEL_IMAGEDEST}/devicetree*"
3KERNEL_DEVICETREE_FLAGS ?= "-R 8 -p 0x3000"
4 3
5python __anonymous () { 4python __anonymous () {
6 devicetree = d.getVar("KERNEL_DEVICETREE", True) or '' 5 d.appendVar("PACKAGES", " kernel-devicetree")
7 if devicetree:
8 depends = d.getVar("DEPENDS", True)
9 d.setVar("DEPENDS", "%s dtc-native" % depends)
10 packages = d.getVar("PACKAGES", True)
11 d.setVar("PACKAGES", "%s kernel-devicetree" % packages)
12} 6}
13 7
14do_install_append() { 8do_install_append() {
15 if test -n "${KERNEL_DEVICETREE}"; then 9 if test -n "${KERNEL_DEVICETREE}"; then
16 for DTS_FILE in ${KERNEL_DEVICETREE}; do 10 for DTB in ${KERNEL_DEVICETREE}; do
17 if [ ! -f ${DTS_FILE} ]; then 11 if echo ${DTB} | grep -q '/dts/'; then
18 echo "Warning: ${DTS_FILE} is not available!" 12 bbwarn "${DTB} contains the full path to the the dts file, but only the dtb name should be used."
19 continue 13 DTB=`basename ${DTB} | sed 's,\.dts$,.dtb,g'`
20 fi 14 fi
21 DTS_BASE_NAME=`basename ${DTS_FILE} | awk -F "." '{print $1}'` 15 DTB_BASE_NAME=`basename ${DTB} .dtb`
22 DTB_NAME=`echo ${KERNEL_IMAGE_BASE_NAME} | sed "s/${MACHINE}/${DTS_BASE_NAME}/g"` 16 DTB_NAME=`echo ${KERNEL_IMAGE_BASE_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
23 DTB_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME} | sed "s/${MACHINE}/${DTS_BASE_NAME}/g"` 17 DTB_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
24 dtc -I dts -O dtb ${KERNEL_DEVICETREE_FLAGS} -o ${DTS_BASE_NAME} ${DTS_FILE} 18 oe_runmake ${DTB}
25 install -m 0644 ${DTS_BASE_NAME} ${D}/${KERNEL_IMAGEDEST}/devicetree-${DTB_SYMLINK_NAME}.dtb 19 install -m 0644 ${B}/arch/${ARCH}/boot/${DTB} ${D}/${KERNEL_IMAGEDEST}/devicetree-${DTB_SYMLINK_NAME}.dtb
26 done 20 done
27 fi 21 fi
28} 22}
29 23
30do_deploy_append() { 24do_deploy_append() {
31 if test -n "${KERNEL_DEVICETREE}"; then 25 if test -n "${KERNEL_DEVICETREE}"; then
32 for DTS_FILE in ${KERNEL_DEVICETREE}; do 26 for DTB in ${KERNEL_DEVICETREE}; do
33 if [ ! -f ${DTS_FILE} ]; then 27 if echo ${DTB} | grep -q '/dts/'; then
34 echo "Warning: ${DTS_FILE} is not available!" 28 bbwarn "${DTB} contains the full path to the the dts file, but only the dtb name should be used."
35 continue 29 DTB=`basename ${DTB} | sed 's,\.dts$,.dtb,g'`
36 fi 30 fi
37 DTS_BASE_NAME=`basename ${DTS_FILE} | awk -F "." '{print $1}'` 31 DTB_BASE_NAME=`basename ${DTB} .dtb`
38 DTB_NAME=`echo ${KERNEL_IMAGE_BASE_NAME} | sed "s/${MACHINE}/${DTS_BASE_NAME}/g"` 32 DTB_NAME=`echo ${KERNEL_IMAGE_BASE_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
39 DTB_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME} | sed "s/${MACHINE}/${DTS_BASE_NAME}/g"` 33 DTB_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
40 install -d ${DEPLOYDIR} 34 install -d ${DEPLOYDIR}
41 install -m 0644 ${B}/${DTS_BASE_NAME} ${DEPLOYDIR}/${DTB_NAME}.dtb 35 install -m 0644 ${B}/arch/${ARCH}/boot/${DTB} ${DEPLOYDIR}/${DTB_NAME}.dtb
42 cd ${DEPLOYDIR} 36 cd ${DEPLOYDIR}
43 ln -sf ${DTB_NAME}.dtb ${DTB_SYMLINK_NAME}.dtb 37 ln -sf ${DTB_NAME}.dtb ${DTB_SYMLINK_NAME}.dtb
44 cd - 38 cd -
@@ -48,20 +42,20 @@ do_deploy_append() {
48 42
49pkg_postinst_kernel-devicetree () { 43pkg_postinst_kernel-devicetree () {
50 cd /${KERNEL_IMAGEDEST} 44 cd /${KERNEL_IMAGEDEST}
51 for DTS_FILE in ${KERNEL_DEVICETREE} 45 for DTB_FILE in ${KERNEL_DEVICETREE}
52 do 46 do
53 DTS_BASE_NAME=`basename ${DTS_FILE} | awk -F "." '{print $1}'` 47 DTB_BASE_NAME=`basename ${DTB_FILE} | awk -F "." '{print $1}'`
54 DTB_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME} | sed "s/${MACHINE}/${DTS_BASE_NAME}/g"` 48 DTB_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
55 update-alternatives --install /${KERNEL_IMAGEDEST}/${DTS_BASE_NAME}.dtb ${DTS_BASE_NAME}.dtb devicetree-${DTB_SYMLINK_NAME}.dtb ${KERNEL_PRIORITY} || true 49 update-alternatives --install /${KERNEL_IMAGEDEST}/${DTB_BASE_NAME}.dtb ${DTB_BASE_NAME}.dtb devicetree-${DTB_SYMLINK_NAME}.dtb ${KERNEL_PRIORITY} || true
56 done 50 done
57} 51}
58 52
59pkg_postrm_kernel-devicetree () { 53pkg_postrm_kernel-devicetree () {
60 cd /${KERNEL_IMAGEDEST} 54 cd /${KERNEL_IMAGEDEST}
61 for DTS_FILE in ${KERNEL_DEVICETREE} 55 for DTB_FILE in ${KERNEL_DEVICETREE}
62 do 56 do
63 DTS_BASE_NAME=`basename ${DTS_FILE} | awk -F "." '{print $1}'` 57 DTB_BASE_NAME=`basename ${DTB_FILE} | awk -F "." '{print $1}'`
64 DTB_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME} | sed "s/${MACHINE}/${DTS_BASE_NAME}/g"` 58 DTB_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME} | sed "s/${MACHINE}/${DTB_BASE_NAME}/g"`
65 update-alternatives --remove ${DTS_BASE_NAME}.dtb devicetree-${DTB_SYMLINK_NAME}.dtb ${KERNEL_PRIORITY} || true 59 update-alternatives --remove ${DTB_BASE_NAME}.dtb devicetree-${DTB_SYMLINK_NAME}.dtb ${KERNEL_PRIORITY} || true
66 done 60 done
67} 61}