All of lore.kernel.org
 help / color / mirror / Atom feed
* [meta-raspberrypi][PATCHv2 0/2] kernel fixes
@ 2015-05-25 14:59 Petter Mabäcker
  2015-05-25 14:59 ` [meta-raspberrypi][PATCHv2 1/2] devicetree: auto-disable dts for old kernels Petter Mabäcker
  2015-05-25 14:59 ` [meta-raspberrypi][PATCHv2 2/2] README: fix outdated device tree info Petter Mabäcker
  0 siblings, 2 replies; 5+ messages in thread
From: Petter Mabäcker @ 2015-05-25 14:59 UTC (permalink / raw)
  To: yocto

The following changes since commit 6ef9d94a2c2588dcefe442577ef6ae5bbe722dec:

  linux-raspberrypi: Update 3.12 branch to latest (2015-05-18 00:48:49 +0200)

are available in the git repository at:

  git://git.yoctoproject.org/poky-contrib petmab/rpi_kernel_fixes_dts_v2
  http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=petmab/rpi_kernel_fixes_dts_v2

Petter Mabäcker (2):
  devicetree: auto-disable dts for old kernels
  README: fix outdated device tree info

 README                                     |  3 ++-
 classes/linux-raspberrypi-base.bbclass     | 39 ++++++++++++++++++++++++++++++
 classes/sdcard_image-rpi.bbclass           | 15 +++++++-----
 recipes-kernel/linux/linux-raspberrypi.inc |  4 ++-
 4 files changed, 53 insertions(+), 8 deletions(-)
 create mode 100644 classes/linux-raspberrypi-base.bbclass

-- 
1.9.1



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [meta-raspberrypi][PATCHv2 1/2] devicetree: auto-disable dts for old kernels
  2015-05-25 14:59 [meta-raspberrypi][PATCHv2 0/2] kernel fixes Petter Mabäcker
@ 2015-05-25 14:59 ` Petter Mabäcker
  2015-06-05 14:31   ` Andrei Gherzan
  2015-05-25 14:59 ` [meta-raspberrypi][PATCHv2 2/2] README: fix outdated device tree info Petter Mabäcker
  1 sibling, 1 reply; 5+ messages in thread
From: Petter Mabäcker @ 2015-05-25 14:59 UTC (permalink / raw)
  To: yocto

After '6392a63 rpi-base.inc: Use KERNEL_DEVICETREE by default' was
introduced, kernel versions < 3.18 might not be buildable. Since full
device tree support was introduced in 3.18 this change ensures that all
kernel < 3.18 will automatically disable device tree.

Signed-off-by: Petter Mabäcker <petter@technux.se>
---
 classes/linux-raspberrypi-base.bbclass     | 39 ++++++++++++++++++++++++++++++
 classes/sdcard_image-rpi.bbclass           | 15 +++++++-----
 recipes-kernel/linux/linux-raspberrypi.inc |  4 ++-
 3 files changed, 51 insertions(+), 7 deletions(-)
 create mode 100644 classes/linux-raspberrypi-base.bbclass

diff --git a/classes/linux-raspberrypi-base.bbclass b/classes/linux-raspberrypi-base.bbclass
new file mode 100644
index 0000000..40beef1
--- /dev/null
+++ b/classes/linux-raspberrypi-base.bbclass
@@ -0,0 +1,39 @@
+inherit linux-kernel-base
+
+
+def get_dts(d, ver):
+    staging_dir = d.getVar("STAGING_KERNEL_BUILDDIR", True)
+    dts = d.getVar("KERNEL_DEVICETREE", True)
+
+    # d.getVar() might return 'None' as a normal string
+    # leading to 'is None' check isn't enough.
+    # TODO: Investigate if this is a bug in bitbake
+    if ver is None or ver == "None":
+        ''' if 'ver' isn't set try to grab the kernel version
+        from the kernel staging '''
+        ver = get_kernelversion_file(staging_dir)
+
+    if ver is not None:
+        min_ver = ver.split('.', 3)
+    else:
+        return dts
+
+    # Always turn off device tree support for kernel's < 3.18
+    try:
+        if int(min_ver[0]) <= 3:
+            if int(min_ver[1]) < 18:
+                dts = ""
+    except IndexError:
+        min_ver = None
+
+    return dts
+
+
+def split_overlays(d, out):
+    dts = get_dts(d, None)
+    if out:
+        overlays = oe.utils.str_filter_out('\S+\-overlay\.dtb$', dts, d)
+    else:
+        overlays = oe.utils.str_filter('\S+\-overlay\.dtb$', dts, d)
+
+    return overlays
diff --git a/classes/sdcard_image-rpi.bbclass b/classes/sdcard_image-rpi.bbclass
index 1ff664d..7592cc1 100644
--- a/classes/sdcard_image-rpi.bbclass
+++ b/classes/sdcard_image-rpi.bbclass
@@ -1,4 +1,5 @@
 inherit image_types
+inherit linux-raspberrypi-base
 
 #
 # Create an image that can by written onto a SD card using dd.
@@ -70,11 +71,6 @@ SDIMG = "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.rpi-sdimg"
 # Additional files and/or directories to be copied into the vfat partition from the IMAGE_ROOTFS.
 FATPAYLOAD ?= ""
 
-# Device Tree Overlays are assumed to be suffixed by '-overlay.dtb' string and will be put in a dedicated folder
-DT_ALL = "${@d.getVar('KERNEL_DEVICETREE', True) or ''}"
-DT_OVERLAYS = "${@oe.utils.str_filter('\S+\-overlay\.dtb$', '${DT_ALL}', d)}"
-DT_ROOT = "${@oe.utils.str_filter_out('\S+\-overlay\.dtb$', '${DT_ALL}', d)}"
-
 IMAGEDATESTAMP = "${@time.strftime('%Y.%m.%d',time.gmtime())}"
 
 IMAGE_CMD_rpi-sdimg () {
@@ -90,6 +86,9 @@ IMAGE_CMD_rpi-sdimg () {
 
 	echo "Creating filesystem with Boot partition ${BOOT_SPACE_ALIGNED} KiB and RootFS ${ROOTFS_SIZE_ALIGNED} KiB"
 
+	# Check if we are building with device tree support
+	DTS="${@get_dts(d, None)}"
+
 	# Initialize sdcard image file
 	dd if=/dev/zero of=${SDIMG} bs=1024 count=0 seek=${SDIMG_SIZE}
 
@@ -112,7 +111,11 @@ IMAGE_CMD_rpi-sdimg () {
 		mcopy -i ${WORKDIR}/boot.img -s ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE}${KERNEL_INITRAMFS}-${MACHINE}.bin ::uImage
 		;;
 	*)
-		if test -n "${KERNEL_DEVICETREE}"; then
+		if test -n "${DTS}"; then
+			# Device Tree Overlays are assumed to be suffixed by '-overlay.dtb' string and will be put in a dedicated folder
+			DT_OVERLAYS="${@split_overlays(d, 0)}"
+			DT_ROOT="${@split_overlays(d, 1)}"
+
 			# Copy board device trees to root folder
 			for DTB in ${DT_ROOT}; do
 				DTB_BASE_NAME=`basename ${DTB} .dtb`
diff --git a/recipes-kernel/linux/linux-raspberrypi.inc b/recipes-kernel/linux/linux-raspberrypi.inc
index 84d4f9e..7e36408 100644
--- a/recipes-kernel/linux/linux-raspberrypi.inc
+++ b/recipes-kernel/linux/linux-raspberrypi.inc
@@ -1,4 +1,5 @@
 require linux.inc
+inherit linux-raspberrypi-base
 
 DESCRIPTION = "Linux Kernel for Raspberry Pi"
 SECTION = "kernel"
@@ -26,7 +27,8 @@ UDEV_GE_141 ?= "1"
 # See http://www.yoctoproject.org/docs/current/bitbake-user-manual/bitbake-user-manual.html#anonymous-python-functions
 python __anonymous () {
     kerneltype = d.getVar('KERNEL_IMAGETYPE', True)
-    kerneldt = d.getVar('KERNEL_DEVICETREE', True)
+    kerneldt = get_dts(d, d.getVar('LINUX_VERSION', True))
+    d.setVar("KERNEL_DEVICETREE", kerneldt)
 
     # Add dependency to 'rpi-mkimage-native' package only if RPi bootloader is used with DT-enable kernel
     if kerneldt:
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [meta-raspberrypi][PATCHv2 2/2] README: fix outdated device tree info
  2015-05-25 14:59 [meta-raspberrypi][PATCHv2 0/2] kernel fixes Petter Mabäcker
  2015-05-25 14:59 ` [meta-raspberrypi][PATCHv2 1/2] devicetree: auto-disable dts for old kernels Petter Mabäcker
@ 2015-05-25 14:59 ` Petter Mabäcker
  2015-06-05 14:31   ` Andrei Gherzan
  1 sibling, 1 reply; 5+ messages in thread
From: Petter Mabäcker @ 2015-05-25 14:59 UTC (permalink / raw)
  To: yocto

After '6392a63 rpi-base.inc: Use KERNEL_DEVICETREE by default' was
introduced, the default value for 3.18+ kernels was changed. Ensure this
is reflected in the README.

Signed-off-by: Petter Mabäcker <petter@technux.se>
---
 README | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/README b/README
index a2ec4ca..3913f41 100644
--- a/README
+++ b/README
@@ -179,7 +179,8 @@ kernels.
           While creating the SDCard image, this modified kernel is put on
           boot partition (as kernel.img) as well as DeviceTree blobs (.dtb files).
 
-NOTE: KERNEL_DEVICETREE is empty by default.
+NOTE: KERNEL_DEVICETREE is default enabled for kernel >= 3.18 and always disabled for
+      older kernel versions.
 
 3. Extra apps
 =============
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [meta-raspberrypi][PATCHv2 2/2] README: fix outdated device tree info
  2015-05-25 14:59 ` [meta-raspberrypi][PATCHv2 2/2] README: fix outdated device tree info Petter Mabäcker
@ 2015-06-05 14:31   ` Andrei Gherzan
  0 siblings, 0 replies; 5+ messages in thread
From: Andrei Gherzan @ 2015-06-05 14:31 UTC (permalink / raw)
  To: Petter Mabäcker; +Cc: yocto

On Mon, May 25, 2015 at 04:59:22PM +0200, Petter Mabäcker wrote:
> After '6392a63 rpi-base.inc: Use KERNEL_DEVICETREE by default' was
> introduced, the default value for 3.18+ kernels was changed. Ensure this
> is reflected in the README.
>
> Signed-off-by: Petter Mabäcker <petter@technux.se>

Merged to master. Thank you.

--
Andrei Gherzan


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [meta-raspberrypi][PATCHv2 1/2] devicetree: auto-disable dts for old kernels
  2015-05-25 14:59 ` [meta-raspberrypi][PATCHv2 1/2] devicetree: auto-disable dts for old kernels Petter Mabäcker
@ 2015-06-05 14:31   ` Andrei Gherzan
  0 siblings, 0 replies; 5+ messages in thread
From: Andrei Gherzan @ 2015-06-05 14:31 UTC (permalink / raw)
  To: Petter Mabäcker; +Cc: yocto

On Mon, May 25, 2015 at 04:59:21PM +0200, Petter Mabäcker wrote:
> After '6392a63 rpi-base.inc: Use KERNEL_DEVICETREE by default' was
> introduced, kernel versions < 3.18 might not be buildable. Since full
> device tree support was introduced in 3.18 this change ensures that all
> kernel < 3.18 will automatically disable device tree.
>
> Signed-off-by: Petter Mabäcker <petter@technux.se>
> ---

Merged to master. Thank you.

--
Andrei Gherzan


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-06-05 14:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-25 14:59 [meta-raspberrypi][PATCHv2 0/2] kernel fixes Petter Mabäcker
2015-05-25 14:59 ` [meta-raspberrypi][PATCHv2 1/2] devicetree: auto-disable dts for old kernels Petter Mabäcker
2015-06-05 14:31   ` Andrei Gherzan
2015-05-25 14:59 ` [meta-raspberrypi][PATCHv2 2/2] README: fix outdated device tree info Petter Mabäcker
2015-06-05 14:31   ` Andrei Gherzan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.