How to use Devshell to compile device tree files.

显示  仅  | 搜索替代 

How to use Devshell to compile device tree files.

How to use Devshell to compile device tree files.

What is a device tree?

The device tree is a data structure that is passed to the Linux kernel to describe the physical devices in a system. Before device trees came into use, the bootloader (for example, U-Boot) had to tell the kernel what machine type it was booting. Moreover, it had to pass other information such as memory size and location, kernel command line, etc.

Sometimes, the device tree is confused with the Linux Kernel configuration, but the device tree specifies what devices are available and how they are accessed, not whether the hardware is used.


The device tree is a structure composed of nodes and properties:

Nodes: The node name is a label used to identify the node.

Properties: A node may contain multiple properties arranged with a name and a value.

Phandle: Property in one node that contains a pointer to another node.

Aliases: The aliases node is an index of other nodes.

A device tree is defined in a human-readable device tree syntax text file such as .dts or .dtsi. The machine has one or several .dts files that correspond to different hardware configurations.

With these .dts files we can compile them into a device tree binary (.dtb) blobs that can either be attached to the kernel binary (for legacy compatibility) or, as is more commonly done, passed to the kernel by a bootloader like U-Boot.

What is Devshell?

The Devshell is a terminal shell that runs in the same context as the BitBake task engine. It is possible to run Devshell directly or it may spawn automatically.

The advantage of this tool is that is automatically included when you configure and build a platform project so, you can start using it by installing the packages and following the setup of i.MX Yocto Project User's Guide on section 3 “Host Setup”.



Now, let’s see how to compile your device tree files of i.MX devices using Devshell.

On host machine.

Modify or make your device tree on the next path:

- 64 bits.

~/imx-yocto-bsp/<build directory>/tmp/work-shared/<machine>/kernel-source/arch/arm64/boot/dts/freescale

- 32 bits.

~/imx-yocto-bsp/<build directory>/tmp/work-shared/<machine>/kernel-source/arch/arm/boot/dts

To compile, it is needed to prepare the environment as is mentioned on i.MX Yocto Project User's Guide on section 5.1 “Build Configurations”.

$ cd ~/imx-yocto-bsp
$ DISTRO=fsl-imx-xwayland MACHINE=<machine> source -b <build directory>
$ bitbake -c devshell virtual/kernel (it will open a new window)

On Devshell window.

$ make dtbs (after finished, close the Devshell window)

On host machine.

$ bitbake -c compile -f virtual/kernel 
$ bitbake -c deploy -f virtual/kernel

This process will compile all the device tree files linked to the machine declared on setup environment and your device tree files will be deployed on the next path:

~/imx-yocto-bsp/<build directory>/tmp/deploy/images/<machine>

I hope this article will be helpful.

Best regards.




 make dtbs

I got compiler not found error

 make dtbs
make[1]: Entering directory '/media/wols/YoctoHDD/imx5.15.52/build/tmp/work/imx8qxpc0mek-poky-linux/linux-imx/5.15.52+gitAUTOINC+36363d8623-r0/build'
make[1]: aarch64-poky-linux-gcc: Command not found
  SYNC    include/config/auto.conf.cmd
  GEN     Makefile
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/confdata.o
  HOSTCC  scripts/kconfig/expr.o
  HOSTCC  scripts/kconfig/lexer.lex.o
  HOSTCC  scripts/kconfig/menu.o
  HOSTCC  scripts/kconfig/
  HOSTCC  scripts/kconfig/preprocess.o
  HOSTCC  scripts/kconfig/symbol.o
  HOSTCC  scripts/kconfig/util.o
  HOSTLD  scripts/kconfig/conf
scripts/Kconfig.include:39: compiler 'aarch64-poky-linux-gcc' not found
make[3]: *** [/media/wols/YoctoHDD/imx5.15.52/build/tmp/work-shared/imx8qxpc0mek/kernel-source/scripts/kconfig/Makefile:77: syncconfig] Error 1
make[2]: *** [/media/wols/YoctoHDD/imx5.15.52/build/tmp/work-shared/imx8qxpc0mek/kernel-source/Makefile:616: syncconfig] Error 2
make[1]: *** [/media/wols/YoctoHDD/imx5.15.52/build/tmp/work-shared/imx8qxpc0mek/kernel-source/Makefile:729: include/config/auto.conf.cmd] Error 2
make[1]: *** [include/config/auto.conf.cmd] Deleting file 'include/generated/autoconf.h'
make[1]: Leaving directory '/media/wols/YoctoHDD/imx5.15.52/build/tmp/work/imx8qxpc0mek-poky-linux/linux-imx/5.15.52+gitAUTOINC+36363d8623-r0/build'
make: *** [Makefile:219: __sub-make] Error 2


Do you have installed all the essential Yocto Project host packages?

Best regards.

Hello @WolsYang ,

You can try this command to solve your issue:

sudo apt install gawk wget git diffstat unzip texinfo gcc build-essential chrpath socat cpio python3 python3-pip python3-pexpect xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev python3-subunit mesa-common-dev zstd liblz4-tool file locales

Best regards. 

Hi @Alejandro_Salas @JorgeCas ,

I think my yocto project is working well.

We already build a lot of image and try it on our custom board.

I am looking for why this happen in devshell too, it wired.

100% 有帮助 (2/2)
‎09-21-2023 01:42 PM