Back to the Overview

Yocto BSP Usage in ELinOS

ELinOS, Linux

ELinOS comes with range of selected hardware boards supported out of box. To extend possibilities for the customers, ELinOS allows the use of external Linux kernels instead of the integrated ones.

At present, big part of vendors provide their BSPs as overlay for Yocto Linux distribution – which usually also includes a custom Linux kernel branch. However some issues must still be considered – among others,  the vendor BSPs are often not synchronized/merged with stable kernel releases. This task is left up to the customer to handle. Additionally, the more complex hardware devices often require several user-space components, some of them even proprietary.

Integrating the Linux kernel tree in ELinOS project only requires a few steps. The advantage resulting from this are the fast turn-around times and the graphical configuration editors that ELinOS provides also in this configuration.

Initial BSP Preparation

The only inherent limitation in using external BSPs is that each ELinOS version requires a minimal kernel version – in case of ELinOS 7.0 it is v4.9. The ELinOS glibc is cross-compiled against this version thus using an older kernel version is not supported.

We will show on the example of the i.MX 8 QuadMax Multisensory Enablement Kit board how to setup the Yocto Linux kernel in ELinOS. After consulting the kernel recipe in https://source.codeaurora.org/external/imx/meta-imx/tree/meta-bsp/recipes-kernel/linux?h=gatesgarth-5.10.9-1.0.0, we will take the kernel tree https://source.codeaurora.org/external/imx/linux-imx and tag lf-5.10.y-1.0.0, and integrate that into the so-called system project.

System Configuration

We start by cloning the kernel GIT repository:

imx8$ git clone https://source.codeaurora.org/external/imx/linux-imx -b lf-5.10.y-1.0.0 --depth 1

Cloning into 'linux-imx'... 
remote: Enumerating objects: 76617, done. 
remote: Counting objects: 100% (76617/76617), done. 
remote: Compressing objects: 100% (74592/74592), done. 
Receiving objects: 100% (76617/76617), 203.83 MiB | 199.00 KiB/s, done.B | 180.00 KiB/s 
remote: Total 76617 (delta 5270), reused 17380 (delta 1219), pack-reused 0 
Resolving deltas: 100% (5270/5270), done. 
Note: switching to '32513c25d8c7867f07b44900368346795357b48e'.
...
Updating files: 100% (72145/72145), done.

The next step, creating an ELinOS system project, helps with integrating the kernel with user space binaries. For this, CODEO will be used, which is the SYSGO Eclipse-based project configuration/build tool. Create a new system project and in the “Target Properties” dialogue, fill in the respective entries:


When using the Generic Platform BSP ELinOS cannot automatically enable the board specific drivers and architecture options. Thus an initial kernel config file or default config should be provided. The suitable initial Linux kernel config can usually be found in the Yocto recipe, or alternatively in the vendor BSP documentation.

Now that the project is prepared, some additional configuration may be done. ELinOS Feature Configurator allows controlling various aspects of the system – both regarding kernel and user-space features. When using the Generic Platform BSP board-specific drivers are not available. For this purpose you can specify an initial vendor specific configuration. This configuration should contain the required drivers for the board.

A quite common issue with vendor kernels is that not all valid kernel configurations have been tested. In particular, quite often the board specific kernel configuration for the drivers cannot be modified. For example disabling the Power Management interface often results in a non-compilable kernel. Thus make sure to enable required options such as SMP support and Power Management support in the ELinOS Feature Configurator, which consequently also adjust the kernel configuration:



To manually adjust the kernel options, the built-in ELinOS Kernel Configurator can be used. Alternatively also the standard kernel configurator tool can be used by calling for example ‘elinos-buildkernel xconfig‘ from within the project directory. In this case, we will enable the missing IMX SCU Protocol driver along with its Mailbox dependency, and disable the nouveau driver (because it’s huge and unused on the i.MX8 board):


Board Startup

Finally, once the project has been built, the images are present in the project’s directory:

$ ls boot 
imx8qm-mek.dtb  zImage

One of them is the kernel image combined with initramfs (root filesystem), the other one is the device tree that the u-boot may modify slightly to match the board configuration. Note that the base zImage generated is 23 MiB including 5MiB for the BusyBox based root filesystem. The kernel size can be reduced significantly by removing various unused features. For this purpose you can have a look at the unused media and ethernet drivers.

To finally boot the built system using the pre-installed u-boot, for example a TFTP server may be used. The bootloader downloads the binaries and on Aarch64, the booti command is usually used to put it all together:

=> tftp 0x80280000 imx8-qm-mek/zImage; tftp 0x83000000 imx8-qm-mek/imx8qm-mek.dtb; booti 0x80280000 - 0x83000000 
Using ethernet@5b040000 device 
TFTP from server ...; our IP address is ...
Filename 'imx8-qm-mek/zImage'. 
Load address: 0x80280000 
Loading: ################################################################# 
        ...
        ####################################################### 
        5.8 MiB/s 
done 
Bytes transferred = 22745096 (15b1008 hex) 
Using ethernet@5b040000 device 
TFTP from server ...; our IP address is ...
Filename 'imx8-qm-mek/imx8qm-mek.dtb'. 
Load address: 0x83000000 
Loading: ########## 
        5.6 MiB/s 
done 
Bytes transferred = 134241 (20c61 hex) 
## Flattened Device Tree blob at 83000000 
  Booting using the fdt blob at 0x83000000 
  Using Device Tree in place at 0000000083000000, end 0000000083023c60 
Disable i2c@3b230000, resource id 308 not owned 
Disable clock-controller@3b630000, resource id 308 not owned 
Disable intmux@3b400000, resource id 309 not owned 
Disable clock-controller@5a480000, resource id 59 not owned 
Disable can@5a8d0000, resource id 105 not owned 
Disable can@5a8e0000, resource id 106 not owned 
Disable can@5a8f0000, resource id 107 not owned 
Disable clock-controller@5acd0000, resource id 105 not owned 
Disable clock-controller@5ace0000, resource id 106 not owned 
Disable clock-controller@5acf0000, resource id 107 not owned 
Disable spi@5d120000, resource id 237 not owned 
Disable imx8qm_cm4@0, resource id 278 not owned 
Disable imx8qm_cm4@0, resource id 297 not owned 
Disable imx8x_cm4@1, resource id 298 not owned 
Disable imx8x_cm4@1, resource id 317 not owned 

Starting kernel ... 

[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd034] 
[    0.000000] Linux version 5.10.9-04671-g32513c25d8c7-dirty (kru@kru-t490) (aarch64-unknown-linux-gnu-gcc (GCC) 8.3.0, GNU ld (GNU Binutils1... 
[    0.000000] Machine model: Freescale i.MX8QM MEK
...
[    3.911628] Freeing unused kernel memory: 4544K 
[    3.921495] Run /init as init process 
starting devtmpfs... done. 

BusyBox v1.30.1 (2020-12-10 16:56:35 CET) built-in shell (ash) 
Enter 'help' for a list of built-in commands. 

=========================================================================== 
==                                                                       == 
==  Useful commands for setting up the network:                          == 
==                                                                       == 
==  # ifconfig lo localhost                                              == 
==  # ifconfig eth0                                     == 
==  # ping                                       == 
==                                                                       == 
=========================================================================== 

=========================================================================== 
==                                                                       == 
==  The busybox multi-call binary offers you a small unix environment    == 
==  while maintaining a minimum ROM/RAM footprint!                       == 
==                                                                       == 
==  The busybox provides nearly all important unix shell commands.       == 
==  If you want to know which commands are supported by the busybox      == 
==  use the 'busybox' command!                                           == 
==                                                                       == 
=========================================================================== 

/ #

More information also at www.sysgo.com/elinos