How to make a custom Linux image for Toradex Apalis iMX6Q
I’m going to show you how to make a system image for Toradex iMX6Q with the following libraries:
- OpenGL
- Qt with EGLFS plugin
First of all we need to know about the YOCTO project and install the required packages.
What is Yocto?
The Yocto project (http://www.yoctoproject.org/) is an embedded Linux distribution builder that makes use of several other open source projects.
The Yocto project provides a reference build sytem for embedded Linux, called Poky, which has the BitBake and OpenEmbedded-Core (OE-Core) projects at its base. The purpose of Poky is to build the components needed for an embedded Linux product, namely:
- A boot loader Image
- A linux kernel image
- A root filesystem
- Toolchain and SDK for aplication development
Then we need to clone the Yocto-OpenEmbedded
project from Toradex. So we need to install git
and git-repo
programs, after that we need to configure the build process.
Toradex
- Name: Apalis iMX6 Quad 2GB IT
- Carrier: Ixora v1.1
- GPU: Vivante GC2000
- CPU: Cortex-A9
Hardware Requirements
My machine is running Ubuntu 18.04 and has the following hardware:
- CPU i3–8100 CPU @ 3.60GHz
- RAM 16G
- Storage 2T HDD
Install
I’m going to use Ubuntu 18.04 on a machine with 16 GiB of RAM to compile a Linux for iMX6Q.
Package Requirement
These packages are needed by Yocto:
$ sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat libsdl1.2-dev xterm make xsltproc docbook-utils fop dblatex xmlto autoconf automake libtool libglib2.0-dev python-gtk2 bsdmainutils screen
And these packages:
$ sudo dpkg --add-architecture i386$ sudo apt-get update$ sudo apt-get install g++-5-multilib$ sudo apt-get install curl dosfstools gawk g++-multilib gcc-multilib lib32z1-dev libcrypto++6:i386 libcrypto++-dev:i386 liblzo2-dev:i386 lzop libsdl1.2-dev libstdc++-5-dev:i386 libusb-1.0-0:i386 libusb-1.0-0-dev:i386 uuid-dev:i386 texinfo chrpath
Install Git
$ sudo apt install git$ git config --global user.name "Name"$ git config --global user.email Name@example.com
Install git-repo
$ mkdir ~/bin$ export PATH=~/bin:$PATH$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo$ chmod a+x ~/bin/repo
Install Yocto-OpenEmbedded
$ mkdir oe-core$ cd oe-core$ repo init -u http://git.toradex.com/toradex-bsp-platform.git -b LinuxImageV2.8$ repo sync
In the oe-core directory we need to setup environment variable so we use the following command
. export
or source export
All config files will be stored at build/config
.
The build directory contains a conf directory with some files.
There are bblayers.conf
and local.conf
in the conf directory.
bblayers.conf
: contains metadata layers.local.conf
: contains configuration variable.
Insert following configuration into local.conf
file.
MACHINE ?= "apalis-imx6”#INHERIT += "rm_work”ACCEPT_FSL_EULA = "1”DISTRO_FEATURES_remove = "x11 wayland”IMAGE_INSTALL_remove = "eglinfo-x11”IMAGE_INSTALL_append = " qtbase qtbase-plugins cinematicexperience liberation-fonts"PACKAGECONFIG_FONTS_append_pn-qtbase = " fontconfig”IMAGE_INSTALL_remove = "backports"CORE_IMAGE_EXTRA_INSTALL += "openssh \vim \qtbase-plugins \qtbase-tools \qtdeclarative \qtdeclarative-tools \qtdeclarative-qmlplugins \qtmultimedia \qtmultimedia-plugins \qtmultimedia-qmlplugins \qtsvg \qtsvg-plugins \qtsensors \qtimageformats-plugins \qtsystems \qtsystems-tools \qtsystems-qmlplugins \qtscript \qt3d \qt3d-qmlplugins \qt3d \qt3d-qmlplugins \qt3d-tools \qtgraphicaleffects-qmlplugins \qtconnectivity-qmlplugins \qtlocation-plugins \qtlocation-qmlplugins \cinematicexperience \fb-test fbgrab fbida fbset-modes \es2gears \qt4-examples \"PACKAGECONFIG_append_pn-qtbase = " gles2 eglfs "DISTRO_FEATURES_append = " opengles2 egl opengl gles gbm dri eglfs gles2 "MACHINEOVERRIDES .= ":use-mainline-bsp"PACKAGECONFIG_append = " linuxfb eglfs gbm gles2 kms”PACKAGECONFIG_remove = "gl xcb xcb-xinput"
Start compiling with the following command:
bitbake console-tdx-image
After compile successfully finished we are going to setup network and U-BOOT configuration.
Then I can boot my custom Linux from network for development.
Reference
- Embedded Linux Projects Using Yocto Project Cookbook
- https://doc.qt.io/qt-5/embedded-linux.html
- https://developer.toradex.com/knowledge-base/board-support-package/openembedded-(core)