summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel
diff options
context:
space:
mode:
authorOtavio Salvador <otavio@ossystems.com.br>2013-08-13 10:52:35 -0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-08-16 11:14:30 +0100
commit03b3e4b62f22a8ef435252c0401c5369defabe71 (patch)
treeddbee23e31f15baa2dcc278193fedfa2a353f0e4 /meta/recipes-kernel
parent53729ac53fca26dd8f3d3042bd1966392de3b2d2 (diff)
downloadpoky-03b3e4b62f22a8ef435252c0401c5369defabe71.tar.gz
linux-dtb: Use kernel build system to generate the dtb files
As the Linux kernel, unconditionally, builds the dtc application and it is the compatible version with the DeviceTree files shipped within the kernel it is better to use it and the kernel build system to generate the dtb files. Some DeviceTree files rely on CPP and kernel headers to be able to generate the dtb binary contents and it is harder to replicate it outside of Linux kernel build system so we /use/ it. To comply with these assumptions we need to use the dtb file when calling 'make' instead of pointing to the DeviceTree source file; the code has been made backward compatible but it is advised to move to the new definition to avoid warnings as: ,----[ Original definition ] | KERNEL_DEVICETREE = "${S}/arch/arm/boot/dts/imx6q-sabresd.dts" `---- Becomes: ,----[ New definition ] | KERNEL_DEVICETREE = "imx6q-sabresd.dtb" `---- (From OE-Core rev: 72980d5bb465f0640ed451d1ebb9c5d2a210ad0c) Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-kernel')
-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}