Search code examples
linux-kernelyoctobitbakedevice-tree

Quick rebuild of device tree only with Yocto/bitbake?


So, each time I modify the device tree I typically change the dts in a custom recipe and rebuild the image. The rebuild takes a long time since it rebuilds the entire kernel, and then the image needs to be built and finally deployed to the target device.

Is there any trick that I'm missing that rebuilds only the device tree?

UPDATE:

I've marked g0hl1n's answer as the correct one, since it is the answer to my question. However, I found it to be very cumbersome to work with the kernel in Yocto: strange, long paths and risk of files being overwritten on each rebuild, source of kernel in tmp/work-shared while the kernel is being built in tmp/work.

Instead I've moved the kernel development out of Yocto. Yocto has good tools for creating an SDK (see populate_sdk task) and with that it's easy to setup an environment for kernel development with quick rebuilds and manual (or scripted) deployments. Once the work is done the changes can be moved to a recipe using git diff.

The instructions on the following page was very helpful: http://jumpnowtek.com/beaglebone/Working-on-the-BeagleBone-kernel.html


Solution

  • AFAIK there are two different ways of doing this.

    1. The kernel way: Using the scripts provided by the kernel
    • Change to your kernel source directory (<build dir>/tmp/work/<machine>/<kernel-name>/<kernel-version>/git/)
    • Execute the device-tree-compiler: ./scripts/dtc/dtc -I dts -O dtb -o ./devicetree.dtb path/to/devicetree.dts
    1. The bitbake way: Using the kernel's deploy job
    • Call $ bitbake <kernel-name> -f -c deploy
    • The generated device-tree-blob then can be found in <build dir>/tmp/work/<machine>/<kernel-name>/<kernel-version>/build/arch/arm/boot/dts/)

    At least for me both versions worked in a quick test.

    UPDATE: I just came over a third version of building the dtb with yocto on the net. That one uses yocto's devshell of the kernel build. For more information see the original authors page at https://splefty.blogspot.co.at/2015/09/compiling-device-tree-using-yocto.html.