This guide is based on multiple guides as well as official instructions for the other boards found on the Internet:
- https://github.com/RoEdAl/alarm-uboot-sunxi-armv7
- https://uthings.uniud.it/building-mainline-u-boot-and-linux-kernel-for-orange-pi-boards
- https://archlinuxarm.org/platforms/armv7/allwinner/pcduino3
I have gone through all these steps recently and got a working board with my favorite Arch Linux ARM. I hope it will be helpful for someone else.
Replace sdX
with the device name for your SD card.
Zero the beginning of the SD card:
sudo dd if=/dev/zero of=/dev/sdX bs=1M count=8
Run fdisk
to partition the SD card:
sudo fdisk /dev/sdX
At the fdisk prompt, delete old partitions and create a new one:
- Type
o
. This will clear out any partitions on the drive. - Type
p
to list partitions. There should be no partitions left. - Now type
n
, thenp
for primary,1
for the first partition on the drive,2048
for the first sector, and then press ENTER to accept the default last sector. - Write the partition table and exit by typing
w
.
Create the ext4 filesystem:
sudo mkfs.ext4 /dev/sdX1
Mount the filesystem:
sudo mount /dev/sdX1 /mnt
Download and extract the root filesystem:
wget http://os.archlinuxarm.org/os/ArchLinuxARM-armv7-latest.tar.gz
sudo bsdtar -xpf ArchLinuxARM-armv7-latest.tar.gz -C /mnt
sync
Install uboot-tools
. In ArchLinux:
sudo pacman -S uboot-tools
Create boot.txt
file in /boot
dir.
cd /mnt/boot
nano boot.txt
Paste the following contents into it:
if test -n ${distro_bootpart}; then setenv bootpart ${distro_bootpart}; else setenv bootpart 1; fi
part uuid ${devtype} ${devnum}:${bootpart} uuid
setenv bootargs console=${console} root=PARTUUID=${uuid} rw rootwait
if load ${devtype} ${devnum}:${bootpart} ${kernel_addr_r} /boot/zImage; then
if load ${devtype} ${devnum}:${bootpart} ${fdt_addr_r} /boot/dtbs/${fdtfile}; then
if load ${devtype} ${devnum}:${bootpart} ${ramdisk_addr_r} /boot/initramfs-linux.img; then
bootz ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r};
else
bootz ${kernel_addr_r} - ${fdt_addr_r};
fi;
fi;
fi
Now create the boot script boot.scr
:
sudo mkimage -A arm -O linux -T script -C none -n "U-Boot boot script" -d boot.txt boot.scr
Unmount your SD card:
sudo umount /mnt
cd /tmp
Clone U-Boot repo and checkout the latest tag (or the one you need):
git clone --depth 1 --branch v2023.04 https://github.com/u-boot/u-boot
cd u-boot
Install the cross compiler for ARM EABI (in Arch Linux):
sudo pacman -S arm-none-eabi-gcc
Compile bootloader (you need to have setuptools
Python package to be installed):
export CROSS_COMPILE=arm-none-eabi-
export ARCH=arm
make distclean
make orangepi_pc_defconfig
make
Flash it to the device:
sudo dd if=u-boot-sunxi-with-spl.bin of=/dev/sdX bs=1024 seek=8
Insert the micro SD card into Orange Pi PC, connect Ethernet, and apply 5V power. Use the serial console or SSH to the IP address given to the board by your router. Login as the default user alarm
with the password alarm
. The default root
password is root
. Initialize the pacman keyring and populate the Arch Linux ARM package signing keys:
su
# Type in the password: root (by default)
pacman-key --init
pacman-key --populate archlinuxarm
And so on and so forth:
pacman -S sudo
visudo
This is awesome, thanks so much for this. Might want to grab the kernel headers for the orange pi (5) from aur as well.
With u-boot, you can clone just what you need using this:
git clone --depth 1 --branch v2023.04 https://github.com/u-boot/u-boot
You'll save ~200mb download.
When doing the u-boot step, I get this error though:
How do we go about adding these steps to the archlinuxarm.org website? The wiki page has similar steps for other boards such as the Raspberry Pi 4 (https://archlinuxarm.org/platforms/armv8/broadcom/raspberry-pi-4).
I'll reach out on IRC to see if we can get a wiki page added.