Embedded Linux Development——Note (1)——Building an embedded development environment

This series of blogs is documented in Embedded Linux Development ProcessThe pits stepped on and the information consulted, the content refers to the tutorial of openedv.com .

First of all, you need to figure out how many computers you have on hand:

1. Your development computer - mine is a laptop with Windows 11
2. Server computer - Ubuntu Linux 18.04 LTS is used here to simulate the server computer for work
3. Development board - development with ARM Cortex A7 tablet computer

1. Configure FTP server on Linux (development computer - server communication)

Between Linux and the developer's machine (mine is Windows 11)file delivery is often required, although there are generally options on the virtual machine software that can beCopy files directly between local machine and virtual machine, but such an operation is not standardized, the standard operation should be to set up an FTP server on the Linux server, and install FTP client software such asFileZillaetc. for FTP transfer.

First you need to install on LinuxFTP server, execute the following command on Ubuntu to installvsftpd

sudo apt-get install vsftpd

vsftpd isAbbreviation for Very Secure FTP Daemon, which is an FTP server running on UNIX systems, after installing vsftpd on Linux, you can use FTP Clients such as FileZilla to connect to it. After completing the installation of vsftpd, you need to make some changes to its configuration file. First useOpen the configuration file of vsftpd under root authority

sudo vim /etc/vsftpd.conf

Then uncomment the following two lines, the first lineOpen local user login, the second line isEnables input of any FTP command line, then save and exit:
insert image description here
In order to make the above changes take effect, you can restart the FTP server service:

# 重启FTP服务器以使配置文件改动生效
sudo /etc/init.d/vsftpd restart
# 检查一下当前是否已经启动成功,当前运行进程中出现vsftpd表示已经成功运行(如下所示)
> ps -e | grep vsftpd
> 773 ? 00:00:00 vsftpd

Then use tools such as ifconfigView the Linux server address, and use the FileZilla tool on this machine to log in as an FTP client. The use of FileZilla should be very simple, and there are many tutorials on this topic on the Internet, so I won’t repeat them here.
insert image description here
Here is a vignette that I showed when I started using ifconfigThe IP address is 10.0.2.15, if you use FileZilla to connect to this address on Linux, you can't succeed (and you can't ping it), this is because the network card of the virtual machineThe connection method is set incorrectly, the virtual machine I use is under VirtualBox. At this time, the network connection method of the virtual machine should be changed fromnetwork address translation(NAT) adjusted tobridge network card, will be assigned to the virtual machine after setting aLAN IP address, then the FTP client can connect to the virtual machine:
insert image description here
After completing these settings, you must also set theThe option for promiscuous mode is set to allow all, and willCheck the network cable, otherwise the virtual machine may fail to connect to the Internet:
insert image description here

2. Configure NFS server on Linux (development board - server communication)

NFS is the abbreviation of Network File System (Network File System), which is adistributed file system, support clients can accessAccess server files like local storage, this process depends onremote procedure call(Remote Procedure Call, RPC) service to complete the serverMapping and identification of client ports, so when installing NFS, you need to install the RPC service first, and installing the NFS service is for the convenience of completing laterMutual transfer of files between Linux server and ARM development board

The command line to install the NFS service is as follows, whichBoth NFS server and RPC service are installed

sudo apt-get install nfs-kernel-server rpcbind

After the installation is complete, some configuration needs to be completed:
On the Linux serverCreate an NFS proxy folder, and complete the proxy folder in the NFS configuration fileMounting and Access Permission Settings, after the development board uses the NFS service to connect to the server, it willAccess proxy folders like local storage

# 在根目录下创建一个文件夹,这就是nfs在本地的代理文件夹
sudo mkdir -p nfs

After creating the proxy folder, we needset configuration fileTo limit the permissions of the outside world to access the proxy folder:

# 打开nfs配置文件
sudo vim /etc/exports
# 输入以下配置命令来约束代理文件夹的访问控制权限,各个权限字之间绝对不可以有空格
<your nfs file path> *(rw,sync,no_root_squash,no_subtree_check)

configuration fileA screenshot of the settings is shown below, as written at the beginning of the file, this file is used as a list of access control (access control list), you can exportSee the detailed meaning of the configuration file options in the relevant manual

# 查看每一个关键字的详细含义
man 5 exports

Here is a blog explaining the detailed meaning of configuration commands. It is well written and can be used as a reference and understanding.

# *表示任何IP地址和域名均可访问此代理文件夹
# 括号内标志均为权限,它们中间绝对不可以有空格存在
*(rw,sync,no_root_squash,no_subtree_check)

:

existComplete all configurations aboveAfter that, you canRestart the NFS serviceMake all changes take effect, and it can be started normally, which means that the service settings are normal:

# 重新启动NFS服务
sudo /etc/init.d/nfs-kernel-server restart

3. Configure SSH server on Linux (development computer - server communication)

This step is on a Linux server (a virtual machine is used here instead),Install SSH server and start SSH service, so that the computer can be developed in the futureRemotely connect to a Linux serverComplete the control of the server on the computer, the SSH client program needs to be installed on the development computer, here IRecommend MobaXTerm, Another option is XShell or Putty, but I think they are not as easy to use as MobaXTerm.

First install the OpenSSH server on the virtual machine, generally useThe default configuration is fine

sudo apt install openssh-server

4. Install the x86-ARM cross compiler on the Linux server

The cross compiler installed here is Linaro gcc, which is aopen source cross compiler, which runs onLinux on x86 architecture,CanComplete the compilation of the ARM instruction set, here download the 4.9.2 version of the Linaro gcc compiler according to the tutorial of punctual atom, click here for the link .

insert image description hereThen download this cross compiler, throughFileZilla delivered to the Ubuntu virtual machine:
insert image description here
then in thisUnzip and install the cross compiler

# 解压缩交叉编译器
sudo tar -xvf gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf.tar.xz

After decompression is complete, you will getCompiler executable, in order to use the compiler directly every time you start the terminal, here you can put the compilerThe storage location is imported into the environment variable, save and exit:

# 打开环境变量文件,这个文件在每次启动终端时都会自动加载
sudo vim /etc/profile
# 在文件的最后一行将交叉编译器的bin目录绝对路径导入环境变量中
export PATH=$PATH:/home/zheyuan/tools/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/bin

The screenshot is as follows:
insert image description here
After completing the above configuration, you canrestart terminal, the environment variable set at this time should have taken effect.
Then you needInstall some additional tools that the cross compiler needs to depend on

# 安装交叉编译器依赖的工具,好像是一些GNU编译器需要的运行时库
sudo apt install lsb-core lib32stdc++6

At this point, the cross compiler is installed, you canCheck the version number to confirm that the installation was successful

# 查看交叉编译器的版本信息,正常显示说明已经配置成功
arm-linux-gnueabihf-gcc -v

insert image description here

Guess you like

Origin blog.csdn.net/zzy980511/article/details/128491268