The default BSP is compiled based on the Yocto project, which is a streamlined production-level Linux BSP. However, for users who are accustomed to the Ubuntu environment, especially ROS users, the operation of Yocto will be relatively complicated. This article will introduce how to make an Ubuntu BSP for iMX8QM and demonstrate how to use ROS.
A complete Ubuntu BSP includes u-boot, Linux kernel and Ubuntu rootfs. We will use u-boot and Linux kernel in Yocto BSP official 6.1V BSP, and rootfs will still use ubuntu-base-18.04.4-base-arm64. The compilation method comes from the NXP forum.
First download ubuntu-base-18.04.4-base-arm64.tar.gz from the link above, and then unzip it.
$ mkdir ~/ubuntu-rootfs
$ sudo tar vxf ubuntu-base-18.04.4-base-arm64.tar.gz -C ubuntu-rootfs
Copy the script file and create ch-mount.sh.
$ sudo chmod a+x ./ch-mount.sh
The download above is a basic Ubuntu-base file system, which is missing many commonly used tools and requires us to install it. For this purpose, install the qemu-user-static software on your computer to simulate the arm64 operating environment.
$ sudo apt install qemu-user-static
Mount the Ubuntu-base file system and then operate directly in the arm64 environment.
$ sudo ./ch-mount.sh -m ubuntu-rootfs/
Add a DNS server, such as 8.8.8.8, or other available DNS server IP.
# echo nameserver 8.8.8.8 > /etc/resolv.conf
Install relevant software, of course you can also add other software.
# apt install language-pack-en-base sudo ssh net-tools \
network-manager iputils-ping rsyslog \
bash-completion htop resolvconf dialog \
vim nano v4l-utils alsa-utils git gcc \
less resolvconf autoconf autopoint libtool \
bison flex gtk-doc-tools glib-2.0 \
libglib2.0-dev libpango1.0-dev libatk1.0-dev kmod pciutils -y
Create a user and set a password, here the user name is ubuntu
# useradd -s '/bin/bash' -m -G adm,sudo ubuntu
# passwd ubuntu
# passwd root
# echo 'apalis-imx8' > /etc/hostname
At this point basic Ubuntu has been configured.
# exit
$ sudo ./ch-mount.sh -u ubuntu-rootfs/
After the installation is complete, use the ubuntu user to log in to the debugging serial port, and the password is ubuntu. When starting for the first time after installation, it will wait for a long time due to initialization, and then enter the configuration interface including region, user settings, etc. Turn on Ethernet and set DNS server IP.
ubuntu@mx8QM:~$ sudo ifconfig eth0 up
ubuntu@mx8QM:~$ sudo dhclient eth0
ubuntu@mx8QM:~$ sudo vi /etc/resolv.conf
Start Weston:
ubuntu@mx8QM:~$ export XDG_RUNTIME_DIR=/run/user/1000
ubuntu@mx8QM:~$ sudo -E weston --tty=1 &
ubuntu@mx8QM:~$ weston-flower
ROS test You can install ROS programs very conveniently in Ubuntu system. Please refer to the instructions below for details
http://wiki.ros.org/melodic/Installation/Ubuntu
http://wiki.ros.org/ROS/Tutorials
ubuntu@mx8QM:~$ sudo apt install lsb-core
ubuntu@mx8QM:~$ sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
ubuntu@mx8QM:~$ sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
ubuntu@mx8QM:~$ sudo apt update
ubuntu@mx8QM:~$ sudo apt install ros-melodic-desktop
Run the following commands on three SSH terminals to simulate communication between ROS nodes.
ubuntu@mx8QM:~$ source /opt/ros/melodic/setup.sh
ubuntu@mx8QM:~$ roscore
ubuntu@mx8QM:~$ source /opt/ros/melodic/setup.sh
ubuntu@mx8QM:~$ rosrun roscpp_tutorials talker
ubuntu@mx8QM:~$ source /opt/ros/melodic/setup.sh
ubuntu@mx8QM:~$ rosrun roscpp_tutorials listener
Due to driver limitations, iMX8 does not support Xorg, so ROS's default graphical interface tools such as rqt cannot be used directly.