From: "Petter Mabäcker" <petter@technux.se>
To: Andrei Gherzan <andrei@gherzan.ro>
Cc: Yocto Project <yocto@yoctoproject.org>
Subject: Re: [meta-raspberrypi][PATCH 1/5] devicetree: auto-disable dts for old kernels
Date: Sun, 10 May 2015 16:20:08 +0200 [thread overview]
Message-ID: <554F6918.4040903@technux.se> (raw)
In-Reply-To: <CAK18fxE7iDxP5RaH4ObZ-PxoOJB+kos6h9zJQFRaacsLqZvUog@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 6049 bytes --]
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 <petter@technux.se
> <mailto:petter@technux.se>> 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
> <mailto:petter@technux.se>>
> ---
> 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 <mailto:yocto@yoctoproject.org>
> https://lists.yoctoproject.org/listinfo/yocto
>
>
>
>
> --
> *Andrei Gherzan*
> *e: */andrei@gherzan.ro <mailto:andrei@gherzan.ro>/
> /*w:* /www.gherzan.ro <http://www.gherzan.ro>
[-- Attachment #2: Type: text/html, Size: 11594 bytes --]
next prev parent reply other threads:[~2015-05-10 14:20 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-08 21:49 [meta-raspberrypi][PATCH 0/5] kernel fixes Petter Mabäcker
2015-05-08 21:49 ` [meta-raspberrypi][PATCH 1/5] devicetree: auto-disable dts for old kernels Petter Mabäcker
2015-05-10 10:16 ` Andrei Gherzan
2015-05-10 14:20 ` Petter Mabäcker [this message]
2015-05-10 14:24 ` Andrei Gherzan
2015-05-10 17:07 ` Petter Mabäcker
2015-05-17 22:46 ` Andrei Gherzan
2015-05-25 14:48 ` Petter Mabäcker
2015-05-08 21:49 ` [meta-raspberrypi][PATCH 2/5] README: fix outdated device tree info Petter Mabäcker
2015-05-08 21:49 ` [meta-raspberrypi][PATCH 3/5] linux-raspberrypi: Add 3.14 support Petter Mabäcker
2015-05-17 22:53 ` Andrei Gherzan
2015-05-08 21:49 ` [meta-raspberrypi][PATCH 4/5] linux-raspberrypi: Drop support for old kernel versions Petter Mabäcker
2015-05-17 22:51 ` Andrei Gherzan
2015-05-08 21:49 ` [meta-raspberrypi][PATCH 5/5] linux-raspberrypi: Update 3.12 branch to latest Petter Mabäcker
2015-05-17 22:53 ` Andrei Gherzan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=554F6918.4040903@technux.se \
--to=petter@technux.se \
--cc=andrei@gherzan.ro \
--cc=yocto@yoctoproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.