This project provides a complete, automated bash script to build and run an ARM64-based embedded Linux system from scratch using NFS root boot. The script handles everything from downloading sources to running the emulated system, with no manual intervention required.
The script automates the following workflow:
0. Starting Point: Uses a Linux desktop PC (x86) to build an ARM64 embedded Linux system
1. Cross-Compilation:
- Downloads the Linux kernel source for ARM64
- Downloads BusyBox source
- Configures and cross-compiles both for ARM64 architecture
- Enables essential features (NFS support, network drivers)
2. Root Filesystem Setup:
- Creates a clean root filesystem directory at
/tmp/test - Installs the compiled BusyBox into the rootfs
- Sets up essential system directories and configuration files
- Creates an init script that mounts necessary filesystems
3. NFS Boot Environment:
- Configures the host system's NFS server
- Exports the root filesystem directory via NFS
- Sets up network bridging between host and QEMU
4. QEMU Virtualization:
- Boots the compiled Linux kernel directly in a QEMU virtual machine
- Uses NFS for the root filesystem (no disk image needed)
- Configures network connectivity between host and guest
- Presents a functional Linux shell with BusyBox commands
git clone https://github.com/Sajjadhz/EmbeddedLinux.git
cd EmbeddedLinux/EL1
chmod +x ./arm64-nfs-qemu.sh
# Run the script (will build everything)
./arm64-nfs-qemu.sh
# Use existing builds (skip compilation)
SKIP_BUILD=1 ./arm64-nfs-qemu.shBefore running the script, set your cross-compiler path:
export CROSS_COMPILER_PATH=/path/to/your/aarch64/toolchain/binThe script expects a cross-compiler with prefix aarch64-rpi4-linux-gnu- by default, but this can be changed by setting the CROSS_COMPILE environment variable.
- Build Directory:
/tmp/arm-nfs-build/- Contains downloaded sources and compiled binaries - Root Filesystem:
/tmp/test/- Complete ARM64 root filesystem for NFS boot
The script automatically enables:
- NFS filesystem support (
CONFIG_NFS_FS=y) - Root filesystem over NFS (
CONFIG_ROOT_NFS=y) - Network protocol support (
CONFIG_IP_PNP,CONFIG_IP_PNP_DHCP) - Virtualization drivers (
CONFIG_VIRTIO_NET,CONFIG_VIRTIO_CONSOLE)
- TAP Interface:
tap0created at192.168.200.1 - VM IP: Static IP
192.168.200.50 - NAT: Configured for internet access from VM
- NFS Export:
/tmp/testexported with read/write access
- Machine Type:
virt(ARM64 virtual machine) - CPU:
cortex-a72 - Memory: 2GB
- Boot Method: Direct kernel boot with NFS root
- Console: Serial console output to terminal