Skip to content

Sajjadhz/EmbeddedLinux

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Embedded Linux Development Environment - ARM64

Project Description

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.

What This Script Does

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

Usage Instructions

Basic Usage

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.sh

Setting Up Cross-Compiler

Before running the script, set your cross-compiler path:

export CROSS_COMPILER_PATH=/path/to/your/aarch64/toolchain/bin

The 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.

Directory Structure Created

  • Build Directory: /tmp/arm-nfs-build/ - Contains downloaded sources and compiled binaries
  • Root Filesystem: /tmp/test/ - Complete ARM64 root filesystem for NFS boot

Technical Details

Kernel Configuration

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)

Network Setup

  • TAP Interface: tap0 created at 192.168.200.1
  • VM IP: Static IP 192.168.200.50
  • NAT: Configured for internet access from VM
  • NFS Export: /tmp/test exported with read/write access

QEMU Parameters

  • 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

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages