[yocto] [meta-raspberrypi][PATCH 1/5] devicetree: auto-disable dts for old kernels
Petter Mabäcker
petter at technux.se
Sun May 10 10:07:25 PDT 2015
On 05/10/2015 04:24 PM, Andrei Gherzan wrote:
>
>
> On Sun, May 10, 2015 at 4:20 PM, Petter Mabäcker <petter at technux.se
> <mailto:petter at technux.se>> wrote:
>
> 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 at technux.se <mailto:petter at 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 at technux.se
>> <mailto:petter at 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.
>
> Don't bother. I'll fix it before merging.
Ok, thanks.
>
>> + # 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.
>
>
> I'll try it a little. But I didn't expect this. Will see. Otherwise
> this is fine.
Neither did I, let me know if you find anything interesting about this.
>
>
> --
> *Andrei Gherzan*
> *e: */andrei at gherzan.ro <mailto:andrei at gherzan.ro>/
> /*w:* /www.gherzan.ro <http://www.gherzan.ro>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20150510/f860ac78/attachment.html>
More information about the yocto
mailing list