Install Yocto and kernel development tools of IMX8

Install Yocto and kernel development tools of IMX8

The GCC toolchain and kernel installation.

The purpose of this post is to show the installation process of development tools for imx8m-var-dart, which is SOM made by Variscite. When using yocto, the kernel, userspace applications, and toolchain are part of the build. Still, when developing kernel modules, device tree changes, or userspace applications, it is more practical to make a standalone kernel build and to work on it outside the yocto.

Toolchain

cd ~/var-fsl-yocto
MACHINE=imx8m-var-dart DISTRO=fsl-imx-xwayland . var-setup-release.sh -b build_xwayland
bitbake meta-toolchain

and then install it:

cd rootfs
$ find . -type f -exec scp {} root@a.b.c.d:/  \;

where a.b.c.d is the ip of the target

Kernel

To build the kernel, do the following steps:

  • Download the kernel
git clone https://github.com/varigit/linux-imx.git
cd linux-imx
git checkout imx_4.14.78_1.0.0_ga_var01

edit this file:

vim arch/arm64/boot/dts/freescale/Makefile

and add to its end the following line:

dtb-y                         += fsl-imx8mq-var-dart-your-dtb.dtb
  • compile build
source /opt/fsl-imx-xwayland/4.14-sumo/environment-setup-aarch64-poky-linux
export LDFLAGS=
make mrproper 
make imx8_var_defconfig ARCH=arm64
## Customize the kernel configuration (optional step):
make menuconfig ARCH=arm64
make ARCH=arm64 CROSS_COMPILE=/opt/fsl-imx-xwayland/4.14-sumo/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-
make modules ARCH=arm64 CROSS_COMPILE=/opt/fsl-imx-xwayland/4.14-sumo/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-
make dtbs ARCH=arm64 CROSS_COMPILE=/opt/fsl-imx-xwayland/4.14-sumo/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-
  • installation - change directory to linux-imx-src and run the following code:
# Install the kernel image and modules:
mkdir rootfs/boot -p
kver=$(strings arch/arm64/boot/Image | grep -i "Linux version" | awk '{print $3}')
sudo cp arch/arm64/boot/Image.gz rootfs/boot/Image.gz-${kver}
sudo make ARCH=arm64 modules_install INSTALL_MOD_PATH=rootfs
cd rootfs/boot
sudo ln -fs Image.gz-${kver} Image.gz
cd ..  # up to roofs

# Install the device trees:
find . -type f -exec scp {} root@a.b.c.d:/  \;
scp arch/arm64/boot/dts/freescale/fsl-imx8mq-var-dart-your-dtb.dtb root@a.b.c.d:/boot

where a.b.c.d. is the ip of the target device

compiling userspace application with external library

when a userspace application makes use with an external library, this library can add as a dependency to the bitbake file, which creates the application. The yocto process will take the library, will build and link it with the application. If we want to compile the application in userspace as part of a continuous development process, we can build it using bitbake command and place it under the root system of the compiler.

Comments
comments powered by Disqus