ArchLinux ARM on Orange Pi One
Posted On 04/06/2016
Note: As of 27/11/2016 the mainline kernel included in the ArchLinux ARM Image supports ethernet and USB. Please use the following image: ArchLinuxARM-armv7-latest.tar.gz
I recently found out about this new SoC board called Orange Pi that you can easily buy on Aliexpress for just 9 Euros.
While the hardware is great for the price, featuring a Quad-Core Allwinner H3 CPU capable of showing 4K videos seamlessly, the software support is terrible as expected.
Let’s start by saying that there’s no official support within the Linux Mainline kernel; our Orange Pi can boot, but there’s no Ethernet & USB drivers making this little board quite useless.
The kernel provided by Allwinner is extremely outdated (3.4) and doesn’t support systemd. (Hence it can’t boot Archlinux ARM)
Currently the only stable OS is armbian, http://www.armbian.com/, by third-party community users.
My goal here is to boot ArchLinux ARM on the board with proper working Ethernet & USB. To do so I’ve chosen this kernel: https://github.com/jwrdegoede/linux-sunxi.git
ARM Toolchain Setup
First download the linaro toolchain from here and extract it somewhere.
To set up the cross compilation environment run cross.sh after changing the PATH variable accordingly (/home/ingamedeo/Documenti/OrangePi/) (chmod +x it first!)
Download U-Boot from: ftp://ftp.denx.de/pub/u-boot/
Then in the main U-boot folder run:
You should now find a file called u-boot-sunxi-with-spl.bin. We’ll use it later on!
SD Card Format
First of all clear everything out:
dd if=/dev/zero of=/dev/sdX bs=1M count=8
Then run fdisk and create a new partition starting from 2048 & format it:
sudo fdisk /dev/sdX
jwrdegoede’s kernel download
Download the kernel by running:
git clone –single-branch -b sunxi-wip https://github.com/jwrdegoede/linux-sunxi.git
Official ArchLinuxARM Image download
Now mount the SD Card ext4 partition and extract the official image inside: (The following commands may require root privileges!)
mount /dev/sdX1 ArchARM
bsdtar -zxvf ArchLinuxARM-armv7-latest.tar.gz -C ArchARM
You should now have a folder called linux with the kernel in it and another one called ArchARM mounted on the SD card partition 1. (Rename the kernel folder accordingly)
Building the kernel
cd to the linux directory.
It’s necessary to edit the kernel config file to enable emac ethernet support:
and add the following line at the end of the file:
Let’s now choose the config file to compile the kernel:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- sunxi_defconfig
You can edit the config to enable additional features. This is left to you.
We can now run the build_kernel.sh script:
chmod +x build_kernel.sh
NOTE: I’ve 8 cores on my machine, please edit the build script accordingly – make -j8
Download U-boot boot.txt and run:
mkimage -A arm -O linux -T script -C none -n “U-Boot boot script” -d boot.txt boot.scr
Copy the output file boot.scr to the SD Card /boot directory.
Now unmount your SD Card partition with:
And dd u-boot after the partition table:
dd if=u-boot-sunxi-with-spl.bin of=/dev/sdX bs=1024 seek=8
Enjoy your new Orange Pi board!
ArchLinux ARM bootlog here!
Some stuff taken from: http://www.orangepi.org/orangepibbsen/forum.php?mod=viewthread&tid=845
Tweaks & Extra
CPU Core frequency adjusting in U-Boot
Run make menuconfig:
Boot Images —> CPU Clock frequency
Default should be 1080 (Mhz); I lowered it to 816 Mhz
Voltage Regulator SY8113B patch
The following enables the On-Board Voltage regulator which can switch the Core voltage between 1.1V and 1.3V (Should NEVER exceed 1.5V)
Patch here: https://patchwork.kernel.org/patch/9198383/ download and save as patch.diff in linux/arch/arm/boot/dts. Then run:
patch < patch.diff
Check that our SY8113B is working by checking the 1V2C voltage point on the PCB (near the main processor). It should read 1.1V for frequencies <= 816 Mhz
Be aware that as of right now no CPU scaling is implemented in the mainline kernel, so the U-boot clock speed is used instead.
GPIO C Library
This works: https://github.com/zhaolei/WiringOP | gpio readall to list GPIO Layout. | No PWM support
My Kernel Config (archlinuxarm-linux-v7 based): Download
Thanks to tekdoc.