Orange Pi
Orange Pi (One) is a minimalist computer built for the ARMv7-A architecture. More information about this project.
This article is strongly based on Banana Pi. Moreover this article is not meant to be an exhaustive setup guide and assumes that the reader has setup an Arch system before.
Contents
Installation
Using original ArchLinuxARM tarball
This method will install unmodified ArchLinuxARM armv7 basesystem to your Orange Pi One, meaning you'll have the latest mainline kernel running. It will probably also work on other H3 Orange Pis with mainline support.
Install basesystem to a SD card
Zero the beginning of the SD card:
dd if=/dev/zero of=/dev/sdX bs=1M count=8
Use fdisk to partition the SD card, and format it with mkfs.ext4 -O ^metadata_csum,^64bit /dev/sdX1
.
Mount the ext4 filesystem, replacing sdX1
with the formatted partition:
# mkdir mnt # mount /dev/sdX1 /mnt
Download and extract the root filesystem:
# wget http://archlinuxarm.org/os/ArchLinuxARM-armv7-latest.tar.gz # bsdtar -xpf ArchLinuxARM-armv7-latest.tar.gz -C /mnt/
Create a file with the following boot script
boot.cmd
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 if load ${devtype} ${devnum}:${bootpart} 0x48000000 /boot/uImage; then if load ${devtype} ${devnum}:${bootpart} 0x43000000 /boot/script.bin; then setenv bootm_boot_mode sec; bootm 0x48000000; fi; fi
Compile it and write it to the SD-card using the package uboot-tools
# mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "Orange Pi One boot script" -d boot.cmd /mnt/boot/boot.scr # umount /mnt
Compile and copy U-Boot bootloader
The next step is creating a u-boot image. Make sure you have arm-none-eabi-gcc, dtc, git, swig and uboot-tools installed on your system. If you compile for a different H3 Orange Pi than the One, replace orangepi_one_config accordingly. Then clone the u-boot source code and compile a Orange Pi image:
$ git clone git://git.denx.de/u-boot.git $ cd u-boot $ git checkout tags/v2018.07 $ make -j4 ARCH=arm CROSS_COMPILE=arm-none-eabi- orangepi_one_defconfig $ make -j4 ARCH=arm CROSS_COMPILE=arm-none-eabi-
If everything went fine you should have an U-Boot image: u-boot-sunxi-with-spl.bin. Now dd the image to your sdcard, where /dev/sdX is your sdcard.
# dd if=u-boot-sunxi-with-spl.bin of=/dev/sdX bs=1024 seek=8
Using U-Boot precompiled binaries
If you couldn't compile them on your AMD64 machine, just grab them at: https://gitlab.com/vinibali/orangepi_uboot
Use the same command for placing it to the sdcard:
# dd if=u-boot-sunxi-with-spl.bin of=/dev/sdX bs=1024 seek=8
Login / SSH
SSH login for root is disabled by default. Login with the default user account and use su.
Type | Username | Password |
---|---|---|
Root |
root
|
root
|
User |
alarm
|
alarm
|
Additional step, Wi-Fi Driver (RTL8189ES/ETV)
This driver will require to Orange Pi Plus / Plus 2.
First, Install the kernel headers.
# sudo pacman -S base-devel git linux-armv7-headers
Then, build out-of-tree driver.
# git clone https://github.com/jwrdegoede/rtl8189ES_linux.git # cd rtl8189ES_linux # make -j4 ARCH=arm KSRC=/usr/lib/modules/4.18.11-1-ARCH/build/
And install manually.
# cp 8189es.ko /usr/lib/modules/4.18.11-1-ARCH/kernel/drivers/net/wireless/realtek/ # depmod -a # modprobe 8189es
Orange Pi PC2
Allwinner H5 @ 1.20Ghz 64bit system AArch64
General information about the device
Follow general installation instruction above. Differences:
UBoot
# git clone https://github.com/apritzel/arm-trusted-firmware.git # git clone git://git.denx.de/u-boot.git # cd arm-trusted-firmware # make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j4 PLAT=sun50iw1p1 DEBUG=1 bl31 # cp build/sun50iw1p1/debug/bl31.bin ../u-boot/ # cd ../u-boot # make ARCH=arm CROSS_COMPILE=aarch64-linux-gnu- -j4 orangepi_pc2_defconfig # make ARCH=arm CROSS_COMPILE=aarch64-linux-gnu- -j4 # cat spl/sunxi-spl.bin u-boot.itb > u-boot-sunxi-with-spl.bin # dd if=u-boot-sunxi-with-spl.bin of=/dev/sdX bs=8k seek=1
Kernel
For AARCH64 you'll need another rootfs
# wget http://archlinuxarm.org/os/ArchLinuxARM-aarch64-latest.tar.gz # bsdtar -xpf ArchLinuxARM-aarch64-latest.tar.gz -C mnt/
You need to compile your own kernel. Download latest mainline release from:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
or fetch this kernel repository with new patches already included:
git clone https://github.com/megous/linux.git
# cd linux
Here is a basic config file to start with:
# wget https://github.com/armbian/build/raw/master/config/kernel/linux-sunxi-next.config -O .config # make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j4 # make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- INSTALL_MOD_PATH=/mnt -j4 modules_install # cp arch/arm64/boot/Image /mnt/boot # cp arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dtb /mnt/boot/dtbs/allwinner/sun50i-h5-orangepi-pc2.dtb
change the /mnt/boot/boot.cmd to
boot.cmd
part uuid ${devtype} ${devnum}:${bootpart} uuid setenv bootargs console=${console} root=PARTUUID=${uuid} rw rootwait setenv fdtfile allwinner/sun50i-h5-orangepi-pc2.dtb if load ${devtype} ${devnum}:${bootpart} ${kernel_addr_r} /boot/Image; 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 booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r}; else booti ${kernel_addr_r} - ${fdt_addr_r}; fi; fi; fi
make image the /mnt/boot/boot.scr to
# mkimage -C none -A arm64 -T script -d /mnt/boot/boot.cmd /mnt/boot/boot.scr