ubuntu 18 qemu模拟arm u-boot加载内核 nfs挂载文件系统
1. 安装qemu模拟器及arm交叉编译器
sudo apt-get install flex bison \
qemu uml-utilities bridge-utils \
libncurses5-dev \
gcc-arm-linux-gnueabi build-essential \
nfs-kernel-server \
tftp-hpa tftpd-hpa xinetd \
device-tree-compiler u-boot-tools
2. 下载编译内核
https://www.kernel.org/
tar xf linux-5.6.tar.xz && cd linux-5.6
export ARCH=arm CROSS_COMPILE=arm-linux-gnueabi-
make vexpress_defconfig
make menuconfig #将nfs4支持选上,将kernel hack中的debug filesystem选上
make zImage -j4 && make dtbs
make LOADADDR=0x60003000 uImage -j4
3. 下载编译busybox
https://busybox.net/
tar xf busybox-1.31.1.tar.bz2 && cd busybox-1.31.1
export ARCH=arm CROSS_COMPILE=arm-linux-gnueabi-
make defconfig
make menuconfig #配置静态编译
make -j4 && make install
4. 编译u-boot
unzip u-boot-master.zip && cd u-boot
make vexpress_ca9x4_defconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi-
5. 制作根文件系统
mkdir kernel
cp linux-5.6/arch/arm/boot/zImage kernel/
cp linux-5.6/arch/arm/boot/dts/vexpress-v2p-ca9.dtb kernel/
cp linux-5.6/.config kernel/
sudo mkdir -p rootfs/{lib,etc,dev,mnt}
sudo cp busybox-1.31.1/_install/* -r rootfs/
sudo cp -P /usr/arm-linux-gnueabi/lib/* rootfs/lib/
sudo mkdir -p rootfs/etc/init.d
sudo vim rootfs/etc/init.d/rcS
mkdir -p /proc
mkd