Hi Andrei, See answers inline. BR, Petter On 05/10/2015 12:16 PM, Andrei Gherzan wrote: > Hello Petter, > > On Fri, May 8, 2015 at 11:49 PM, 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 > > --- > classes/linux-raspberrypi-base.bbclass | 29 > +++++++++++++++++++++++++++++ > classes/sdcard_image-rpi.bbclass | 6 ++++-- > recipes-kernel/linux/linux-raspberrypi.inc | 4 +++- > 3 files changed, 36 insertions(+), 3 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..4bcadd0 > --- /dev/null > +++ b/classes/linux-raspberrypi-base.bbclass > @@ -0,0 +1,29 @@ > +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 > diff --git a/classes/sdcard_image-rpi.bbclass > b/classes/sdcard_image-rpi.bbclass > index 1ff664d..ca94566 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. > @@ -88,7 +89,8 @@ IMAGE_CMD_rpi-sdimg () { > ROOTFS_SIZE_ALIGNED=$(expr ${ROOTFS_SIZE_ALIGNED} - > ${ROOTFS_SIZE_ALIGNED} % ${IMAGE_ROOTFS_ALIGNMENT}) > SDIMG_SIZE=$(expr ${IMAGE_ROOTFS_ALIGNMENT} + > ${BOOT_SPACE_ALIGNED} + ${ROOTFS_SIZE_ALIGNED}) > > - echo "Creating filesystem with Boot partition > ${BOOT_SPACE_ALIGNED} KiB and RootFS ${ROOTFS_SIZE_ALIGNED} KiB" > > > Why do you remove this line? Maybe by mistake? Yes this is by mistake, thanks for finding it. Will send up a new version with this fixed. > > + # Check if we are building with device tree support > + DTS="${@get_dts(d, None)}" > > > Aren't we able to use the same variable name, KERNEL_DEVICETREE? What > that be a little clearer? No, at least i couldn't get this working. When trying to set the environment variable KERNEL_DEVICETREE in this context the values was only ignored. Don't know if the image recipe (or at least the IMAGE_CMD func) are doing something special. Perhaps it's possible to use 'eval' or something similar to enforce the expansion of the variable. If you have any good advice please share them, otherwise I can at least write some comment about this. > > > # Initialize sdcard image file > dd if=/dev/zero of=${SDIMG} bs=1024 count=0 seek=${SDIMG_SIZE} > @@ -112,7 +114,7 @@ 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 > # 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 > > -- > _______________________________________________ > yocto mailing list > yocto@yoctoproject.org > https://lists.yoctoproject.org/listinfo/yocto > > > > > -- > *Andrei Gherzan* > *e: */andrei@gherzan.ro / > /*w:* /www.gherzan.ro