On this page: |
Eric Lee
version 1.0a, 08/18/2022
This document describes how Embedian builds a customized version of NXP’s i.MX8M Plus official Yocto Gatesgarth BSP release for Embedian's pITX-MX8M-PLUS product platform. The approach is to pull from Embedian's public facing GIT repository and build that using bitbake. The reason why we use this approach is that it allows co-development. The build output is comprised of binary images, feed packages, and an SDK for pITX-MX8M-PLUS specific development.
Freescale makes their i.MX series official bsp build scripts available via the following GIT repository:
It is this repository that actually pulls in the fsl-bsp-release project to perform the Linux BSP builds for NXP's i.MX8M Plus ARM Cortext-A53 chips.
We recommend you use SSH keys to establish a secure connection between your computer and Embedian Gitlab server. The steps below will walk you through generating an SSH key and then adding the public key to our Gitlab account.
First, we need to check for existing ssh keys on your computer. Open up Git Bash and run:
$ cd ~/.ssh $ ls # Lists the files in your .ssh directory |
Check the directory listing to see if you have a file named either id_rsa.pub
or id_dsa.pub
. If you don't have either of those files go to step 2. Otherwise, you already have an existing keypair, and you can skip to step 3.
To generate a new SSH key, enter the code below. We want the default settings so when asked to enter a file in which to save the key, just press enter.
$ ssh-keygen -t rsa -C "your_email@example.com" # Creates a new ssh key, using the provided email as a label # Generating public/private rsa key pair. # Enter file in which to save the key (/c/Users/you/.ssh/id_rsa): [Press enter] $ ssh-add id_rsa |
Now you need to enter a passphrase.
Enter passphrase (empty for no passphrase): [Type a passphrase] Enter same passphrase again: [Type passphrase again] |
Which should give you something like this:
Your identification has been saved in /c/Users/you/.ssh/id_rsa. Your public key has been saved in /c/Users/you/.ssh/id_rsa.pub. The key fingerprint is: 01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db your_email@example.com |
Copy the key to your clipboard.
$ cat ~/.ssh/id_rsa.pub ssh-rsa AAAAB3NzaC1yc2EAAABDAQABAAABAQDQUEnh8uGpfxaZVU6+uE4bsDrs/tEE5/BPW7jMAxak 6qgOh6nUrQGBWS+VxMM2un3KzwvLRJSj8G4TnTK2CSmlBvR+X8ZeXNTyAdaDxULs/StVhH+QRtFEGy4o iMIzvIlTyORY89jzhIsgZzwr01nqoSeWWASd+59JWtFjVy0nwVNVtbek7NfuIGGAPaijO5Wnshr2uChB Pk8ScGjQ3z4VqNXP6CWhCXTqIk7EQl7yX2GKd6FgEFrzae+5Jf63Xm8g6abbE3ytCrMT/jYy5OOj2XSg 6jlxSFnKcONAcfMTWkTXeG/OgeGeG5kZdtqryRtOlGmOeuQe1dd3I+Zz3JyT your_email@example.c om |
Go to Embedian Git Server. At Profile Setting --> SSH Keys --> Add SSH Key
Paste your public key and press "Add Key" and your are done.
The supplied meta-pitximx8mp-gatesgarth Yocto compliant layer has the following organization:
|
Notes on meta-pitximx8mp-gatesgarth layer content
conf/machine/*
This folder contains the machine definitions for the pitximx8mp2g/pitximx8mp4g/pitximx8mp6g platform and backup repository in Embedian. These select the associated kernel, kernel config, u-boot, u-boot config, and tar.bz2 image settings.
recipes-bsp/u-boot/*
This folder contains recipes used to build DAS U-boot for pitximx8mp2g/pitximx8mp4g/pitximx8mp6g platform.
recipes-bsp/alsa-state/*
This folder contains sgtl5000 sound chip default state for pitximx8mp2g/pitximx8mp4g/pitximx8mp6g platform.
recipes-bsp/imx-mkimage/*
This folder contains imx-mkimage tool for pitximx8mp2g/pitximx8mp4g/pitximx8mp6g platform.
recipes-bsp/imx-vpu-hantro-vc/*
This folder adds compatible machine for pitximx8mp2g/pitximx8mp4g/pitximx8mp6g platform
recipes-core/busybox/*
This folder remove telnetd from bysybox for pitximx8mp2g/pitximx8mp4g/pitximx8mp6g platform.
recipes-core/psplash/*
This folder customized Yocto boot psplash for pitximx8mp2g/pitximx8mp4g/pitximx8mp6g platform.
recipes-support/vim/*
This folder fixes xwayland build error for pitximx8mp2g/pitximx8mp4g/pitximx8mp6g platform.
recipes-kernel/linux/*
Contains the recipes needed to build the pitximx8mp2g/pitximx8mp4g/pitximx8mp6g Linux kernels.
To build the latest NXP i.MX8M Plus fsl-bsp-release, you first need an Ubuntu 16.04 0r 18.04LTS installation. Since bitbake does not accept building images using root privileges, please do not login as a root user when performing the instructions in this section.
Once you have Ubuntu 16.04 or 18.04 LTS running, install the additional required support packages using the following console command:
|
If you are using a 64-bit Linux, then you'd also need to install 32-bit support libraries, needed by the pre-built Linaro toolchain and other binary tools.
|
To get the BSP you need to have 'repo' installed and use it as:
Install the 'repo' utility:
|
$
|
|
Choose "y" to accept EULA.
This script will create and bring you to ~/pitx-imx8mp-gatesgarth-release/build-wayland directory.
|
|
|
Once it done, you can find all required images under ~/pitx-imx8mp-gatesgarth-release/<build directory>/tmp/deploy/images/<machine name>/
You may want to build programs that aren’t installed into a root file system so you can make them available via a feed site (described below.) To do this you can build the package directly and then build the package named package-index to add the new package to the feed site.
The following example builds the tcpdump program and makes it available on the feed site:
|
~/pitx-imx8mp-gatesgarth-release/<build directory>/tmp/deploy
.deploy/images/<machine name>/*
This folder contains the binary images for the root file system and the Embedian pITX-MX8M-PLUS specific version of the boot file, Image and device tree file. Specifically the images are:
deploy/images/<machine name>/imx-boot-<machine name>-sd.bin-flash_evk
This boot file binary for pITX-MX8M-PLUS
deploy/images/<machine name>/Image
The kernel Image for pITX-MX8M-PLUS.
deploy/images/<machine name>/<device tee file>
Selecting display configuration is a matter of selecting an appropriate DTB file under deploy/images/<machine name>/<device tee file>
All available DTB files are listed in the table below.
DTB File Name | Description |
---|---|
imx8mp-pitx.dtb | Device tree blob for no display configuration. |
imx8mp-pitx-hdmi.dtb | Device tree blob for HDMI display configuration. |
imx8mp-pitx-lvds.dtb | Device tree blob for LVDS display configuration. |
imx8mp-pitx-m7.dtb | Device tree blob for Cortex-M7 co-processor configuration. |
deploy/images/<machine name>/fsl-image-validation-imx-<machine name>.*
Embedian root file system images for software development on Embedian’s pITX-MX8M-PLUS platforms without QT5.
deploy/images/<machine name>/fsl-image-qt5-validation-imx-<machine name>.*
Embedian root file system images for software development on Embedian’s pITX-MX8M-PLUS with QT5.
deploy/deb/*
This folder contains all the packages used to construct the root file system images. They are in deb format (similar format to Debian packages) and can be dynamically installed on the target platform via a properly constructed feed file. Here is an example of the feed file (named base-feeds.conf) that is used internally at Embedian to install upgrades onto a pITX-MX8M-PLUS platform without reflashing the file system:
|
deploy/licenses/*
For these instruction, we are assuming: DISK=/dev/mmcblk0, "lsblk" is very useful for determining the device id.
$ export DISK=/dev/mmcblk0 |
Erase microSD card:
$ |
Create Partition Layout: Leave 2MB offset for boot file.
With util-linux v2.26, sfdisk was rewritten and is now based on libfdisk.
$ sudo sfdisk --version sfdisk from util-linux 2.27.1 |
Create Partitions:
$ sudo sfdisk ${DISK} <<-__EOF__ |
$ sudo sfdisk --in-order --Linux --unit M ${DISK} <<-__EOF__ |
Format Partitions:
for : DISK=/dev/mmcblk0 $ sudo mkfs.vfat -F 16 ${DISK}p1 -n boot $ sudo mkfs.ext4 ${DISK}p2 -L rootfs for : DISK=/dev/sdX $ sudo mkfs.vfat -F 16 ${DISK} 1 -n boot $ sudo mkfs.ext4 ${DISK} 2 -L rootfs |
Mount Partitions:
On some systems, these partitions may be auto-mounted...
$ sudo mkdir -p /media/boot/ $ sudo mkdir -p /media/rootfs/ for : DISK=/dev/mmcblk0 $ sudo mount ${DISK}p1 /media/boot/ $ sudo mount ${DISK}p2 /media/rootfs/ for : DISK=/dev/sdX $ sudo mount ${DISK} 1 /media/boot/ $ sudo mount ${DISK} 2 /media/rootfs/ |
imx-boot-<machine name>-sd.bin-flash_evk
)Boot file is factory default flashed at on-module eMMC flash.
If on-module eMMC Flash is empty
In some cases, when eMMC flash is erased or the u-boot is under development, we need a way to boot from microSD card first. Users need to set the SW2 port 1-3 as (ON ON ON). In this way, pITX-MX8M-PLUS will always boot up from SD card.
Fuse flash.bin to the microSD card.
$ sudo dd if=<boot file> of=${DISK} bs=1024 seek=32 |
If on-module eMMC Flash is not empty
The <boot file> is pre-installed in on-module eMMC flash at factory default. pITX-MX8M-PLUS is designed to always boot up from on-module eMMC flash and to load Image, device tree blob and root file systems based on the setting of BOOT_SEL. If users need to fuse your own flash.bin or perform u-boot upgrade. This section will instruct you how to do that.
Copy <boot file> to the second partition home directory of your microSD card and boot into microSD card. Go to home directory and you should see flash.bin file.
$ sudo cp -v <boot file> /media/rootfs/home/root/ |
Fuse <boot file> to the on-module eMMC flash. (The eMMC flash is emulated as /dev/mmcblk2 in pITX-MX8M-PLUS)
|
|
Create "uEnv.txt" boot script: ($ vim uEnv.txt)
optargs="video=HDMI-A-1:1920x1080-32@60 consoleblank=0" |
Copy uEnv.txt to the boot partition:
$ sudo cp -v ~/uEnv.txt /media/boot/ |
Copy Image to the boot partition:
$ sudo cp -v Image /media/boot |
|
All available DTB files are listed in the table below.
DTB File Name | Description |
---|---|
imx8mp-pitx.dtb | Device tree blob for no display configuration. |
imx8mp-pitx-hdmi.dtb | Device tree blob for HDMI display configuration. |
imx8mp-pitx-lvds.dtb | Device tree blob for LVDS display configuration. |
imx8mp-pitx-m7.dtb | Device tree blob for Cortex-M7 co-processor configuration. |
The device tree name in your microSD card has be to |
Yocto Built Rootfs:
$ sudo tar jxvf <filename.tar.bz2> -C /media/rootfs |
|
Remove microSD card:
$ sync $ sudo umount /media/boot $ sudo umount /media/rootfs |
This section tells you how to set up an microSD card automatically. It mainly uses a script to do all the steps in the above section.
|
The default output display is HDMI. If you need to use other device tree output, change "DISPLAY" parameters in the script. |
Set SW2 port 1-3 as (ON ON ON). The module will boot up from microSD card.
You need to setup Apache2 web server on your development host machine first.
The Apache server default web page directory is /var/www/html .We need to populate it with a link pointing to our deb package repository.
sudo ln -s /path/to/build-yocto/tmp/deploy/deb /var/www/html/deb |
The following procedure can be used on a Embedian pITX-MX8M-PLUS device to download and utilize the feed file show above to install the tcpdump terminal emulation program:
Only keep the following four lines:
|
|
In order to package your application and include it in the root filesystem image, you must write a BitBake recipe for it.
When starting from scratch, it is easiest to learn by example from existing recipes.
For software that uses autotools (./configure; make; make install), writing recipes can be very simple:
DESCRIPTION = "Hello World Recipe using autotools" HOMEPAGE = "http://www.embedian.com/" SECTION = "console/utils" PRIORITY = "optional" LICENSE = "GPL" PR = "r0" S = "${WORKDIR}/git" inherit autotools |
SRC_URI
specifies the location to download the source from. It can take the form of any standard URL using http://, ftp://, etc. It can also fetch from SCM systems, such as git in the example above.
PR
is the package revision variable. Any time a recipe is updated that should require the package to be rebuilt, this variable should be incremented.
inherit autotools
brings in support for the package to be built using autotools, and thus no other instructions on how to compile and install the software are needed unless something needs to be customized.
S
is the source directory variable. This specifies where the source code will exist after it is fetched from SRC_URI and unpacked. The default value is ${WORKDIR}/${PN}-${PV}
, where PN
is the package name and PV
is the package version. Both PN
and PV
are set by default using the filename of the recipe, where the filename has the format PN_PV.bb
.
This example shows a simple case of building a helloworld.c file directly using the default compiler (gcc). Since it isn’t using autotools or make, we have to tell BitBake how to build it explicitly.
DESCRIPTION = "HelloWorld" SECTION = "examples" LICENSE = "GPL" SRC_URI = "file://helloworld.c" S = "${WORKDIR}" do_compile() { ${CC} ${CFLAGS} ${LDFLAGS} helloworld.c -o helloworld } do_install() { install -d ${D}${bindir} install -m 0755 helloworld ${D}${bindir} } |
In this case, SRC_URI
specifies a file that must exist locally with the recipe. Since there is no code to download and unpack, we set S
to WORKDIR
since that is where helloworld.c will be copied to before it is built.
WORKDIR
is located at ${OETREE}/<build directory>/tmp/work/cortexa53-crypto-poky-linux/<package name and version>
for most packages. If the package is machine-specific (rather than generic for the aarxh64 architecture), it may be located in the cortexa53-crypto-poky-linux subdirectory depending on your hardware (this applies to kernel packages, images, etc).
do_compile
defines how to compile the source. In this case, we just call gcc directly. If it isn’t defined, do_compile
runs make
in the source directory by default.
do_install
defines how to install the application. This example runs install
to create a bin directory where the application will be copied to and then copies the application there with permissions set to 755.
D
is the destination directory where the application is installed to before it is packaged.
${bindir}
is the directory where most binary applications are installed, typically /usr/bin
.
For a more in-depth explanation of BitBake recipes, syntax, and variables, see the Recipe Chapter of the OpenEmbedded User Manual.
Setting up eMMC usually is the last step at development stage after the development work is done at your microSD card or NFS environments. From software point of view, eMMC is nothing but a non-removable microSD card on board. For pITX-MX8M-PLUS, the microSD card is always emulated as /dev/mmcblk1 and on-module eMMC is always emulated as /dev/mmcblk2. Setting up eMMC now is nothing but changing the device descriptor.
This section gives a step-by-step procedure to setup eMMC flash. Users can write a shell script your own at production to simplify the steps.
First, we need to backup the final firmware from your microSD card or NFS.
Insert microSD card into your Linux PC. For these instructions, we are assuming: DISK=/dev/mmcblk0, "lsblk" is very useful for determining the device id.
For these instruction, we are assuming: DISK=/dev/mmcblk0, "lsblk" is very useful for determining the device id.
$ export DISK=/dev/mmcblk0 |
Mount Partitions:
On some systems, these partitions may be auto-mounted...
$ sudo mkdir -p /media/boot/ $ sudo mkdir -p /media/rootfs/ for : DISK=/dev/mmcblk0 $ sudo mount ${DISK}p1 /media/boot/ $ sudo mount ${DISK}p2 /media/rootfs/ for : DISK=/dev/sdX $ sudo mount ${DISK} 1 /media/boot/ $ sudo mount ${DISK} 2 /media/rootfs/ |
Copy Image to rootfs partition:
$ sudo cp -v Image /media/rootfs/home/root |
Copy uEnv.txt to rootfs partition:
Copy and paste the following contents to /media/rootfs/home/root ($ sudo vim /media/rootfs/home/root/uEnv.txt)
optargs="video=HDMI-A-1:1920x1080-32@60 consoleblank=0" |
Copy device tree blob to rootfs partition:
$ sudo cp -v <device tree blob> /media/rootfs/home/root/imx8mp-pitx.dtb |
Copy real rootfs to rootfs partition:
|
Remove SD card:
$ sync $ sudo umount /media/boot $ sudo umount /media/rootfs |
Insert this microSD card into your pITX-MX8M-PLUS device.
Now it will be almost the same as you did when setup your microSD card, but the eMMC device descriptor is /dev/mmcblk2 now. Booting up the device.
$ export DISK=/dev/mmcblk2 |
Erase eMMC:
$ |
Create Partition Layout:
$ sudo sfdisk ${DISK} <<-__EOF__
50M,,, __EOF__ |
Format Partitions:
$ sudo mkfs.vfat -F 16 ${DISK}p1 -n boot $ sudo mkfs.ext4 ${DISK}p2 -L rootfs |
Mount Partitions:
$ sudo mkdir -p /media/boot/ $ sudo mkdir -p /media/rootfs/ $ sudo mount ${DISK}p1 /media/boot/ $ sudo mount ${DISK}p2 /media/rootfs/ |
Copy uEnv.txt/Image/*.dtb to the boot partition
$ sudo cp -v Image uEnv.txt /media/boot/ |
$ sudo mkdir -p /media/boot/dtbs $ sudo cp -v imx8mp-pitx.dtb /media/boot/dtbs/ |
$ sudo tar -zxvf pitximx8mp-emmc-rootfs.tar.gz -C /media/rootfs |
Unmount eMMC:
$ sync $ sudo umount /media/boot $ sudo umount /media/rootfs |
Switch your Boot Select to eMMC and you will be able to boot up from eMMC now.
Boot up the module from microSD card and run the following script. The Yocto images will be written into on-module eMMC.
|
Shutdown the device. Set SW2 port 1-3 as (OFF ON OFF). The module will boot up from on-module eMMC.
For playing video, we can use three solutions to support it.
a) # gplay-1.0 <video file>
b) # gst-launch-1.0 playbin uri=file://<video absolute path>
c) ( i ) if video container on .mp4 format
# gst-launch-1.0 filesrc location=<file name.mp4> typefind=true ! video/quicktime ! qtdemux ! queue max-size-time=0 ! vpudec ! queue max-size-time=0 ! kmssink force-hantrope=true sync=false &
( ii ) if video container on .ts format
# gst-launch-1.0 filesrc location=<file name.ts> typefind=true ! video/mpegts ! tsdemux ! queue max-size-time=0 ! vpudec ! queue max-size-time=0 ! waylandsink
The BSP includes NXP 88W8997 wifi chipset. Users can choose mPCIe or M.2 key E form factor wifi modules based on NXP 88W8997 chipset.
M.2 Form Factor:
AzureWave P/N: AW-CM276MA-PUR
Laird Connectivity P/N: 60-2230C
Embedded Artists 1YM M.2 Module
mPCIe Factor:
Globascale Technologies NXP 88W8997 2x2 WiFi 802.11ac+BT 5.0 mini PCIe Card w/ Two External SMA Antennas
Get 88W8997 Firmware
|
Copy the firmware imx-firmware/nxp/FwImage_8997/pcieuart8997_combo_v4.bin into device /lib/firmware/nxp/ directory. (Replace the original one)
Boot up the device and load the driver modules in the kernel.
|
Verify that the module is now visible to the system.
|
In case you need to see which network and you can scan it and select the one you need.
|
Identify the network and add it to the WPA supplicant file.
|
|
Associate the Wi-Fi with config
|
Check if you have right SSID associated.
|
Use DHCP to get IP
|
You should be able to ping local network now.
|
Modify /etc/resolv.conf of your preference, you will be able to ping out.
|
|
|
version 1.0a, 8/18/2022
Last updated 2022-08-18