Skip to end of metadata
Go to start of metadata

Building NXP/Embedian’s Yocto Mickledore BSP Distribution

Eric Lee

version 1.0a, 10/28/2024

Introduction


 

This document describes how Embedian builds a customized version of NXP’s i.MX93 official Yocto Mickledore BSP release for Embedian's SMARC-iMX93 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 SMARC-iMX93 specific development.

 

NXP makes their i.MX series official bsp build scripts available via the following GIT repository:

 

Freescale community BSP release build script is available via the following repository: 

 

It is this repository that actually pulls in the meta-imx/meta-bsp project to perform the Linux BSP builds for NXP's i.MX93 ARM Cortext-A55 chips.  

Generating SSH Keys


 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. 

Step 1. Check for SSH keys


First, we need to check for existing ssh keys on your computer. Open up Git Bash and run:

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.

Step 2. Generate a new SSH key


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.

Step 3. Add your SSH key to Embedian Gitlab Server


Copy the key to your clipboard.

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.

Overview of the meta-embedian Yocto Layer


The supplied meta-embedian Yocto compliant layer has the following organization: 

.
|-- conf
|   |-- layer.conf
|   |-- machine
|       |-- include
|       |   |-- imx8mp-emb.inc
|       |-- smarcimx932g.conf
|       |-- smarcimx931g.conf
|       |-- pitximx8mp2g.conf
|       |-- pitximx8mp4g.conf
|       |-- pitximx8mp6g.conf
|       |-- smarcimx8qm8g.conf
|       |-- smarcimx8qm4g.conf
|       |-- smarcimx8mp6g.conf
|       |-- smarcimx8mp4g.conf
|       |-- smarcimx8mp2g.conf
|       |-- smarcimx8mq4g.conf
|       |-- smarcimx8mq2g.conf
|       |-- smarcimx8mm4g.conf
|       |-- smarcimx8mm2g.conf
|       |-- smarcfimx7d2g.conf
|       |-- smarcfimx7d.conf
|       |-- smarcfimx7s.conf
|       |-- smarcfimx6qp2g.conf
|       |-- smarcfimx6qp1g.conf
|       |-- smarcfimx6q2g.conf
|       |-- smarcfimx6q1g.conf
|       |-- smarcfimx6dl1g.conf
|   |   `-- smarcfimx6solo.conf
|-- README
|-- recipes-bsp
|   |-- u-boot
|       |-- u-boot-imx-common_2023.04.inc
|       `-- u-boot-imx_2023.04.bb
|   |-- imx-atf
|       `-- imx-atf_2.8.bbappend
|       |   |-- imx-atf
|       |   |   |-- 0001-imx8mm-allocate-uart4-to-cortex-a53.patch
|       |   |   `-- 0001-imx8mp-pitx-change-console-port-to-ttymxc3.patch
|   |-- imx-sc-firmware
|       `-- imx-sc-firmware_%.bbappend
|       |   |-- imx-sc-firmware
|       |   |   |-- mx8qm-smarc-8g-scfw-tcm.bin
|       |   |   `-- mx8qm-smarc-4g-scfw-tcm.bin
|   |-- alsa-state
|       |   |-- alsa-state
|       |   |   `-- asound.state
|       `-- alsa-state.bbappend
|   |-- pm-utils
|       `-- pm-utils_%.bbappend
|   |-- imx-mkimage
|       `-- imx-boot_1.0.bbappend

|-- recipes-core
|   |-- busybox
|       `-- busybox_%.bbappend
|       |   |-- busybox
|       |   |   |-- ftpget.cfg
|       |   |   `-- defconfig
|   |-- base-files
|       `-- base-files_%.bbappend
|       |   |-- base-files
|       |   |   |-- issue
|       |   |   `-- issue.net
|   |-- systemd
|       |-- systemd_%.bbappend
|       |   |-- systemd
|       |   |   |-- 0001-units-add-dependencies-to-avoid-conflict-between-con.patch
|       |   |   `-- 0002-units-disable-systemd-networkd-wait-online-if-Networ.patch
|       `-- systemd-serialgetty.bbappend
|       |   |-- systemd-serialgetty
|       |   |   |-- disable-serialgetty.service
|       |   |   `-- disable-serialgetty.sh
|   |-- packagegroups
|       `-- packagegroup-core-tools-testapps.bbappend
|   |-- psplash
|       `-- psplash_git.bbappend
|       |   |-- files
|       |   |   |-- 0001-psplash-Change-colors-for-the-Embedian-Yocto-logo.patch
|       |   |   |-- psplash-poky.png
|       |   |   `-- psplash-bar.png
|   |-- udev
|       |   |-- files
|       |   |   |   `-- usb-power.rules  
|       `-- udev-rules-imx.bbappend

|-- recipes-multimedia
|   |-- gstreamer
|       `-- gstreamer1.0-plugins-bad_1.22.5.imx.bbappend
|       |   |-- gstreamer1.0-plugins-bad
|       |   |   `-- 0001-fix-display-fullscreen-vertical-positioning-issue.patch
`-- scripts
|   `-- emb_mk_yocto_sdcard


Notes on 
meta-embedian layer content

conf/machine/*

This folder contains the machine definitions for all Embedian's 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 all Embedian's platform.

recipes-bsp/imx-atf/*

This folder contains recipes used to enable console port for Embedian's i.MX8MM and pITX-MX8M-Plus platform.

recipes-bsp/imx-sc-firmware/*

This folder contains system control firmware binary for Embedian's i.MX8QM platform.

recipes-bsp/alsa-state/*

This folder contains sgtl5000 sound chip default state for all Embedian's platform.

recipes-bsp/imx-mkimage/*

This folder contains imx-mkimage tool for Embedian's i.MX93, i.MX8MQ, i.MX8MM, i.MX8QM, i.MX8MP platform.

recipes-core/busybox/*

This folder remove telnetd from bysybox for all Embedian's platform.  

recipes-core/psplash/* 

This folder customized Yocto boot psplash for all Embedian's platform.

recipes-kernel/linux/*

Contains the recipes needed to build for all Embedian's platform Linux kernels.

Setting Up the Tools and Build Environment


To build the latest NXP i.MX93 Plus meta-bsp, you first need an Ubuntu 20.04 or 22.04 LTS 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 20.04 or 22.04 LTS running, install the additional required support packages using the following console command:

$ 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 libssl-dev pv device-tree-compiler locales -y 

$ sudo locale-gen en_US.UTF-8

 

To get the BSP you need to have 'repo' installed and use it as:

Install the 'repo' utility:

 

$ mkdir ~/bin
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
$ export PATH=~/bin:$PATH 

 

Download the BSP Yocto Project Environment.

 

$ mkdir ~/mickledore-release

$ cd ~/mickledore-release

$ repo init -u https://github.com/nxp-imx/imx-manifest -b imx-linux-mickledore -m imx-6.1.55-2.2.0.xml

$ repo sync

 

 Download the Embedian Yocto build script and meta layer.

 

$ wget ftp://ftp.embedian.com/public/dev/minfs/mickledore/emb-imx-setup-release.sh

$ chmod 444 emb-imx-setup-release.sh

$ cd sources

$ git clone git@git.embedian.com:developer/meta-embedian-bsp.git meta-embedian -b mickledore-6.1.55_2.2.0

$ cd ~/mickledore-release

$ DISTRO=fsl-imx-xwayland MACHINE=smarcimx932g source emb-imx-setup-release.sh -b build-xwayland 


Choose "y" to accept EULA.
This script will create and bring you to ~/mickledore-release/build-xwayland directory.

 

Note

Icon

The last line of the above script

$ DISTRO=<distro name> MACHINE=<machine name> source emb-imx-setup-release.sh -b <build dir>

  1. <distro name> 
    • fsl-imx-wayland - Pure wayland weston graphics

    • fsl-imx-xwayland - Wayland graphics and X11. X11 applications using EGL are not supported

    • fsl-imx-fb - Frame Buffer graphics - no X11 or Wayland. Frame Buffer is not supported on i.MX8 and i.MX9.

  2. <machine name>

    • smarcimx932g - if your board is quad core i.MX93 and 2GB LPDDR4x.

    • smarcimx931g - if your board is quad core i.MX93 and 1GB LPDDR4.

The default console debug port is SER3.

In this document, we will use smarcimx932g as the example of machine name. Users need to change different machine name if you have different SMARC card variants.

 
Building the target platforms

 To build Embedian/Freescale Yocto BSP, use the following commands:

$ MACHINE=smarcimx932g bitbake -k fsl-image-qt6-validation-imx
or
$ MACHINE=smarcimx931g bitbake -k fsl-image-validation-imx


Note

Icon

fsl-image-validation-imx provides a gui image without QT6. 

fsl-image-qt6-validation-imx provides a Qt6 image for X11, wayland or FB backends depending on your distro name.

If your machine name is smarcimx932g and your gui image is without QT6 , the following command gives you as an example.

$ MACHINE=smarcimx932g bitbake -k fsl-image-validation-imx

The first build takes time.

 

Once it done, you can find all required images under ~/mickledore-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:

$ MACHINE=smarcimx932g bitbake tcpdump

$ MACHINE=smarcimx932g bitbake package-index


Once the build(s) are completed you’ll find the resulting images, rpm and licenses in folder ~/mickledore-release/<build directory>/tmp/deploy.

deploy/images/<machine name>/* 

This folder contains the binary images for the root file system and the Embedian SMARC-iMX93 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_singleboot

This is boot file binary for SMARC-iMX93.

deploy/images/<machine name>/Image

The kernel Image for SMARC-iMX93.  

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 NameDescription
imx93-smarc.dtbDevice tree blob for 2GB LPDDR4x configuration.
imx93-smarc-1g.dtbDevice tree blob for 1GB LPDDR4x configuration.


deploy/images/<machine name>/fsl-image-validation-imx-<machine name>.*

Embedian root file system images for software development on Embedian’s SMARC-iMX93 platforms without QT6.

deploy/images/<machine name>/fsl-image-qt6-validation-imx-<machine name>.*

Embedian root file system images for software development on Embedian’s SMARC-iMX93  with QT6.

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 SMARC-iMX93 platform without reflashing the file system:

src/gz all http://<ip address>/all

src/gz armv8a http://<ip address>/armv8a

src/gz armv8a-mx93 http://<ip addresss>/armv8a-mx93

src/gz smarcimx932g http://<ip addresss>/smarcimx932g


deploy/licenses/* 
A database of all licenses used in all packages built for the system.

Setup SD Card Manually


For these instruction, we are assuming: DISK=/dev/mmcblk0, "lsblk" is very useful for determining the device id.

$ export DISK=/dev/mmcblk0

Erase SD card:

$ sudo dd if=/dev/zero of=${DISK} bs=1M count=160

Create Partition Layout: Leave 1MB offset for boot file.

With util-linux v2.26, sfdisk was rewritten and is now based on libfdisk.

sfdisk

$ sudo sfdisk --version
sfdisk from util-linux 2.34

Create Partitions:

sfdisk >=2.26.x

Icon

$ sudo sfdisk ${DISK} <<-__EOF__
2M,48M,0x83,*

50M,,,
__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/

Install Boot File (imx-boot-<machine name>-sd.bin-flash_singleboot)

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 SD card first. Users need to shunt cross the TEST# pin to ground. In this way, SMARC-iMX93 will always boot up from SD card. 

Fuse flash.bin to the SD card. 

~/mickledore-release/<build dir>/tmp/deploy/images/<machine name>/


$ 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. SMARC-iMX93 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 SD card and boot into SD card. Go to home directory and you should see flash.bin file. 

~/mickledore-release/<build dir>/tmp/deploy/images/<machine name>/


$ 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/mmcblk0 in SMARC-iMX93)

home directory


$ sudo dd if=<boot file> of=/dev/mmcblk0 bs=1024 seek=32

Icon
  1. If your u-boot hasn't been finalized and still under development, it is recommended to shunt cross the test pin and boot directly from SD card first. Once your u-boot is fully tested and finalized, you can fuse your <boot file> to eMMC flash.
  2. When TEST# pin of SMARC-iMX93 is not shunt crossed, it will always boot up from on-module eMMC flash. U-boot will read the BOOT_SEL configuration and determine where it should load Image and device tree blob. When TEST# is shunt crossed (pull low), it will always boot up from SD card.

uEnv.txt based bootscript

Create "uEnv.txt" boot script: ($ vim uEnv.txt)

~/uEnv.txt


#console port SER3
console=ttyLP0,115200 earlycon
#console port SER2
#console=ttyLP7,115200 earlycon
#console port SER1
#console=ttyLP1,115200 earlycon
#console port SER0
#console=ttyLP5,115200 earlycon
mmcdev=1
mmcpart=1
image=Image
#loadaddr=0x80400000
#fdt_addr=0x83000000
loadaddr=0x80400000
fdt_addr=0x84000000
mmcroot=/dev/mmcblk1p2 rw
mmcrootfstype=ext4 rootwait fixrtc
netdev=eth0
ethact=FEC0
ipaddr=192.168.1.150
serverip=192.168.1.53
gatewayip=192.168.1.254
mmcargs=setenv bootargs console=${console} root=${mmcroot} rootfstype=${mmcrootfstype} ${optargs}
# uenvcmd=run loadimage; run loadfdt; run mmcboot
# USB Boot
#usbargs=setenv bootargs console=${console} root=${usbroot} rootfstype=${mmcrootfstype} ${optargs}
#uenvcmd=run loadusbimage; run loadusbfdt; run usbboot

Copy uEnv.txt to the boot partition:

~/

Icon

$ sudo cp -v ~/uEnv.txt /media/boot/

Install Kernel Image

Copy Image to the boot partition:

~/mickledore-release/<build dir>/tmp/deploy/images/<machine name>/


$ sudo cp -v Image /media/boot

Install Kernel Device Tree Binary

~/mickledore/<build dir>/tmp/deploy/images/<machine name>/

$ sudo mkdir -p /media/boot/dtbs

$ sudo cp -v <device tree file> /media/boot/dtbs/imx93-smarc.dtb

All available DTB files are listed in the table below.

DTB File NameDescription
imx93-smarc.dtbDevice tree blob for 2GB LPDDR4x configuration.
imx93-smarc-1g.dtbDevice tree blob for 1GB LPDDR4x configuration.

The device tree name in your SD card has be to imx93-smarc.dtb

Install Root File System


Copy Root File System:

Yocto Built Rootfs:

~/mickledore-release/<build dir>/tmp/deploy/images/<machine name>/


$ sudo tar jxvf <filename.tar.bz2> -C /media/rootfs

Note

Icon
  1. SMARC-iMX93 always boots up from on-module eMMCI flash first. The firmware in eMMC flash is factory pre-installed from Embedian. It will read the BOOT_SEL configuration that defined by SMARC specification on your carrier board and load Image and device tree blob from the partition one of the device (could be SD card, eMMC, GBE,..etc) that you selected.
  2. MAC address is factory pre-installed at on board I2C EEPROM at offset 60 bytes. It starts with Embedian's vendor code 10:0D:32. u-boot will read it and pass this parameter to kernel.
  3. The kernel modules is included in the Yocto rootfs.

Remove SD card:

$ sync
$ sudo umount /media/boot
$ sudo umount /media/rootfs

Setup SD Card Automatically


This section tells you how to set up an SD card automatically. It mainly uses a script to do all the steps in the above section.

$ cd ~/mickledore-release

$ sudo MACHINE=smarcimx932g sources/meta-embedian/scripts/emb_mk_yocto_sdcard/emb-create-yocto-sdcard.sh /dev/sdX

Shunt cross TEST# pin to ground and set the BOOT_SEL to ON OFF OFF. The module will boot up from SD card.  

Feed Packages 


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.

 

Icon
sudo ln -s /path/to/build-yocto/tmp/deploy/deb /var/www/html/deb


The following procedure can be used on a Embedian SMARC-iMX93 device to download and utilize the feed file show above to install the tcpdump terminal emulation program:

# vim /etc/apt/sources.list.d/yocto.list

Only keep the following four lines:

deb https://<ip address>/all ./

deb http://<ip address>/armv8a ./

deb http://<ip address>/armv8a-mx93 ./

deb http://<ip address>/smarcimx932g ./

Icon

# apt-get update

# apt-get upgrade

# apt-get install tcpdump

 

Writing Bitbake Recipes


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. 

Example HelloWorld recipe using autotools

For software that uses autotools (./configure; make; make install), writing recipes can be very simple:

 

DESCRIPTION = "Hello World Recipe using autotools"
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.

Example HelloWorld recipe using a single source file

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/armv8a-poky-linux/<package name and version> for most packages. If the package is machine-specific (rather than generic for the armv8a architecture), it may be located in the smarcimx932g-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.

Setup eMMC Manually


Setting up eMMC usually is the last step at development stage after the development work is done at your SD card or NFS environments. From software point of view, eMMC is nothing but a non-removable SD card on board. For SMARC-iMX93, the SD card is always emulated as /dev/mmcblk1 and on-module eMMC is always emulated as /dev/mmcblk0. 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 SD card or NFS.

Prepare for eMMC binaries from SD card (or NFS):

Insert SD 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:

~/mickledore-release/<build dir>/tmp/deploy/images/<machine name>

$ 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)

#console port SER3
console=ttyLP0,115200 earlycon
#console port SER2
#console=ttyLP7,115200 earlycon
#console port SER1
#console=ttyLP1,115200 earlycon
#console port SER0
#console=ttyLP5,115200 earlycon
mmcdev=0
mmcpart=1
image=Image
#loadaddr=0x80400000
#fdt_addr=0x83000000
loadaddr=0x80400000
fdt_addr=0x84000000
mmcroot=/dev/mmcblk0p2 rw
mmcrootfstype=ext4 rootwait fixrtc
netdev=eth0
ethact=FEC0
ipaddr=192.168.1.150
serverip=192.168.1.53
gatewayip=192.168.1.254
mmcargs=setenv bootargs console=${console} root=${mmcroot} rootfstype=${mmcrootfstype} ${optargs}
# uenvcmd=run loadimage; run loadfdt; run mmcboot
# USB Boot
#usbargs=setenv bootargs console=${console} root=${usbroot} rootfstype=${mmcrootfstype} ${optargs}
#uenvcmd=run loadusbimage; run loadusbfdt; run usbboot


Copy device tree blob to rootfs partition:

~/mickledore-release/<build dir>/tmp/deploy/images/<machine name>

$ sudo cp -v <device tree file> /media/rootfs/home/root/imx93-smarc.dtb


Copy boot file to rootfs partition:

~/mickledore-release/<build dir>/tmp/deploy/images/<machine name>

$ sudo cp -v imx-boot-smarcimx932g-sd.bin-flash_singleboot /media/rootfs/home/root/flash.bin

 

Copy real rootfs to rootfs partition:

$ pushd /media/rootfs
$ sudo tar cvfz ~/smarcimx93-emmc-rootfs.tar.gz .
$ sudo mv ~/smarcimx93-emmc-rootfs.tar.gz /media/rootfs/home/root
$ popd

Remove SD card:

$ sync
$ sudo umount /media/boot
$ sudo umount /media/rootfs

Copy Binaries to eMMC from SD card:

Insert this SD card into your SMARC-iMX93 device.

Now it will be almost the same as you did when setup your SD card, but the eMMC device descriptor is /dev/mmcblk0 now. Booting up the device.

$ export DISK=/dev/mmcblk0

Erase eMMC:

$ sudo dd if=/dev/zero of=${DISK} bs=1M count=160

Create Partition Layout:

$ sudo sfdisk ${DISK} <<-__EOF__
2M,48M,0x83,*
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/

Install binaries for partition 1

Copy uEnv.txt/Image/*.dtb to the boot partition


$ sudo cp -v Image uEnv.txt /media/boot/

Install Kernel Device Tree Binary

$ sudo mkdir -p /media/boot/dtbs
$ sudo cp -v imx93-smarc.dtb /media/boot/dtbs/

Install Root File System


$ sudo tar -zxvf smarcimx93-emmc-rootfs.tar.gz -C /media/rootfs

 

Unmount eMMC:

$ sync
$ sudo umount /media/boot
$ sudo umount /media/rootfs

Flash boot file


$ sudo dd if=flash.bin of=${DISK} bs=1024 seek=32

 

Switch your Boot Select to eMMC (OFF ON ON) and you will be able to boot up from eMMC now.

Setup eMMC Automatically 


Boot up the module from SD card and run the following script. The Yocto images will be written into on-module eMMC.

$ smarc-imx932-create-yocto-emmc.sh /dev/mmcblk2 >/dev/null 2>&1 (if 2GB LPDDR4x)

$ smarc-imx931-create-yocto-emmc.sh /dev/mmcblk2 >/dev/null 2>&1 (if 1GB LPDDR4x)

 Shutdown the device. Set TEST# pin floating and set the BOOT_SEL to OFF ON ON. The module will boot up from on-module eMMC. 

 

WiFi 


The BSP includes NXP iW612 wifi chipset. Embedian i.MX93 SMARC card has other variants that include Murata 2EL WiFi/BT module for WiFi/BT function. Users can M.2 key E form factor WIFI/BT modules based on NXP iW612 chipset on their carrier board.  

M.2 Form Factor:

  • AzureWave P/N: AW-XM549
  • ublox P/N: M2-MAYA-W2
  • Embedded Artists EAR00464

Boot up the device and load the driver modules in the kernel.

root@smarcimx932g:~# modprobe moal mod_para=nxp/wifi_mod_para.conf

[ 34.543520] mlan: loading out-of-tree module taints kernel.
[ 34.608249] wlan: Loading MWLAN driver
[ 34.612361] wlan: Register to Bus Driver...
[ 34.617032] vendor=0x0471 device=0x0205 class="0" function=1
[ 34.629025] Attach moal handle ops, card interface type: 0x109
[ 34.634901] rps set to 0 from module param
[ 34.643239] SDIW612: init module param from usr cfg
[ 34.648187] card_type: SDIW612, config block: 0
[ 34.652808] cfg80211_wext=0xf
[ 34.655799] max_vir_bss=1
[ 34.658425] cal_data_cfg=none
[ 34.661382] ps_mode = 1
[ 34.664016] auto_ds = 1
[ 34.666501] host_mlme=enable
[ 34.669374] fw_name=nxp/sduart_nw61x_v1.bin.se
[ 34.673846] SDIO: max_segs=128 max_seg_size=65535
[ 34.678629] rx_work=1 cpu_num=2
[ 34.681767] Enable moal_recv_amsdu_packet
[ 34.685806] Attach mlan adapter operations.card_type is 0x109.
[ 34.692097] wlan: Enable TX SG mode
[ 34.695633] wlan: Enable RX SG mode
[ 34.701949] Request firmware: nxp/sduart_nw61x_v1.bin.se
[ 34.993378] Wlan: FW download over, firmwarelen=998324 downloaded 911924
[ 35.405831] WLAN FW is active
[ 35.408805] on_time is 35243035307
[ 35.431762] VDLL image: len=86400
[ 35.435400] fw_cap_info=0x487cff03, dev_cap_mask=0xffffffff
[ 35.441342] uuid: 830a44b73e435ab0aaae2cf332e71f36
[ 35.446169] max_p2p_conn = 8, max_sta_conn = 16
[ 35.468267] Register NXP 802.11 Adapter mlan0
[ 35.474133] wlan: uap%d set max_mtu 2000
[ 35.482154] Register NXP 802.11 Adapter uap0
[ 35.498744] Register NXP 802.11 Adapter wfd0
[ 35.505765] wlan: version = SDIW612---18.99.2.p66.10-MM6X18423.p6-GPL-(FP92)
[ 35.515169] systemd-journald[194]: Time jumped backwards, rotating.
[ 35.529941] pca953x 1-0022: irq 123: unsupported type 8
[ 35.535174] genirq: Setting trigger mode 8 for irq 123 failed (pca953x_irq_set_type+0x0/0x120)
[ 35.553267] wlan_sdio mmc2:0001:1: Failed to request irq_oob_wakeup 123 (-22)
[ 35.564746] wlan: Register to Bus Driver Done
[ 35.569205] wlan: Driver loaded successfully

[ 33.834782] can2-stby: disabling
[ 33.838051] VSD1_3V3: disabling

root@smarcimx932g:~#

 Verify that the module is now visible to the system. 

root@smarcimx932g:~# ifconfig -a

can0: flags=128<NOARP> mtu 16
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 10 (UNSPEC)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 121

can1: flags=128<NOARP> mtu 16
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 10 (UNSPEC)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 122

eth0: flags=-28605<UP,BROADCAST,RUNNING,MULTICAST,DYNAMIC> mtu 1500
inet 192.168.1.157 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::120d:32ff:fe05:1 prefixlen 64 scopeid 0x20<link>
ether 10:0d:32:05:00:01 txqueuelen 1000 (Ethernet)
RX packets 272 bytes 23974 (23.4 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 69 bytes 8418 (8.2 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

eth1: flags=-28605<UP,BROADCAST,RUNNING,MULTICAST,DYNAMIC> mtu 1500
inet 192.168.1.51 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::120d:32ff:fe06:1 prefixlen 64 scopeid 0x20<link>
ether 10:0d:32:06:00:01 txqueuelen 1000 (Ethernet)
RX packets 266 bytes 20986 (20.4 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 81 bytes 9994 (9.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 106

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 96 bytes 8198 (8.0 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 96 bytes 8198 (8.0 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

mlan0: flags=4098<BROADCAST,MULTICAST> mtu 1500
ether 50:26:ef:b1:79:aa txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

uap0: flags=4098<BROADCAST,MULTICAST> mtu 1500
ether 52:26:ef:b1:7a:aa txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

wfd0: flags=4098<BROADCAST,MULTICAST> mtu 1500
ether 52:26:ef:b1:79:aa txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

root@smarcimx932g:~#

 In case you need to see which network and you can scan it and select the one you need. 

root@pitximx932g:~# iwlist mlan0 scan

mlan0 Scan completed :
Cell 01 - Address: 78:C5:7D:D9:62:02
ESSID:"daint"
Mode:Master
Frequency=5.22 GHz (Channel 44)
Quality:1/5 Signal level:-86 dBm Noise level:-96 dBm
Encryption key:on
Bit Rates:6 Mb/s; 9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s
36 Mb/s; 48 Mb/s; 54 Mb/s
Extra:Beacon interval=100
IE: IEEE 802.11i/WPA2 Version 1
Group Cipher : CCMP
Pairwise Ciphers (1) : CCMP
Authentication Suites (1) : PSK
IE: Unknown: DD360050F204104A0001101044000102105700010110470010BC329E001DD811B2860178C57DD96202103C0001021049000600372A000120
IE: Unknown: DD180050F2020101800003A4000027A4000042435E0062322F00
IE: Unknown: DD07000C4300000000
IE: Unknown: DD21000CE700000000BF0CB101C0332AFF92042AFF9204C0050000002AFFC303010202
IE: Unknown: DD1F000CE700010000000000012710000000000000000000000000000000000000
Extra:band=a

....

Cell 13 - Address: 48:EE:0C:ED:D7:38
ESSID:"embedian" [13]
Mode:Master
Frequency=5.805 GHz
Quality:5/5 Signal level:-42 dBm Noise level:-96 dBm
Encryption key:on
Bit Rates:6 Mb/s; 9 Mb/s; 12 Mb/s; 18 Mb/s; 24 Mb/s
36 Mb/s; 48 Mb/s; 54 Mb/s
Extra:Beacon interval=100
IE: WPA Version 1
Group Cipher : TKIP
Pairwise Ciphers (2) : TKIP CCMP
Authentication Suites (1) : PSK
IE: IEEE 802.11i/WPA2 Version 1
Group Cipher : TKIP
Pairwise Ciphers (2) : TKIP CCMP
Authentication Suites (1) : PSK
IE: Unknown: DD180050F2020101000003A4000027A4000042435E0062322F00
IE: Unknown: DD1E00904C336E181FFFFF000000000000000000000000000000000000000000
IE: Unknown: DD1A00904C34A1070000000000000000000000000000000000000000
IE: Unknown: DD0700E04C02026004
IE: Unknown: DD7F0050F204104A0001101044000102103B00010310470010112233445566778899AA48EE0CEDD73610210006442D4C696E6B102300074449522D383432102400074449522D3834321042000830303030303030301054000800060050F2040001101100074449522D38343210080002208C103C0001031049000600372A000120
Extra:band=a

...

Identify the network and add it to the WPA supplicant file. 

root@smarcimx932g:~# vim /etc/wpa_supplicant.conf

ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
update_config=1

network={
scan_ssid=1
ssid="embedian"
psk="xxxxxxxxxx"
}

 Associate the Wi-Fi with config

root@smarcimx932g:~# wpa_supplicant -B -i mlan0 -c /etc/wpa_supplicant.conf

Successfully initialized wpa_supplicant
rfkill: Cannot open RFKILL control device
root@smarcimx932g:~# [ 320.336481] wlan: mlan0 START SCAN
[ 325.293957] wlan: SCAN COMPLETED: scanned AP count=21
[ 325.310912] wlan: HostMlme mlan0 send auth to bssid 48:XX:XX:XX:d7:38
[ 325.318413] mlan0:
[ 325.318428] wlan: HostMlme Auth received from 48:XX:XX:XX:d7:38
[ 325.350060] wlan: HostMlme mlan0 Connected to bssid 48:XX:XX:XX:d7:38 successfully
[ 325.359406] mlan0:
[ 325.359424] wlan: Send EAPOL pkt to 48:XX:XX:XX:d7:38
[ 325.368630] mlan0:
[ 325.368645] wlan: Send EAPOL pkt to 48:XX:XX:XX:d7:38
[ 325.385563] IPv6: ADDRCONF(NETDEV_CHANGE): mlan0: link becomes ready
[ 325.392567] woal_cfg80211_set_rekey_data return: gtk_rekey_offload is DISABLE

root@smarcimx932g:~#

Check if you have right SSID associated.

root@smarcimx932g:~# iwconfig mlan0

mlan0 IEEE 802.11-DS ESSID:"embedian" [11]
Mode:Managed Frequency=5.805 GHz Access Point: 48:EE:0C:ED:D7:38
Bit Rate:433.5 Mb/s Tx-Power=24 dBm
Retry limit:9 RTS thr=2347 B Fragment thr=2346 B
Encryption key:****-****-****-****-****-****-****-****-****-****-****-****-****-****-****-****-****-****-****-****-****-****-****-****-****-****-****-****-****-****-****-**** Security mode:open
Power Management:on
Link Quality=5/5 Signal level=-44 dBm Noise level=-89 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:457
Tx excessive retries:2 Invalid misc:8 Missed beacon:0

root@smarcimx932g:~#

 Use DHCP to get IP

root@smarcimximx932g:~# udhcpc -i mlan0

udhcpc: started, v1.36.1
Dropped protocol specifier '.udhcpc' from 'mlan0.udhcpc'. Using 'mlan0' (ifindex=6).
[ 447.168912] imx-dwmac 428a0000.ethernet eth1: Link is Down
[ 447.175991] imx-dwmac 428a0000.ethernet eth1: FPE workqueue stop
[ 447.290930] imx-dwmac 428a0000.ethernet eth1: PHY [stmmac-1:01] driver [RTL8211F Gigabit Ethernet] (irq=POLL)
[ 447.301023] imx-dwmac 428a0000.ethernet eth1: configuring for phy/rgmii-id link mode
udhcpc: broadcasting discover
udhcpc: broadcasting select for 192.168.1.52, server 192.168.1.254
udhcpc: lease of 192.168.1.52 obtained from 192.168.1.254, lease time 86400
/etc/udhcpc.d/50default: Adding DNS 192.168.1.254
Dropped protocol specifier '.udhcpc' from 'mlan0.udhcpc'. Using 'mlan0' (ifindex=6).
root@smarcimx932g:~#

You should be able to ping local network now.

root@smarcimx932g:~# ping 192.168.1.10
PING 192.168.1.10 (192.168.1.10) 56(84) bytes of data.
64 bytes from 192.168.1.10: icmp_seq=1 ttl=64 time=2141 ms
64 bytes from 192.168.1.10: icmp_seq=2 ttl=64 time=1120 ms
64 bytes from 192.168.1.10: icmp_seq=3 ttl=64 time=95.7 ms
64 bytes from 192.168.1.10: icmp_seq=4 ttl=64 time=1.63 ms

 Modify /etc/resolv.conf of your preference, you will be able to ping out.

root@smarcimx932g:~# vim /etc/resolv.conf

nameserver 8.8.8.8
nameserver 8.8.4.4

root@smarcimx932g# ping www.google.com

PING www.google.com (172.217.163.36) 56(84) bytes of data.
64 bytes from tsa01s13-in-f4.1e100.net (172.217.163.36): icmp_seq=1 ttl=59 time=4.09 ms
64 bytes from maa05s01-in-f4.1e100.net (172.217.163.36): icmp_seq=2 ttl=59 time=5.66 ms
64 bytes from maa05s01-in-f4.1e100.net (172.217.163.36): icmp_seq=3 ttl=59 time=5.73 ms
64 bytes from tsa01s13-in-f4.1e100.net (172.217.163.36): icmp_seq=4 ttl=59 time=6.10 ms
64 bytes from tsa01s13-in-f4.1e100.net (172.217.163.36): icmp_seq=5 ttl=59 time=3.79 ms
64 bytes from maa05s01-in-f4.1e100.net (172.217.163.36): icmp_seq=6 ttl=59 time=3.44 ms
64 bytes from maa05s01-in-f4.1e100.net (172.217.163.36): icmp_seq=7 ttl=59 time=3.68 ms
64 bytes from maa05s01-in-f4.1e100.net (172.217.163.36): icmp_seq=8 ttl=59 time=5.31 ms
64 bytes from tsa01s13-in-f4.1e100.net (172.217.163.36): icmp_seq=9 ttl=59 time=4.89 ms
^C
--- www.google.com ping statistics ---
9 packets transmitted, 9 received, 0% packet loss, time 8012ms
rtt min/avg/max/mdev = 3.442/4.743/6.102/0.952 ms
root@smarcimx932g:~#


Bluetooth


This section details bluetooth operations of iW612.

Bring Up

Load bluetooth driver. 

root@smarcimx932g:~# modprobe btnxpuart
[ 40.478049] audit: type=1334 audit(1730117660.156:19): prog-id=16 op=LOAD
[ 44.175028] Bluetooth: MGMT ver 1.22
[ 44.234565] NET: Registered PF_ALG protocol family

root@smarcimx932g:~#


Bring up the hci0 interface.

root@smarcimx932g:~# hciconfig hci0 up

 

To check the status of the hci0 interface execute the following command.

root@smarcimx932g:~# hciconfig
hci0: Type: Primary Bus: UART
BD Address: 50:26:EF:B1:79:AB ACL MTU: 1021:7 SCO MTU: 120:6
UP RUNNING
RX bytes:1589 acl:0 sco:0 events:100 errors:0
TX bytes:1319 acl:0 sco:0 commands:100 errors:0

root@smarcimx932g:~#

Running a Scan

Start the interactive bluetoothctl tool by executing the following command.

root@smarcimx932g:~# bluetoothctl
Agent registered
[CHG] Controller 50:26:EF:B1:79:AB Pairable: yes
[bluetooth]#

Start bluetooth scan by entering the following command.

[bluetooth]# scan on

Discovery started
[CHG] Controller 50:26:EF:B1:79:AB Discovering: yes

[NEW] Device 7C:70:DB:D7:C1:6A test
...

 

Stop bluetooth scan by entering the following command.

[bluetooth]# scan off


To list all discovered and previously connected devices enter the following command.

[bluetooth]# devices 

Device 7C:70:DB:D7:C1:6A test


Connecting to a device

Register an agent by entering the following command.

[bluetooth]# agent on

Discovery started
[CHG] Controller 50:26:EF:B1:79:AB Discovering: yes

 

Choose the default-agent by entering the following command.

[bluetooth]# default-agent

Default agent request successful

 

Start the pairing procedure. Type yes to confirm the passkey if the the agent prompts you to do so.

[bluetooth]# pair 7C:70:DB:D7:C1:6A

Attempting to pair with 7C:70:DB:D7:C1:6A
[CHG] Device 7C:70:DB:D7:C1:6A Connected: yes
Request confirmation
[agent] Confirm passkey 517374 (yes/no): [DEL] Device 65:6C:42:3C:29:EB 65-6C-42-3C-29-EB
[agent] Confirm passkey 517374 (yes/no): [DEL] Device 38:FD:FE:C2:53:BC Ultron-UTU400-3L26T7P-+4ga
[agent] Confirm passkey 517374 (yes/no): [DEL] Device 5F:72:33:81:1E:89 5F-72-33-81-1E-89
[agent] Confirm passkey 517374 (yes/no): yes
[test]#

 

Add the device to the trusted devices.  Trusting the device speeds up future connection attempts.

[test]# trust 7C:70:DB:D7:C1:6A

Changing 00:13:43:C0:FF:EE trust succeeded


Connect to the device with the following command. 

[bluetooth]# connect 7C:70:DB:D7:C1:6A

 

Disconnect from the device by entering the following command. 

[test]# disconnect 7C:70:DB:D7:C1:6A

 

Remove the device from the list of paired devices enter the following command.

[bluetooth]# remove 7C:70:DB:D7:C1:6A

 

To exit bluetoothctl enter the following command.

[bluetooth]# quit


version 1.0a, 10/28/2024

Last updated 2024-10-28

 

  • No labels