Installing Linux on an ARM development board can be complex, but this detailed guide will walk you through each step from preparation to booting Linux.
1. Preparation
Before you start, gather the following tools and software:
- A computer running Linux
- An ARM-based development board
- A USB-to-serial adapter
- A Micro USB cable
- An SD card reader
- A blank SD card
- A USB keyboard and mouse (optional)
- An HDMI monitor (optional)
Download Linux Kernel and Root Filesystem
Create Bootable SD Card
You will use the SD card as the boot medium.
Insert the SD card into the reader and connect it to your computer. Open a terminal and run:
$ sudo fdisk -l
This lists all disk devices. Identify the device node for your SD card (e.g., /dev/sdb
).
2. Unmount all partitions on the SD card:
$ sudo umount /dev/sdb*
3.Create a new partition table and partition:
$ sudo fdisk /dev/sdb
Use the n
command to create a new partition, set it to Linux filesystem type using the t
command, and save with the w
command.
4. Format the partition:
$ sudo mkfs.ext4 /dev/sdb1
5. Create a mount point and mount the partition:
$ sudo mkdir /mnt/sdcard
$ sudo mount /dev/sdb1 /mnt/sdcard
6. Extract the root filesystem to the SD card:
$ sudo tar zxvf rootfs.tar.gz -C /mnt/sdcard
Install and Configure the Bootloader
- Remove the SD card from your computer and insert it into the development board. Connect the board to your computer using the USB-to-serial adapter.
- Open a terminal and use a serial tool (like
minicom
orpicocom
) to connect:
$ sudo minicom -D /dev/ttyUSB0
Press Enter to access the command line.
3. Find the device node of the boot SD card:
$ fdisk -l
Note the path for later use.
4. Install the bootloader to the SD card:
$ sudo dd if=u-boot-sunxi-with-spl.bin of=/dev/sdX bs=1024 seek=8
Replace u-boot-sunxi-with-spl.bin
with your bootloader file path and /dev/sdX
with your SD card’s device node. Then, reinsert the SD card into the board.
5. Copy the kernel image to the boot SD card:
$ sudo cp zImage /mnt/sdcard/boot
Replace zImage
with your actual kernel image file path.
6. Copy the device tree file:
$ sudo cp sun8i-h3-orangepi-one.dtb /mnt/sdcard/boot
Replace with your device tree file path.
7. Create a boot.cmd
file in the /mnt/sdcard/boot
directory and add:
setenv bootargs console=ttyS0,115200 root=/dev/mmcblk0p1 rootwait panic=10
fatload mmc 0:1 0x4000000 zImage
fatload mmc 0:1 0x42000000 sun8i-h3-orangepi-one.dtb
bootz 0x4000000 - 0x42000000
Save and close the file.
8. Compile boot.cmd
into a binary:
$ sudo mkimage -C none -A arm -T script -d boot.cmd boot.scr
Then copy it to the boot directory:
$ sudo cp boot.scr /mnt/sdcard/boot
Unmount the SD card and insert it into the development board.
Boot the Development Board
Connect the USB keyboard and mouse (if available) and an HDMI monitor. Power on the board.
During the boot process, you should see Linux startup messages on the HDMI display. If successful, you’ll reach a login prompt. Enter the default username and password, or the credentials you set, to access the Linux command line.