Please rely on the newly published project Build NXP iMX Embedded Linux instead of this one you are presently looking at. Although this project is still technically correct, the codeaurora repository no longer exists.
InformationThe NXP Desktop is a Linux distribution created by NXP that looks very similar to an Ubuntu Desktop distribution. The NXP Desktop is built entirely using Yocto Project. The bootloaders and the kernel are identical to the standard non-desktop version of Linux from NXP, but all of the packages are from the Ubuntu userland and can be updated using the APT (Advanced Packaging Tool) which is one of the very best package managers available today.
Goals- This project will demonstrate how I built the "NXP Desktop" with Linux L5.15.5_1.0.0 NXP i.MX8M Plus evaluation kit 8MPLUSLPD4-EVK using Yocto Project version 3.4 "Honister"
- This project will also demonstrate how I built a Docker image from a Dockerfile so that I could run the entire build process within a Docker container.
- Build machine OS is a Linux distribution that relies on the Debian apt package manager. I am using Ubuntu 20.04 for my build machine.
- Docker is already installed on your build machine.
- NXP "i.MX Yocto Project User’s Guide" for version L5.15.5_1.0.0 released 31 March 2022
- NXP IMXDUG "i.MX Desktop User's Guide" for version L5.15.5_1.0.0 released May 2022
- CodeAurora meta-nxp-desktop readme
Create my project directory. Your directory structure will look different than mine.
$ mkdir -v /work/imx8mp/honister/L5.15.5_1.0.0-desktop && cd /work/imx8mp/honister/L5.15.5_1.0.0-desktop
Prepare the Dockerfile. Mine can be found in the attached zip archive, but it can also be downloaded with this command
$ wget https://gitlab.com/fweller/flint-configuration/-/raw/master/tools/dockerfiles/yocto-honister-ubuntu-20
Build the Docker imageGoal: Build the Ubuntu 20.04 LTS "Focal Fossil" Docker image that we will use to build a Linux distribution using Yocto Project
Note: Don't forget the dot "." at the end of the command.
Note: Don't forget to change the dockerfile location to where you installed it.
$ docker build --no-cache --file /home/flint/tools/dockerfiles/yocto-honister-ubuntu-20 --tag yocto-honister-ubuntu-20 .
Deploy our Docker image to a container while mounting the working directory
$ docker run -dit -P --hostname honister --name imx8mp-honister-L5.15.5_1.0.0-desktop -v /work/imx8mp/honister/L5.15.5_1.0.0-desktop:/home/build yocto-honister-ubuntu-20
Attach to the new container
$ docker attach imx8mp-honister-L5.15.5_1.0.0-desktop
Note: At this point we are typing on the command line within our Docker container.
Optional. Install my dotfiles. They can be found in the attached zip archive or using the following method
$ curl https://gitlab.com/fweller/flint-configuration/-/raw/master/tools/dockerfiles/dotfiles/dockerfile-install-dotfiles.sh | bash && source .bashrc
Configure the Docker container for the buildConfigure Repo
$ repo init -u https://source.codeaurora.org/external/imx/imx-manifest -b imx-linux-honister -m imx-5.15.5-1.0.0_desktop.xml
Download the basic applications with the Repo tool
$ repo sync
Configure our i.MX Linux build
$ EULA=1 DISTRO=imx-desktop-xwayland MACHINE=imx8mpevk source imx-setup-desktop.sh -b bld-imx8mpevk-desktop
Download all files first
$ bitbake imx-image-desktop --runall fetch
Once they have all been downloaded, kick off the build
$ bitbake imx-image-desktop
Assuming your build went as smoothly as mine, all the binary files have been built and are ready to be deployed to the 8M Nano EVK. Mine are located here
/work/imx8mp/honister/L5.15.5_1.0.0-desktop/bld-imx8mpevk-desktop/tmp/deploy/images/imx8mpevk
Exit this docker container
$ exit
Note: At this point we are no longer typing into our Docker container, and are instead typing in the standard command line shell for our Linux OS.
To return to the Docker container againThis section is provided should you need to return to this Docker container at a later date. If everything has worked smoothly for you so far, there is no need to run the commands in this section, just rember they are here should you need them.
$ docker restart imx8mp-honister-L5.15.5_1.0.0-desktop
$ docker attach imx8mp-honister-L5.15.5_1.0.0-desktop
$ source setup-environment bld-imx8mpevk-desktop
Prepare the micro SD cardChange directory to the deployed images for imx8mpevk
$ cd /work/imx8mp/honister/L5.15.5_1.0.0-desktop/bld-imx8mpevk-desktop/tmp/deploy/images/imx8mpevk
View only the wic files that have been bzipped
$ ls -al *.wic.bz2
Expected result
.rw-r--r-- 811M flint 9 Aug 22:08 imx-image-desktop-imx8mpevk-20220810041739.rootfs.wic.bz2
lrwxrwxrwx 57 flint 9 Aug 22:09 imx-image-desktop-imx8mpevk.wic.bz2 -> imx-image-desktop-imx8mpevk-20220810041739.rootfs.wic.bz2
Run the bunzip utility on the imx-image-desltop-imx8mpevk file
$ bunzip2 -dk -f imx-image-desktop-imx8mpevk.wic.bz2
Check to make sure that the file was bunzipped properly
$ ls -al *.wic
Expected result
.rw-r--r-- 8.5G flint 9 Aug 22:08 imx-image-desktop-imx8mpevk.wic
Insert a micro SD into USB adapter on the host computer.
Check the kernel ring buffer to see if the micro SD has been assigned to a device
$ dmesg
Expected result
[20247.868240] sd 5:0:0:0: [sdc] 62521344 512-byte logical blocks: (32.0 GB/29.8 GiB)
My micro SD has been assigned device /dev/sdc
Note: Your micro SD image may have been assigned a different device, make sure you know exactly what the device is or else you risk overwriting another filesystem.
Transfer the image to the micro SD card
$ sudo dd if=imx-image-desktop-imx8mpevk.wic of=/dev/sdc bs=1G conv=fsync status=progress && sync
Expected result
8481301504 bytes (8.5 GB, 7.9 GiB) copied, 165 s, 51.3 MB/s
7+1 records in
7+1 records out
8481301504 bytes (8.5 GB, 7.9 GiB) copied, 242.275 s, 35.0 MB/s
Check if the micro SD card partitions were automatically mounted
$ df | grep /dev/sdc
Expected result
/dev/sdc2 ext4 7.5G 2.4G 4.8G 34% /media/flint/root
/dev/sdc1 vfat 84M 31M 53M 38% /media/flint/boot
Because I can see them mentioned, Yes, they are mounted
Unmount the newly formed partitions
$ sudo umount /dev/sdc1
$ sudo umount /dev/sdc2
Remove micro SD from host and insert into the 8MPLUSLPD4-EVK i.MX 8MPlus evaluation kit
Prepare the ConsoleAttach the console cable between the EVK and your host Linux computer.
Check the kernel ring buffer to see which device has been assigned to the console
$ dmesg
Expected result
[21794.973218] usb 1-4: new high-speed USB device number 7 using xhci_hcd
[21795.125541] usb 1-4: New USB device found, idVendor=0403, idProduct=6011, bcdDevice= 8.00
[21795.125545] usb 1-4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[21795.125546] usb 1-4: Product: Quad RS232-HS
[21795.125547] usb 1-4: Manufacturer: FTDI
[21795.128112] ftdi_sio 1-4:1.0: FTDI USB Serial Device converter detected
[21795.128127] usb 1-4: Detected FT4232H
[21795.128227] usb 1-4: FTDI USB Serial Device converter now attached to ttyUSB0
[21795.128364] ftdi_sio 1-4:1.1: FTDI USB Serial Device converter detected
[21795.128380] usb 1-4: Detected FT4232H
[21795.128471] usb 1-4: FTDI USB Serial Device converter now attached to ttyUSB1
[21795.128626] ftdi_sio 1-4:1.2: FTDI USB Serial Device converter detected
[21795.128652] usb 1-4: Detected FT4232H
[21795.128784] usb 1-4: FTDI USB Serial Device converter now attached to ttyUSB2
[21795.128889] ftdi_sio 1-4:1.3: FTDI USB Serial Device converter detected
[21795.128908] usb 1-4: Detected FT4232H
[21795.129033] usb 1-4: FTDI USB Serial Device converter now attached to ttyUSB3
From the kernel ring buffer, I can see that /dev/ttyUSB 0 through 3 have been assigned to the console cable. Yes, there are 4 serial ports riding on that one USB console cable.
The third serial port on the USB console cable is the Linux Console. This is /dev/ttyUSB2 in my case.
Attach to the ConsoleEveryone has a favorite terminal program for Linux, or at least one that they don't hate as much as the rest. My favorite is tio "a simple serial device I/O tool"
Start up your terminal program. I recommend saving the output to a file for later reflection.
$ sudo tio /dev/ttyUSB2 -l console.log
Prepare the hardwareMake sure the 8MPLUSLPD4-EVK has power available, an HDMI cable attached to a monitor, and a USB keyboard and mouse attached, and an ethernet cable to your network.
Put the micro SD card in to the EVK and turn on the power switch
If all went according to plan, you should see Ubuntu present you with a login
Access the command line of the 8MPLUSLPD4-EVKNote: The username and password are identical and are: user
You can access the command line either through the console that we set up earlier, or through the USB keyboard & moust + HDMI display for the Linux workstation experience. I am using the console.
After all of the boot messages have finished scrolling on my screen, I log into the only user account with
- Username: user
- Password: user
Here are some images that I captured of the NXP Desktop experience. I think the desktop is usable as an ultra-small and ultra-low-power workstation.
I immediately want to test the apt utility to see if it can update with the Ubuntu repositories.
$ sudo apt update
Perhaps it will work for you, but at the time I built this image it appears that DNS is not working out of the box.
First I will check for the most basic connectivity
$ ping 1.1.1.1
The above ping command using an IP address was successful.
$ ping google.com
The above ping command DNS name resolution was unsuccessful.
At least now I know that DNS is definitley not working
Now I ask systemd to see the status of DNS name resolution
$ systemd-resolve --status
The result that I received
Failed to get global data: Unit dbus-org.freedesktop.resolve1.service not found.
Yes it is definitely not working
Now I start the DNS name resolution service manually
$ sudo systemctl enable --now systemd-resolved.service
I am asked to provide the sudo password, which is: user
The results I experienced are
[sudo] password for user:
Created symlink /etc/systemd/system/dbus-org.freedesktop.resolve1.service → /lib/systemd/system/systemd-resolved.service.
Created symlink /etc/systemd/system/multi-user.target.wants/systemd-resolved.service → /lib/systemd/system/systemd-resolved.service.
Now I check the status again
$ systemd-resolve --status
I can see that DNS name resoultion is working now.
I am now able to run the apt (advanced packaging tool) to update the packages on the micro SD card.
$ sudo apt update
$ sudo apt list --upgradable
$ sudo apt upgrade
ConclusionThat's it for this project. I hope you had as much fun as I did.
Comments