
Abstract: Learning Linux is not difficult; the challenge lies in not finding the right tutorials or having someone to guide you quickly. After buying a development board, it just sits there gathering dust. Watching videos is unengaging, and the documentation is hard to understand, making it really tough!
So today, I will explain the basic steps to run a Qt program on the ZhiDianYuanZi Linux development board in a simple and understandable way, aiming to help beginners run their first program in half a day (this article is primarily for beginners; veterans can skip it).
Hardware: ZhiDianYuanZi Linux Mini Development Board
Software: Windows 10, VMware, Ubuntu, Qt Creator
The running effect is shown in the figure below, which is a <span>serialport</span>
example running on the default UI interface of ZhiDianYuanZi.

First, let me share my feelings about starting Linux embedded development. When learning STM32, I got familiar with the Keil or IAR integrated development environments and could use simple registers to control a specific pin.
After diving into Linux development, I was first intimidated by the installation images that were dozens of gigabytes large, feeling that Linux compilation was particularly complex and difficult. Also, the commands with hundreds of characters were overwhelming for someone used to graphical development. Moreover, the seller’s videos could easily run into dozens of hours, covering topics like driver development, application development, and Qt development.

Each video is long and tough. I originally bought the board to have some fun, but after realizing I had to watch so many videos, my motivation dropped, and I went from starting to giving up, leaving the board to gather dust.
The goal of this article is to help everyone set aside the videos and condense the information from those hours of content into this article, allowing you to quickly experience the joy of embedded Linux development! Of course, I also suggest that the official team provides a quick start tutorial to enable developers to enjoy the experience more effectively.
1. Download Materials
First, go to the ZhiDianYuanZi forum to download materials. Be careful not to download the videos; you can watch them anytime on Bilibili, and no one would be so bored as to download those videos!

2. Install Virtual Machine
The installation of the virtual machine is covered in most of ZhiDianYuanZi’s PDF tutorials, so there is no need to elaborate further. If you find the article unclear, you can also watch videos on Bilibili.

It is advisable for beginners to carefully watch it once. If you make a mistake during installation, it’s no big deal; just delete it and reinstall.
In the installation of Ubuntu, it is highly recommended to directly download the pre-packaged Qt Creator image from ZhiDianYuanZi. Once this image is installed, you won’t have to configure everything step by step. For those who need to quickly run their first Linux program, this can help avoid getting confused by too many details. Skipping these tedious steps will allow us to quickly grasp the overall development process.
What does this mean? It means that your newly installed Ubuntu doesn’t have any environment or software, and you need to install everything yourself, which is quite troublesome. However, you can use the Ubuntu system that ZhiDianYuanZi has packaged, and you only need to install their packaged system on your virtual machine. Isn’t that amazing? You can install someone else’s computer system on your computer!

This is what it looks like after downloading:

Then, follow the instructions here to install the system that ZhiDianYuanZi has packaged for you.

File name: [ZhiDianYuanZi] I.MX6U Virtual Machine User Manual V1.3.pdf
3. Configure Network Environment
After installing Ubuntu, you may not be able to connect to the internet. This issue varies for everyone. It is recommended to follow ZhiDianYuanZi’s tutorial to ensure that your Windows, Ubuntu, and development board all have a stable network connection. You can refer to: [ZhiDianYuanZi] I.MX6U Network Environment TFTP & NFS Setup Manual V1.3.1.pdf

If you find the document unclear, there are also videos available, and you can follow along step by step while watching the videos.

So, you don’t need to worry about the network setup.
4. Install Qt Creator
Similarly, you can refer to: [ZhiDianYuanZi] I.MX6U Embedded Qt Development Guide V1.1.pdf for installing Qt Creator software.

After installing Qt Creator on Ubuntu, you can write programs just like in Windows, and then run them in Ubuntu.
However, our goal is to run the Qt software on our ARM development board, right? At this point, we naturally think of installing a compiler tool in Ubuntu to compile the program into code that can run on the ARM development board! This is called the “cross-compilation toolchain”.
In the context of cross-compilers, “cross” means compiling code for another architecture on a different architecture, effectively merging two architectures. Our computer is x86 architecture, while the development board is ARM architecture.
5. Install Qt Cross-Compiler
You can refer to: [ZhiDianYuanZi] I.MX6U Factory System Qt Cross-Compilation Environment Setup V1.6.pdf for the first chapter to install the cross-compiler. You must install this in order to compile code that can run on the ARM development board in Ubuntu.
Note: This step is essential, and you must follow the tutorial step by step!

5.1 Copy Compiler
Copy the development board’s CD A-Basic Materials->5, Development Tools->1, Cross Compiler->fsl-imx-x11-glibc-x86_64-meta-toolchain-qt5-cortexa7hf-neon-toolchain-4.1.15-2.1.0.sh
Copy it to the Ubuntu virtual machine.
You can use <span>MobaXterm</span>
software for copying. You can refer to this article for using this software: 2022 First Article, All-in-One Terminal Tool MobaXterm

As shown in the figure, this article has already copied the cross-compilation tool to the Ubuntu virtual machine.

Execute the following command to modify the script’s permissions. After modifying the permissions, you will see the script color change, indicating a successful modification.
chmod u+x fsl-imx-x11-glibc-x86_64-meta-toolchain-qt5-cortexa7hf-neon-toolchain-4.1.15-2.1.0.sh
Directly execute the script to install the cross-compilation tool. Press Enter twice to confirm, and then enter your user password.
The installation directory is the default directory specified by the script, and subsequent kernel compilation environments will operate based on this installation directory.

5.2 Configure Environment Variables
As we know, in Linux, to run an executable file, you need to right-click to open a terminal in the corresponding directory and then run it with the <span>./</span>
command. But how do we run a specific program in other folders?
Of course, you can do this using environment variables. Yes, environment variables are also needed in Linux! They serve the same purpose as in Windows: they allow you to omit a very long directory path. Before having environment variables, the command we needed to input was:
/aaa/bbb/ccc/ddd/eee/fff/hhh/xxx.sh
With environment variables, the command we input becomes this, which is the difference. Environment variables inform the system that no matter where you call the xxx.sh command from, it is referencing a specific program in a certain folder.
xxx.sh
The method to set environment variables is<span>source /opt......</span>
We right-click to open a terminal in the project directory and then run the environment variable.
source /opt/fsl-imx-x11/4.1.15-2.1.0/environment-setup-cortexa7hf-neon-poky-linux-gnueabi

Next, use the <span>env</span>
command to check the environment variables. Once you see these configuration options, it indicates that we have set the newly installed “cross-compilation toolchain” in the environment variables.

Using <span>arm-poky-linux-gnueabi-gcc -v</span>
command, you can check the gcc version, indicating that the environment variable has taken effect.

OK, your Qt cross-compiler is now installed.
5.3 Install Cross-Compilation Environment
Previously, you only installed the cross-compiler in Ubuntu. To compile Qt applications to run on the development board, you also need to set up a cross-compilation environment. The program compiled with the ARM platform cross-compiler can run on the I.MX6U development board.
The main task is to configure Kits in Qt Creator, where Kit refers to the development compilation environment suite. You can set up different suites for different platforms and compile applications for various platforms, validating Qt’s cross-platform capabilities! If you have installed the Android suite, you can also run Qt programs on your phone.
Reference document: [ZhiDianYuanZi] I.MX6U Factory System Qt Cross-Compilation Environment Setup V1.6.pdf section 2.3.
Here, we need to write a command in the script to enable environment variables. First, open this script.
sudo vi /opt/Qt5.12.9/Tools/QtCreator/bin/qtcreator.sh
As shown in the figure, insert the following command at the first line of <span>qtcreator.sh</span>
.
source /opt/fsl-imx-x11/4.1.15-2.1.0/environment-setup-cortexa7hf-neon-poky-linux-gnueabi

Save the script file (ESC : wq). Use the following command to open Qt Creator. The “&” symbol allows it to run in the background.
/opt/Qt5.12.9/Tools/QtCreator/bin/qtcreator.sh &

5.4 Install Kits
After installing Qt Creator, there is only one default kit. Follow the tutorial to set up the other two kits.
Among them, ATK-I.MX6U is used for running on the imx6ull ARM platform; IMX6U-rsync is used for network debugging to download programs to the development board. When you compile in Qt Creator and click run, your program will display directly on the development board.

In Qt Creator, by default, it uses sftp or rsync to send programs to the board. Since ZhiDianYuanZi’s I.MX6U factory Qt file system (version 1.9 and later) includes the rsync command, it is very convenient to use this method for Qt remote debugging.
First, we need to confirm the version of the current factory file system by executing the following command in the factory system.
cat /etc/version

If the file system is not version V1.9 or does not support the rsync command, please download the latest factory system from the cloud and use the latest system for this.
Set Static IP for Development Board
Since the LAN8720PHY network chip does not have a MAC address, the system generates a random MAC address for network use upon startup. This leads to a different IP address being assigned each time the board boots up.
(In version 2.3, the file system has fixed a random MAC address, which will not change on each boot. Please update to the latest file system.)
Thus, we need to set a static IP to prevent changes due to MAC address changes. The simplest method is to directly assign an IP address to it, which we can do by adding the following content to the <span>/etc/rc.local</span>
file in the factory file system.
vi /etc/rc.local
Add the following content, making sure to set the appropriate IP address based on your router’s subnet. The following image shows how to set a static IP address for eth0. Please ensure this IP does not conflict with other devices!
PATH=/sbin:/bin:/usr/sbin:/usr/bin
ifconfig eth0 192.168.1.115 netmask 255.255.255.0
route add default gw 192.168.1.1
echo "nameserver 114.114.114.114" > /etc/resolv.conf

After this, every time the development board connects to the network and powers on, its IP address will be <span>192.168.1.115</span>
.
Next, refer to [ZhiDianYuanZi] I.MX6U Factory System Qt Cross-Compilation Environment Setup V1.6.pdf section 2.5.1 to complete the rsync method for installing the Qt remote debugging kits.

6. Practical Implementation
We open the example provided by ZhiDianYuanZi, taking Qt/03/03_serialport as an example. Double-click on <span>03_serialport.pro</span>
.

After opening, select the IMX6U-rsync kit:

Once opened, the software will automatically compile, generally without errors. Just click the green triangle at the bottom left to compile and run.

Then, you will see a magical scene on the development board: your host program is running on the development board, and you can connect to the serial port on the development board to have fun.
Note: Since the development board has ZhiDianYuanZi’s boot Qt desktop, you can prevent it from displaying by following the instructions below:

The final effect is as follows: