In the previous article "Qemu builds ARM vexpress development environment (II) ---- Start the Linux kernel through u-boot", it has been realized to load the kernel through u-boot to start the development board and mount the root file system. This article describes how to mount the root file system through the NFS network.
Through the NFS network root file system, the development board can mount the root file system on another PC host through the NFS network after starting the kernel through u-boot. It provides great convenience for work and study in the development and debugging stage. You can directly develop and compile drivers or APPs on the Linux host, and copy the target files to the NFS service directory for use (the files are equivalent to being copied to the root file system of the development board). You can also directly modify other files in the rootfs file system on the host side, which is equivalent to directly modifying them on the development board.
This article introduces the steps to mount the network root file system using NFS. This method is not only applicable to the ARM vexpress development board environment built by Qemu, but also to all other development board entities.
Since the NFS network file system production methods of each development board are the same, you can also refer to the NFS network file system production method part in the Exynos4412 and NanopiNEO development board environment construction.
1. Environment Configuration
Linux host supports NFS service
Modify bootargs startup parameters
Set up NFS as the root file system
Set the host NFS file system address
The kernel supports NFS mounting file systems
2. Install and configure NFS service
2.1 Enabling NFS service on Linux host
Install:
# sudo apt install nfs-kernel-server
Configure NFS:
# vim /etc/exports
// Add NFS shared directory
/home/mcy/qemu/rootfs *(rw, sync, no_root_squash, no_subtree_check)
rw Readable and writable operation
sync Keep the contents of memory and disk synchronized
no_root_squash The Linux host no longer sets the development board to an anonymous user, and can operate file reading and writing
no_subtree_check Do not check the root file system subdirectory files
Restart the NFS service:
sudo /etc/init.d/rpcbind restart
sudo /etc/init.d/nfs-kernel-server restart
or:
# systemctl restart nfs-kernel-server
Check whether the NFS shared directory is created:
# sudo showmount -e
Export list for mcy-VirtualBox:
/home/mcy/qemu/rootfs *
Note:
When using the NFS network file system, the Linux host needs to close the system firewall; otherwise, the system will fail during operation.
2.2 Development board configuration supports NFS network
Modify the startup parameters in u-boot:
# vim include/configs/
CONFIG_BOOTCOMMAND
setenv bootargs 'root=/dev/nfs rw
nfsroot=192.168.0.105:/home/mcy/qemu/rootfs init=/linuxrc
ip=192.168.0.110 console=ttyAMA0';
Configure the kernel to support NFS mounting file systems
Improve NFS file system
Reboot command
3. Create a root file system
Compile busybox
nfs
Linux System Utilities --->
[*] mount (30 kb)
[*] Support mounting NFS file systems on Linux < 2.6.23
Create a rootfs directory and create files under the rootfs directory:
# mkdir etc
# cd etc
# vim inittab
::sysinit:/etc/init.d/rcS // Execute the rcS script
#::respawn:-/bin/sh
#tty2::askfirst:-/bin/sh
#::ctrlaltdel:/bin/umount -a -r
console::askfirst:-/bin/sh
::ctrlaltdel:/sbin/reboot
::shutdown:/bin/umount -a -r
# vim init.d/rcS
#!/bin/sh
PATH=/sbin:/bin:/user/sbin:/usr/bin
LD_LIBRARY_PATH=/lib
export PATH LD_LIBRARY_PATH
mount -a // Mount the root file system fstab
mkdir -p /dev/pts
mount -t devpts devpts dev/pts
mdev -s
mkdir -p /var/lock
echo "......"
# vim fstab
proc /proc proc defaults 0 0
tmpfs /tmp tmpfs default 0 0
sysfs /sys sysfs default 0 0
tmpfs /dev tmpfs default 0 0
var /dev tmpfs default 0 0
ramfs /dev ramfs default 0 0
# vim profile
PS1='xiami@vexpress:w #'
export PS1
You can also modify or set PS1 in ~/.bashrc
Startup process:
After the Linux kernel starts, mount the root file system
Start the init process, bootargs init=/linuxrc, and start the first user process
Read the inittab script in the user process,
Building other directories
Other directories can be empty directories
# cd rootfs
# mkdir proc mnt tmp sys root
Previous article:ARM development environment based on Allwinner H3 chip
Next article:Qemu builds ARM vexpress development environment (Part 2) ---- Start the Linux kernel through u-boot
Recommended ReadingLatest update time:2024-11-16 19:33
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- [Evaluation of SGP40] + Cloud platform configuration for IoT remote monitoring application development
- [RVB2601 creative application development] + AHT10 temperature and humidity sensor
- A nice frame diagram
- Measured CC2530 OSAL sleep wake-up time, current, and power consumption
- Problem with the start address of SDRAM W9825G6KH
- How to analyze this circuit
- Proteus simulation of motor control PID algorithm based on 51 single chip microcomputer
- AC Filter
- Bluetooth wireless communication technology
- What is the best domestic 32bit arm mcu solution to replace stm32 m3/m4?