Generally speaking, most people do experiments with Linux in a virtual machine under Windows, and I use dual systems here. It is very important for uboot and dual-system Ubuntu 18.04 to ping each other. If the ping fails, the subsequent tftp download image to the development board and nfs mount cannot be performed. I pinged for a whole day and finally got it through, so I will record it.
Mine is 64-bit Linux. There are two network cards by default, one wired network card (enp2s0) and one wireless network card (wlp3s0), lo is for loopback testing.
Next, before editing this file vi /etc/network/interfaces
, set our wireless network card to a fixed IP. The IP of the wireless network card should be different from the IP gateway of the wired network card, that is, wlp3s0 is 192.168.1 .x, our wired network card enp2s0 should be set to 192.168.0.x, which is different from wlp3s0. Edit /etc/network/interfaces as shown below, and change it according to your own situation:
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto enp2s0
iface enp2s0 inet static
address 192.168.0.111
gateway 192.168.0.1
netmask 255.255.255.0
Then enter sudo vim /etc/NetworkManager/NetworkManger.conf
to modify the NetworkManager configuration file. Change false to true.
Then execute the command to restart the network card. Each version of Ubuntu has a different command to restart the network card. I am version 18.04. The command to restart the network card is sudo service network-manager restart
The IP addresses of uboot are all environment variables, which are set with the command set. The IP address of uboot must be the same as the gateway of the IP address of the Ubuntu wired network card. The gateway of the Ubuntu wired network card set above is 192.168.0, so uboot should also be like this, otherwise the ping will not work.
set ipaddr 192.168.0.88set gatewayip 192.168.0.2set serverip 192.168.0.111//This should be the same as the IP of Ubuntu's wired network card, the server IP used for tftp download is set netmask 255.255.255.0
Then enter save
to save the environment variables to facilitate the next startup
Connect the development board to the Ubuntu computer with a network cable. Note: At this time, you must turn off the wireless network card, and then go to ping. The ping may not work for the first few times. If you ping a few more times, the computer may not respond. Wait for the wired connection The network card. If xxxxx is alive is displayed on the development board, it proves to be successful. What I tested is that Ubuntu can occasionally ping the development board, but occasionally it does not work, but it has no effect on all the following steps.
The next time you turn it on again, the wired network card is turned on by default, and the middle point of the setting forgets to be connected, just turn it off
tftp is used to download and transfer files, here is used to download files in Ubuntu to the development board. Use Ubuntu as a server and use the development board
Install tftp method:
Execute the following commands in sequence
sudo apt-get install tftp-hpa tftpd-hpa
mkdir ~/tftpboot
chmod 777~/tftpboot/
sudo vim /etc/default/tftpd-hpa
Enter the contents of this file /etc/default/tftpd-hpa into the following format
# /etc/default/tftpd-hpa
TFTP_USERNAME="mengchao"//Username, set by yourself
TFTP_DIRECTORY="/home/mengchao/tftpboot"//tftpboot absolute path,Remember to change to your own
TFTP_ADDRESS=":69"
TFTP_OPTIONS="--secure"
Then restart the tftp server, the command is as follows: service tftpd-hpa restart
, so far, the tftp setup is complete.
Use the tftp command to download under uboot. The files to be downloaded should be placed in the tftpboot folder directory created above in advance. The format is as follows:
tftp address file name
tftp 0x30008000 zImage-qt
0 x30008000 is the load address of the Linux kernel, this address will be described later in the article.
Next, start the Linux kernel, use the command bootm 0x30008000
in uboot