Since the method of burning through USB is cumbersome, and every time the executable file is compiled, it is necessary to make a file system and burn it to the development board. Here is a relatively simple way to mount the shared directory of Windows to the development board through the nfs service. Under the shared directory of the development board, the executable program file can be directly delivered to the development board through nfs, which saves the step of image burning.
1. Install nfs server on Windows
- Step 1: Visit the link below to download the nfs.exe tool
https://pan.baidu.com/s/1y2R2aJyEExnCJ7FRqdaNdA 提取码:esdw
- Step 2: Decompress the downloaded compressed package, double-click to install nfs, please remember the installation path of nfs. It is best to create an nfsd directory on the D drive, and install nfs in the nfsd directory. Keep clicking Next until the installation is complete.
- Step 3: Copy the exports file in the compressed package you just downloaded to the path where you just installed nfs, click replace
- Step 4: Find the nfs program on the desktop, double-click to open it, then click Output, and click Restart Server
- Step 5: Select Computer, right mouse button, click Manage
- Step 6: Click Services to find NFS Server
- Step 7: Select NFS Server, right mouse button, click restart
- Step 8: After the NFS Server is restarted, click the NFS restart service button. At this time, the configuration in the middle will change. The configuration shown in the figure below indicates that the nfs service has been started. If you want to modify the nfs shared directory If it is any other directory, you can follow the operation of step 3 and modify it in exports.
- Step 9: Please create an nfs folder on your Windows D disk for file sharing with the development board
2. Perform the network configuration of the development board
-
Step 1. Connect the development board to the windows computer through a network cable.
-
Step 2: Configure the IP address of the development board in Windows, click the computer icon in the lower right corner of the computer, enter the network and Internet settings,
then click Ethernet, and then click Change Adapter Options.
Select the network device connected to the development board, right mouse button, and click Properties
Double-click the Internet protocol version 4 to enter the configuration of the IP address
Choose to use the following IP address, then configure the IP address and subnet mask, and then click OK all the way.
If the development board and Windows can ping each other, it means that the network configuration is successful. (If you can't ping each other, you can try to turn off the Windows firewall and try again)
3. Mount the nfs directory of Windows to the nfs directory of the development board (openharmony L1 Linux version)
- Step 1: Execute the following command to mount the mnt directory
Among them:
192.168.200.1 is the IP address of Windows
d:/nfs is the nfs shared directory of Windows D disk
/mnt is the /mnt shared directory of the development board
mount -o nolock,addr=192.168.200.1 -t nfs 192.168.200.1:/d/nfs /mnt
- Step 2: Verify whether nfs can be shared
Execute the following commands step by step, create a test.txt file in the nfs directory of the development board, and see if it can be seen in the nfs directory of Windows
cd /mnt
echo " test nfs " > test.txt
- Step 4: Enter the D disk of Windows, in the nfs directory, whether there is a file test.txt, and the content inside is "test nfs", if yes, it means that the nfs server on Windows is successfully built and can be shared .
At this point, the server for nfs shared files between Windows and the development board has been successfully built.
4. Mount the nfs directory of Windows to the nfs directory of the development board (Linux version)
- Step 1: In the root directory of the development board, create an nfs folder
cd /
mkdir nfs
- Step 2: Execute the following command to mount the nfs directory
where:
192.168.200.1 is the IP address of Windows
d:/nfs is the nfs shared directory of the Windows D drive
/nfs is the nfs shared directory of the development board
mount -t nfs -o nolock 192.168.200.1:/d/nfs /nfs
- Step 3: Verify whether nfs can be shared
Execute the following commands step by step, create a test.txt file in the nfs directory of the development board, and see if it can be seen in the nfs directory of Windows
cd /nfs
echo " test nfs " > test.txt
- Step 4: Enter the D disk of Windows, in the nfs directory, whether there is a file test.txt, and the content inside is "test nfs", if yes, it means that the nfs server on Windows is successfully built and can be shared .
At this point, the server for nfs shared files between Windows and the development board has been successfully built.
Note, if you still cannot mount according to the above steps, please turn off the computer firewall and try again. (If you don’t know how to turn off the firewall, please Baidu yourself)
5. Examples
If you have recompiled any executable file in Ubuntu, you can copy it to the nfs directory of Windows, and then copy the corresponding executable file to the corresponding directory of the development board under the nfs directory of the development board. Give permissions and execute.
Here we take the demo of hispark_taurus_helloworld_sample as an example for demonstration.
According to the video, after compiling, it is supposed to be copied to the root directory, and then create a file system. Here we use nfs to operate, to see how convenient it is.
-
First enter the smp directory, and copy the compiled sample_lcd executable file to the nfs shared directory under the D drive of Windows.
-
After executing the cp operation, we can execute the command under the development board
sync
to perform synchronization, and then execute the ls command, we can see that the nfs directory of the development board already has the file sample_lcd.
- At this time, execute the cp command to copy the sample_lcd file to the root directory of the development board
cp sample_lcd /root/
- Next, just give executable permissions, and then run it, isn’t it very convenient.