OKMX6UL Development Board Debian Filesystem Creation Process (Including Tool Installation, Configuration, and Burning)
This article describes how to create a Debian filesystem for the OKMX6UL series development boards, primarily applicable to the Forlinx OKMX6UL series with the Linux 4.1.15 operating system. Other platforms can refer to this guide, but there will be differences between platforms, which need to be modified to suit the actual use.
Note: Operate under the root user by default.
1. Qemu and Debootstrap Installation
Since a Debian file system is built on Ubuntu apt- these two tools can be installed directly using the apt-get command. The commands are as follows:
sudo apt-get install binfmt-support qemu qemu-user-static debootstrap
2. Extracting Debian File System
Use the debootstrap command to extract the file system. Execute the following command to retrieve the file system from the Debian download source:
mkdir /home/forlinx/debian sudo debootstrap --arch=armhf --foreign buster root https://mirrors.tuna.tsinghua.edu.cn/debian/
Explanation of command parameters:
arch specifies the CPU architecture
buster is the Debian version number. Currently, the latest version is 10
foreign: This parameter needs to be specified when the architecture is different from the host’s, used only for the initial unpacking
root: The folder where the filesystem will be stored
https://mirrors.tuna.tsinghua.edu.cn/debian/ is the download source.
The extraction process takes a relatively long time, approximately 10 minutes. Please be patient. Once successful, the Linux directory structure can be seen. If the extraction fails, please try a few more times or change the network:
3. Improving the File System
To improve the filesystem, the qemu is required. Since it is operating on an X86 virtual machine, the ARM filesystem can not be improved directly. Therefore, qemu is used to simulate an ARM environment.
a.To copy qemu-arm-static into the newly built base system, use the following command:
cd root sudo cp /usr/bin/qemu-arm-static usr/bin cd ..
b.Initialize the file system.
Execute the following command:
sudo DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true LC_ALL=C LANGUAGE=C LANG=C chroot root debootstrap/debootstrap --second-stage
c.Use the chroot root command to initialize file system
chroot root
d.Use the command to create the following
echo "proc /proc proc defaults 0 0" >> etc/fstab mkdir -p usr/share/man/man1/ mknod dev/console c 5 1
e.Download Source Update
Use the command vi /etc/apt/sources.list to open the source.list file and replace the contents with the following.
deb http://mirrors.ustc.edu.cn/debian stable main contrib non-free #deb-src http://mirrors.ustc.edu.cn/debian stable main contrib non-free deb http://mirrors.ustc.edu.cn/debian stable-updates main contrib non-free #deb-src http://mirrors.ustc.edu.cn/debian stable-updates main contrib non-free #deb http://mirrors.ustc.edu.cn/debian stable-proposed-updates main contrib non-free #deb-src http://mirrors.ustc.edu.cn/debian stable-proposed-updates main contrib non-free
Then save and exit, and use the command apt-get update to update the download source. When the update download source reports an error, the date command can be provided to modify the system time to solve the problem.
apt-get update
f.Use the command apt-get install vim to install some necessary software
apt-get install vim apt-get install sudo apt-get install dpkg apt-get install bzip2 apt-get install net-tools apt-get install ntpdate apt-get install gcc
g.Create a new user with the command adduser forlinx, then enter the password
adduser forlinx
h.Set the root password, use the command passwd root, and set the password to forlinx.
passwd root
i.To set up Ethernet, enter the following command:
vi /etc/network/interfaces
As follows:
#/etc/network/interfaces -- configuration file for ifup(8), ifdown(8) #The loopback interface auto lo iface lo inet loopback #Wireless interfaces iface wlan0 inet dhcp wireless_mode managed wireless_essid any wpa-driver wext wpa-conf /etc/wpa_supplicant.conf iface atml0 inet dhcp #Wired or wireless interfaces auto eth0 #iface eth0 inet dhcp #iface eth1 inet dhcp iface eth0 inet static address 192.168.0.232 netmask 255.255.255.0 gateway 192.168.0.1 broadcast 192.168.0.255 auto eth1 iface eth1 inet static address 192.168.1.232 netmask 255.255.255.0 gateway 192.168.1.1 broadcast 192.168.1.255 #Ethernet/RNDIS gadget (g_ether) #... or on host side, usbnet and random hwaddr iface usb0 inet static address 192.168.7.2 netmask 255.255.255.0 network 192.168.7.0 gateway 192.168.7.1 #Bluetooth networking iface bnep0 inet dhcp
j.Modify host name
vi /etc/hostname Modify to: Debian
k.Modify the system time zone
cp /usr/share/zoneinfo/Hongkong /etc/localtime ntpdate ntp.aliyun.com Take East Zone 8 as an example, other time zone files are also included under this path.
l.Configure the SSH service
Install and enable SSH
root@Debian:~# apt-get install ssh root@Debian:~# service ssh start
Allow SSH login for root user
root@Debian:~# vim /etc/ssh/sshd_config
Find this line. If there is no comment, it needs to be commented out with:
#PermitRootLogin prohibit-password
Create a new line
PermitRootLogin yes
Re-enable SSH
root@Debian:~# service ssh restart
m.Configure the FTP service
Install vsftpd
root@Debian:~# apt-get install vsftpd
After the installation is complete, run the following command in a terminal to check the version of the vsftpd package:
root@Debian:~# systemctl status vsftpd
Configure the FTP service
root@Debian:~# cp /etc/vsftpd.conf /etc/vsftpd.conf.bak root@Debian:~# vi /etc/vsftpd.conf
Use these values to add/modify the following options:
write_enable=YES chroot_local_user=YES allow_writeable_chroot=YES local_root=/
Allow login for root user
root@Debian:~# vi /etc/ftpusers
Users in ftpusers can not log in via FTP, so please comment out root with #.
#root
Re-enable FTP
root@Debian:~# systemctl restart vsftpd
Safety Instructions
- The configuration of vsftpd is extensive, but this article only covers a small portion. The FTP configuration file is located at: /etc/vsftpd.conf.
- When connecting to the device using the Filezilla tool, please select the FTP protocol and choose the encryption method as "Only use plain FTP".
- When connecting using the WinSCP tool, please select the FTP protocol and choose the encryption method as "Not encrypted".
n.Adapt WiFi module
(1) Install the necessary commands
root@Debian:~# apt-get install usbutils //lsusb root@Debian:~# apt-get install wpasupplicant //wpa_supplicant root@Debian:~# apt-get install udhcpc
(2) lsusb to see if a WiFi device has been found
root@Debian:~# lsusb Bus 001 Device 003: ID 0bda:d723 Realtek Semiconductor Corp. 802.11n WLAN Adapter Bus 001 Device 002: ID 0424:2514 Microchip Technology, Inc. (formerly SMSC) USB 2.0 Hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
0bda:d723 is the ID of 8723du
(3) Check if the driver is loaded
root@Debian:~# lsmod Module Size Used by 8723du 1302499 0 mx6s_capture 14876 0 ov9650_camera 12446 0 evbug 1882 0 configfs 23785 1
(4) Set to use bash script by default
Place the fltest_wifi.sh script in the /usr/bin path. Since the Debian filesystem uses dash instead of the traditional bash, running the shell script directly will result in a syntax error report, so please eliminate the dash.
root@Debian:~# dpkg-reconfigure dash
Select NO in the pop-up window, after which it can run the shell script normally.
Note: If Don’t make the above changes, the bash + shell script also can be used, for example:
root@Debian:~# bash fltest_wifi.sh
(5) Modify udev rules
cp /lib/udev/rules.d/80-net-setup-link.rules /etc/udev/rules.d/ vim /etc/udev/rules.d/80-net-setup-link.rules Amend line 11 to read: NAME=="", ENV{ID_NET_NAME}!="", NAME="$env{ID_NET_SLOT}" Note: If don’t make the above changes, wlan0 will be renamed, resulting in networking failure.
(6) Connect WiFi
Note: 1. The WiFi connection script needs to be copied from the file system provided by Forlinx;
2. To avoid routing table conflicts, down eth0 and eth1 before connecting to WiFi.
ifconfig eth0 down ifconfig eth1 down fltest_cmd_wifi.sh -i 8723du -s forlinx-wlan -p fl03123102650
o.Install pyqt
(1) python Installation
sudo apt-get -y install python3-pip python3
(2) PyQt5 Installation
sudo apt-get -y install python3-pyqt5
(3) Because the performance of 6ull is relatively weak, there is no desktop installed, just use exit to exit the qemu environment.
exit
(4) Package the file system
Go to the Debian filesystem directory Directly use the command tar -cjf rootfs.tar.bz2 ./*.
tar -cjvf rootfs.tar.bz2 ./*
(5) Burn-in verification
Place the packaged file system into the burner, while keeping the other images as they are and only replacing the file system. Then proceed with the burn-in test.
Dear friends, we have created an exclusive embedded technical exchange group on Facebook, where our experts share the latest technological trends and practical skills. Join us and grow together!