MiR officially provides two ready-made images for MiR-TI AM62x development board:
You can directly use the above image to burn and use.
Because I will develop applications on this development board later, I chose to refer to official materials, compile the complete system, and build the SDK tools, so that I can complete the steps smoothly. In the subsequent development process, I will generally not encounter any major problems when compiling the application.
1. Hardware environment preparation
First of all, you need a development board and an SD card. You already have a development board, and it is recommended that you choose a high-speed SD card, at least 32G.
Then there is the system hardware used for the compilation environment. It must have a high CPU frequency, multiple cores, and a large amount of memory, because compiling the system is really time-consuming.
Officially recommended hardware: The Yocto Project has relatively high requirements for the development host, requiring a processor with a dual-core CPU or above, 8GB or more of memory, and a 500GB hard disk or higher configuration. It can be a host with a Linux system installed or a virtual machine running a Linux system.
Dual core? 8G? Are you kidding me? How can this run?
The hardware I used is as follows:
This CPU has 10 cores and 20 threads. As for the memory, there is certainly no shortage of memory for this CPU.
In addition, it is recommended to prepare 150G spare disk space for compilation. Note that it is the remaining disk space.
2. System Environment Preparation
The officially recommended system environment is Ubuntu 20.04 64bit. The actual environment I use is Ubuntu 23.04 64bit, and I have successfully completed the required compilation work.
In order to better use apt to download and install software packages, you can refer to: http://tuna.tsinghua.edu.cn/help/ubuntu/ to set up the apt source to make the download speed as fast as possible.
After completion, use the following command to install the software package:
apt update
apt upgrade
apt install -y git build-essential \
diffstat texinfo gawk chrpath socat doxygen dos2unix python3 bison \
flex libssl-dev u-boot-tools mono-devel mono-complete curl lrzsz lzop \
python3-distutils pseudo python3-sphinx g++-multilib bc python3-pip \
libc6-dev-i386 jq git-lfs pigz zstd liblz4-tool cpio file autoconf automake \
xinetd tftpd-hpa nfs-kernel-server minicom libncurses5-dev dos2unix screen \
zstd lz4 python3-pyelftools python3-setuptools swig repo
git config --global user.name "你在github的用户名"
git config --global user.email "你在github的邮箱"
git config --list
After completing the above work, the system environment is ready.
3. System Compilation SDK Preparation
First, download 03_Tools.zip from http://down.myir-tech.com/MYD-YM62X/ , unzip it and keep it for later use.
My steps are as follows:
mkdir -p ~/Projects/myir
cd ~/Projects/myir
wget -c http://down.myir-tech.com/MYD-YM62X/03_Tools.zip
unzip 03_Tools.zip
Then, install the system compilation SDK:
cd ~/Projects/myir/03_Tools/Toolchain
chmod u+x arago-2023.04-toolchain-2023.04.sh
./arago-2023.04-toolchain-2023.04.sh
After running, you will be prompted where to install. I choose to install to: /opt/
After the installation is complete, apply the corresponding environment settings and check whether the environment is effective:
. /opt/arago-2023.04/environment-setup-aarch64-oe-linux
$CC -v
The output is as follows, indicating that the system compilation SDK environment is set up successfully:
Use the tree command to view the installed directory and the results are as follows:
4. System source code preparation
First, download 04_Sources.zip from http://down.myir-tech.com/MYD-YM62X/ , unzip it and keep it for later use.
My steps are as follows:
cd ~/Projects/myir
wget -c http://down.myir-tech.com/MYD-YM62X/04_Sources.zip
unzip 04_Sources.zip
Then unzip the corresponding Yocto source package:
mkdir ~/Projects/myir/myd-ym62x-yocto
cd ~/Projects/myir/myd-ym62x-yocto
unzip ../04_Sources/myd-ym62x-yocto.zip
# 查看目录结构
tree -L 2 ../myd-ym62x-yocto
The decompressed file structure is as follows:
Among them, build and downloads are generated during the compilation process.
In addition, the official also provides a way to download the source code from GitHub. If you are interested, you can try it. To be safe, I directly decompressed the compressed package provided by the official.
5. System Image Construction
Through the previous steps, the environment and source code are now ready, and you can start formally compiling the system.
1. Environment configuration:
First, configure the environment:
cd ~/Projects/myir/myd-ym62x-yocto/oe-layersetup
./oe-layertool-setup.sh -f configs/processor-sdk/processor-sdk-09.00.00-myd-am62x-config.txt
After the configuration is complete, a build directory will be generated and then the configuration will be applied:
. conf/setenv
2. Download the tool source package:
Before formal compilation, some modifications need to be made:
cd build
vim conf/local.conf
Modify DL_DIR, specifically: ~/Projects/myir/myd-ym62x-yocto/oe-layersetup/downloads
Then execute the command to download the required software package:
bitbake myir-image-full --runall=fetch
After execution, the software package will be downloaded quickly.
It should be noted that this step takes a long time. You can also refer to the official instructions and download from Baidu Netdisk. However, Baidu Netdisk is rubbish. It is slower than a turtle without membership. It is better to download with the command.
After running this command, run it again three times to ensure the final output is:
That means everything has been downloaded and you can continue.
However, the actual situation is not so smooth. When I execute this command, it always prompts quectel-cm download error.
After some research and some simple processing, the problem was solved.
Modify this command configuration file:
vim ~/Projects/myir/myd-ym62x-yocto/oe-layersetup/sources/meta-myir/meta-myir-bsp/recipes-connectivity/quectel-cm/quectel-cm.bb
Specific modifications:
#S_SRC ?= "git://github.com/MYIR-TI/quectel-cm.git;protocol=https"
S_SRC ?= "https://github.com/MYIR-TI/quectel-cm.git;branch=master"
SRC_URI[sha256sum] = "54ac7475b83c08fa4eafdfb3377381fd42e87dbcf32290fc1b11260af0f728a8"
Then execute again:
bitbake myir-image-full --runall=fetch
After successful execution, execute it twice again to make sure there are no problems.
Finally, download it manually:
cd ~/Projects/myir/myd-ym62x-yocto/oe-layersetup/build/arago-tmp-default-glibc/work/aarch64-oe-linux/quectel-cm/1.0-r0
git clone https://github.com/kmilo17pet/quectel-cm.git git
3. Build a complete system image package
Now, you can use the command to build the system:
bitbake myir-image-full
After execution, various construction tasks will begin, and the output is as follows:
Special reminder, this process is the longest and the CPU burns the most . Take a look at my i9-10900:
It may take you 10 hours, or even longer, to complete all the compilation work.
In addition, you have to check from time to time to see if you encounter any problems. Because, I really encountered a problem during the compilation process:
I don't know the specific reason for this. It doesn't seem to be because my system version is too high. There is a problem with the patch applied to json.c and json.h.
Since there is a problem with patching, let's manually apply it. The specific steps are as follows:
vim ./arago-tmp-default-glibc/work/aarch64-oe-linux/systemd/1_250.5-r0.arago7/git/patches/0001-shared-json-allow-json_variant_dump-to-return-an-err.patch
Then refer to the picture below and remove the red frame and delete it directly:
Then modify the json.c file:
vim arago-tmp-default-glibc/work/aarch64-oe-linux/systemd/1_250.5-r0.arago7/git/src/shared/json.c
Find the corresponding position in the code and modify it to the following:
Then, continue executing:
bitbake myir-image-full
After a long wait, the execution is completed, and then it is executed again and again. The results are as follows:
And check the results of the build:
Now, the system image is built, and myir-image-full-myd-am62x-20231218090554.rootfs.wic.xz can be used to burn to the SD card.
4. Burn the image to start the system
I choose to use balenaEtcher for burning. Select the sz file as the source and the SD card to be burned as the target. Then you can start Flash:
After the burning is completed, turn off the power of the development board and turn the dip switch to the SD card position:
Then insert the SD card, power on, and after the system starts, enter the default graphical interface. Click the small icon in the upper right corner to open the window and run the command:
It looks like the load is really high.
After the guidance of the official technical staff, I found out that the performance of 6231 is not enough to run weston because it is a single core. We should have a default judgment that if it is 6231, the lvgl demo will be automatically turned on. You only need to enter the command systemctl disable weston to turn off weston.
6. Build SDK tool chain for development
The SDK installed earlier is used for system compilation. To develop applications for this system, an application development SDK tool chain is required.
On the premise that the complete image is built successfully, the construction of the application development SDK tool chain is relatively simple, and one command is enough:
bitbake -c populate_sdk myir-image-full
After the build is successful, execute it twice more and the final output is as follows:
I didn't count how long it takes to build this part, but it's shorter than the system build time above.
The results of the build are as follows:
The generated application development SDK tool chain can be installed to provide support for application development, and corresponding sharing will be made in the subsequent application development process.
VII. Conclusion
In general, the Yocto build system environment and source code provided by Mir are relatively smooth to use. Apart from modifying two minor issues and requiring more system resources and a longer time, there are no other obstacles.
In addition, there is still the compilation of bootloader and kernel, etc. I believe that on this basis, there should be no problems.
During the research and study process, we raised any problems we encountered in a timely manner, and Mir's technical staff provided great assistance and helped us solve them.
I believe this will be a very enjoyable learning experience.