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.

Jorge7u7_0-1695325693088.png

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”.

Jorge7u7_1-1695325873597.png

Steps:

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 imx-setup-release.sh -b <build directory>
$ bitbake -c devshell virtual/kernel (it will open a new window)
Jorge7u7_2-1695326259689.png

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.

Jorge.

评论

After 

 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/parser.tab.o
  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

Hello,

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.

I'm seeing the same thing with Scarthgap, is there a solution?

Hello @ajhoneybell,

This procedure was done when Linux 6.1.22 was released, let me try to reproduce the issue on the latest release.

Which release are you using?

Best regards.

Hello @ajhoneybell,

JorgeCas_0-1723494592598.png

I couldn't reproduce the issue. Could you please try again?

Best regards.

I haven't needed to do this again (yet) but I will do at some point soon. I will update when if there are still issues.

will this change the .wic file or just genrate the .dtb?

100% 有帮助 (2/2)
版本历史
最后更新:
‎09-21-2023 01:42 PM
更新人: