Skip to contentSkip to conversation

linux: factor dts/dtc/dtb handling into a specific include

PATCH In review Bruce Ashfield 3 participants 7 messages Feb 9, 2011 – Feb 11, 2011

lore
Share & tools
lore
#0 lore raw

cover linux: factor dts/dtc/dtb handling into a specific include

Richard/Saul,

This fixes BUGID 610, and kicks off a bit of cleaning with the various kernel include files. Patch 1/3 says it all:

[
The powerpc linux-yocto kernels were not creating dtb images in the deploy directories. This was due to two problems:

- the dtb generation rules were not being configured
- the boards were not specifying a device tree in their config

This change addresses the first point by factoring out the dtb generation routines into a new include that can be used by multiple recipes.
]

With these changes I've built and generated a dtb for the mpc8315-rdb.

Pull URL: git://git.pokylinux.org/poky-contrib.git
Branch: zedd/dtb
Browse: http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=zedd/dtb

Thanks,
Bruce Ashfield <[email protected]>
---

Bruce Ashfield (3):
linux: factor dts/dtc/dtb handling into a specific include
dtc: add LIC_FILES_CHKSUM to dtc-native
mpc8315-rdb: add dtb generation configuration

 meta/conf/machine/mpc8315e-rdb.conf       |    1 +
 meta/recipes-kernel/dtc/dtc-native_git.bb |    3 +++
 meta/recipes-kernel/linux/linux-dtb.inc   |   27 +++++++++++++++++++++++++++
 meta/recipes-kernel/linux/linux-yocto.inc |    1 +
 meta/recipes-kernel/linux/linux.inc       |   27 +--------------------------
 5 files changed, 33 insertions(+), 26 deletions(-)
 create mode 100644 meta/recipes-kernel/linux/linux-dtb.inc
#1 lore raw

PATCH 1/3 linux: factor dts/dtc/dtb handling into a specific include

Fixes [BUGID #610]

The powerpc linux-yocto kernels were not creating dtb images in the deploy directories. This was due to two problems:

- the dtb generation rules were not being configured
- the boards were not specifying a device tree in their config

This change addresses the first point by factoring out the dtb generation routines into a new include that can be used by multiple recipes.

---
 meta/recipes-kernel/linux/linux-dtb.inc   |   27 +++++++++++++++++++++++++++
 meta/recipes-kernel/linux/linux-yocto.inc |    1 +
 meta/recipes-kernel/linux/linux.inc       |   27 +--------------------------
 3 files changed, 29 insertions(+), 26 deletions(-)
 create mode 100644 meta/recipes-kernel/linux/linux-dtb.inc
meta/recipes-kernel/linux/linux-dtb.inc new file +27 -0
new file mode 100644
index 0000000..0b27d18
@@ -0,0 +1,27 @@
+# Support for device tree generation
+FILES_kernel_devicetree = "/boot/devicetree*"
+KERNEL_DEVICETREE_FLAGS = "-R 8 -p 0x3000"
+
+python __anonymous () {
+    import bb
+
+    devicetree = bb.data.getVar("KERNEL_DEVICETREE", d, 1) or ''
+    if devicetree:
+	depends = bb.data.getVar("DEPENDS", d, 1)
+	bb.data.setVar("DEPENDS", "%s dtc-native" % depends, d)
+	packages = bb.data.getVar("PACKAGES", d, 1)
+	bb.data.setVar("PACKAGES", "%s kernel-devicetree" % packages, d)
+}
+
+do_install_append() {
+    if test -n "${KERNEL_DEVICETREE}"; then
+	dtc -I dts -O dtb ${KERNEL_DEVICETREE_FLAGS} -o devicetree ${KERNEL_DEVICETREE}
+	install -m 0644 devicetree ${D}/boot/devicetree-${KERNEL_VERSION}
+	install -d ${DEPLOY_DIR_IMAGE}
+	install -m 0644 devicetree ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGE_BASE_NAME}.dtb
+	cd ${DEPLOY_DIR_IMAGE}
+	rm -f ${KERNEL_IMAGE_SYMLINK_NAME}.dtb
+	ln -sf ${KERNEL_IMAGE_BASE_NAME}.dtb ${KERNEL_IMAGE_SYMLINK_NAME}.dtb
+    fi
+}
+
meta/recipes-kernel/linux/linux-yocto.inc +1 -0
index 03935fa..0812144 100644
@@ -18,5 +18,6 @@ addtask kernel_configme before do_configure after do_patch
 
 # Pick up shared functions
 inherit kernel-yocto
+require linux-dtb.inc
 
 B = "${WORKDIR}/linux-${MACHINE}-${LINUX_KERNEL_TYPE}-build"
meta/recipes-kernel/linux/linux.inc +1 -26
index 93859bb..726d3d6 100644
@@ -3,6 +3,7 @@ SECTION = "kernel"
 LICENSE = "GPL"
 
 inherit kernel
+require linux-dtb.inc
 
 DEPENDS_append_em-x270 = " mtd-utils "
 
@@ -15,21 +16,6 @@ CMDLINE_at91sam9263ek = "mem=64M console=ttyS0,115200 root=/dev/mmcblk0p1 rootfs
 #boot from nfs
 #CMDLINE_at91sam9263ek = "mem=64M console=ttyS0,115200 root=301 root=/dev/nfs nfsroot=172.20.3.1:/data/at91 ip=172.20.0.5:::255.255.0.0"
 
-# Support for device tree generation
-FILES_kernel_devicetree = "/boot/devicetree*"
-KERNEL_DEVICETREE_FLAGS = "-R 8 -p 0x3000"
-
-python __anonymous () {
-    import bb
-
-    devicetree = bb.data.getVar("KERNEL_DEVICETREE", d, 1) or ''
-    if devicetree:
-        depends = bb.data.getVar("DEPENDS", d, 1)
-        bb.data.setVar("DEPENDS", "%s dtc-native" % depends, d)
-        packages = bb.data.getVar("PACKAGES", d, 1)
-        bb.data.setVar("PACKAGES", "%s kernel-devicetree" % packages, d)
-}
-
 do_configure_prepend() {
         echo "" > ${S}/.config
 
@@ -105,14 +91,3 @@ do_install_prepend() {
         fi
 }
 
-do_install_append() {
-    if test -n "${KERNEL_DEVICETREE}"; then
-        dtc -I dts -O dtb ${KERNEL_DEVICETREE_FLAGS} -o devicetree ${KERNEL_DEVICETREE}
-        install -m 0644 devicetree ${D}/boot/devicetree-${KERNEL_VERSION}
-        install -d ${DEPLOY_DIR_IMAGE}
-        install -m 0644 devicetree ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGE_BASE_NAME}.dtb
-        cd ${DEPLOY_DIR_IMAGE}
-        rm -f ${KERNEL_IMAGE_SYMLINK_NAME}.dtb
-        ln -sf ${KERNEL_IMAGE_BASE_NAME}.dtb ${KERNEL_IMAGE_SYMLINK_NAME}.dtb
-    fi
-}
Signature · 1 line
1.7.0.4
#2 lore raw

meta/recipes-kernel/linux/linux-dtb.inc line 2

Quoted 8 lines · Bruce Ashfield
meta/recipes-kernel/linux/linux-dtb.inc new file +2 -0
new file mode 100644
index 0000000..0b27d18
@@ -0,0 +1,27 @@
+# Support for device tree generation
+FILES_kernel_devicetree = "/boot/devicetree*"

I guess that should be FILES_kernel-devicetree to actually match the package name.

Quoted 25 lines
meta/recipes-kernel/linux/linux-dtb.inc new file +25 -0
+KERNEL_DEVICETREE_FLAGS = "-R 8 -p 0x3000"
+
+python __anonymous () {
+    import bb
+
+    devicetree = bb.data.getVar("KERNEL_DEVICETREE", d, 1) or ''
+    if devicetree:
+	depends = bb.data.getVar("DEPENDS", d, 1)
+	bb.data.setVar("DEPENDS", "%s dtc-native" % depends, d)
+	packages = bb.data.getVar("PACKAGES", d, 1)
+	bb.data.setVar("PACKAGES", "%s kernel-devicetree" % packages, d)
+}
+
+do_install_append() {
+    if test -n "${KERNEL_DEVICETREE}"; then
+	dtc -I dts -O dtb ${KERNEL_DEVICETREE_FLAGS} -o devicetree ${KERNEL_DEVICETREE}
+	install -m 0644 devicetree ${D}/boot/devicetree-${KERNEL_VERSION}
+	install -d ${DEPLOY_DIR_IMAGE}
+	install -m 0644 devicetree ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGE_BASE_NAME}.dtb
+	cd ${DEPLOY_DIR_IMAGE}
+	rm -f ${KERNEL_IMAGE_SYMLINK_NAME}.dtb
+	ln -sf ${KERNEL_IMAGE_BASE_NAME}.dtb ${KERNEL_IMAGE_SYMLINK_NAME}.dtb
+    fi
+}
+
#3 lore raw
Quoted 12 lines · Esben Haabendal

meta/recipes-kernel/linux/linux-dtb.inc line 2

Quoted 8 lines · Bruce Ashfield
meta/recipes-kernel/linux/linux-dtb.inc new file +2 -0
new file mode 100644
index 0000000..0b27d18
@@ -0,0 +1,27 @@
+# Support for device tree generation
+FILES_kernel_devicetree = "/boot/devicetree*"

I guess that should be FILES_kernel-devicetree to actually match the package name.

Yes, I've pushed a fix for that, thanks.

Richard

#4 lore raw

PATCH 2/3 dtc: add LIC_FILES_CHKSUM to dtc-native

In reply to Bruce Ashfield

The new license processing rules error if dtc-native itself doesn't have license information. Previously only the .inc files contained this information, so we make a copy and leave the existing license info to be removed pending further review.

---
 meta/recipes-kernel/dtc/dtc-native_git.bb |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
meta/recipes-kernel/dtc/dtc-native_git.bb +3 -0
index 2d6f092..fd5bde5 100644
@@ -1,2 +1,5 @@
+LIC_FILES_CHKSUM = "file://GPL;md5=94d55d512a9ba36caa9b7df079bae19f \
+		    file://libfdt/libfdt.h;beginline=3;endline=52;md5=fb360963151f8ec2d6c06b055bcbb68c"
+
 require dtc-native.inc
 require dtc_git.inc
Signature · 1 line
1.7.0.4
#5 lore raw

PATCH 3/3 mpc8315-rdb: add dtb generation configuration

In reply to Bruce Ashfield

Fixes [BUGID #610]

dtb files were not being built for the mpc8315e-rdb, since they weren't being configured into the machine. With this and the related dtc fixes, we now get a dtb in the deployment directories.

---
 meta/conf/machine/mpc8315e-rdb.conf |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
meta/conf/machine/mpc8315e-rdb.conf +1 -0
index ac518fb..578751c 100644
@@ -17,3 +17,4 @@ PREFERRED_PROVIDER_linux-libc-headers ?= "linux-libc-headers-yocto"
 
 UBOOT_ENTRYPOINT = "0x00000000"
 
+KERNEL_DEVICETREE = "${S}/arch/powerpc/boot/dts/mpc8315erdb.dts"
Signature · 1 line
1.7.0.4
#6 lore raw
In reply to Bruce Ashfield
Quoted 17 lines · Bruce Ashfield

Richard/Saul,

This fixes BUGID 610, and kicks off a bit of cleaning with the various kernel include files. Patch 1/3 says it all:

[
The powerpc linux-yocto kernels were not creating dtb images in the deploy directories. This was due to two problems:

- the dtb generation rules were not being configured
- the boards were not specifying a device tree in their config

This change addresses the first point by factoring out the dtb generation routines into a new include that can be used by multiple recipes.
]

Quoted 6 lines

With these changes I've built and generated a dtb for the mpc8315-rdb.

Pull URL: git://git.pokylinux.org/poky-contrib.git
Branch: zedd/dtb
Browse: http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=zedd/dtb

Looks good, merged to master, thanks.

Richard