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=8Run fdisk to partition the SD card:
sudo fdisk /dev/sdXAt the fdisk prompt, delete old partitions and create a new one:
- Type
o. This will clear out any partitions on the drive. - Type
pto list partitions. There should be no partitions left. - Now type
n, thenpfor primary,1for the first partition on the drive,2048for 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/sdX1Mount the filesystem:
sudo mount /dev/sdX1 /mntDownload 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
syncInstall uboot-tools. In ArchLinux:
sudo pacman -S uboot-toolsCreate boot.txt file in /boot dir.
cd /mnt/boot
nano boot.txtPaste 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.scrUnmount your SD card:
sudo umount /mnt
cd /tmpClone 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-bootInstall the cross compiler for ARM EABI (in Arch Linux):
sudo pacman -S arm-none-eabi-gccCompile 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
makeFlash it to the device:
sudo dd if=u-boot-sunxi-with-spl.bin of=/dev/sdX bs=1024 seek=8Insert 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 archlinuxarmAnd so on and so forth:
pacman -S sudo
visudo
Try to decipher this official migration script nand-sata-install. The functions you're interested in are format_emmc and create_orangepi.
Or just do
dd if=/dev/mmcblk1 of=/dev/mmcblk2 bs=512 count=12582912to dump the whole SD card to EMMC. Just don't forget to use your drive size incount. I just did it and it works. Forget about official Orange manuals.UPD: I just found out out that this guide is for Orange Pi PC, not PC Plus! The title confused me (it has "+"), and I believe you were confused too! The thing is, the only difference between PC and PC Plus is the existence of onboard EMMC. Here we compile u-boot specifically for PC version. All you need to do is to compile it for PC Plus instead:
make orangepi_pc_plus_defconfigFun note is that if you compare configs for PC and PC Plus, it will only have one new line - the one that mentions EMMC!