[meta-xilinx] [PATCH 7/9] machine-xilinx-qemu.inc: Don't use MACHINE_DEVICETREE for dtb detection

Nathan Rossi nathan at nathanrossi.com
Thu Apr 20 06:29:54 PDT 2017


On 20 April 2017 at 22:57, Jean-Francois Dagenais
<jeff.dagenais at gmail.com> wrote:
> Hi Nathan,
>
>> On Apr 20, 2017, at 06:35, Nathan Rossi <nathan at nathanrossi.com> wrote:
>>
>> Avoid using the MACHINE_DEVICETREE variable for detection of the device
>> tree that needs to be loaded. Instead only rely on IMAGE_BOOT_FILES or
>> KERNEL_DEVICETREE.
>>
>> Signed-off-by: Nathan Rossi <nathan at nathanrossi.com>
>> ---
>> conf/machine/include/machine-xilinx-qemu.inc | 15 ++++++++-------
>> conf/machine/qemu-zynq7.conf                 |  1 +
>> 2 files changed, 9 insertions(+), 7 deletions(-)
>>
>> diff --git a/conf/machine/include/machine-xilinx-qemu.inc b/conf/machine/include/machine-xilinx-qemu.inc
>> index 79cbd7a4be..3c6972fa58 100644
>> --- a/conf/machine/include/machine-xilinx-qemu.inc
>> +++ b/conf/machine/include/machine-xilinx-qemu.inc
>> @@ -1,15 +1,16 @@
>> EXTRA_IMAGEDEPENDS += "qemu-native qemu-helper-native"
>>
>> def qemu_default_dtb(d):
>> -    if d.getVar("MACHINE_DEVICETREE", True):
>> -        dtbs = d.getVar("MACHINE_DEVICETREE", True).split(" ")
>> -        dtbs = [os.path.splitext(os.path.basename(d)) for d in dtbs]
>> -        dtbs = ["%s.dtb" % name for name, ext in dtbs if ext == ".dts" or ext == ".dtb"]
>> -        return dtbs[0] if dtbs else ""
>> -    elif d.getVar("KERNEL_DEVICETREE", True):
>> +    if d.getVar("IMAGE_BOOT_FILES", True):
>> +        dtbs = d.getVar("IMAGE_BOOT_FILES", True).split(" ")
>> +        dtbs = [f for f in dtbs if os.path.basename(f).endswith(".dtb")]
>
> I know the previous code had ".basename(d)" but I would challenge that having only:
>
> dtbs = [f for f in dtbs if f.endswith(".dtb")]
>
> would work just as well, and be much easier on the eyes.

Good idea I will make that change. Not sure why I even put the
basename there is the first place :|. Probably just a remnant of me
thinking it could have a subdir that needed to be stripped.

I've also just realized it does not handle the IMAGE_BOOT_FILES case
of having renames e.g. "u-boot;uboot". I will update to handle that as
well.

To save sending out a v2, updated version here:
https://github.com/nathanrossi/meta-xilinx/commit/7e19e776ec7f38d300aa953a000f972397081798

Thanks,
Nathan



More information about the meta-xilinx mailing list