Build Ubuntu with the legacy kernel for Orange PI Zero Plus2 H5

Written on August 6, 2018 by thanh

orange-pi-zero-plus2-h5-board

Prerequisites

  1. Ubuntu 16.04 or higher x64 Bare-metal / VM
  2. 10 GB of available hard disk space and 2GB or more free of RAM
  3. Internet connection for clone source code

Note: Although OrangePI (aka Xunlong) provider their build script to build custom image but missing importance library for multimedia, video decode and graphics (https://github.com/orangepi-xunlong/OrangePi_Build)

So you can build a new image with hardware acceleration to decode video for yourself and hack something inside image by choosing from the configurations available below.

Procedure

  1. Get/Update toolchain, blob, build script, binary firmware and source code
  2. Start the build. This will automatically compile uboot, Image kernel, package packages, and finally generate an image ready to be flashed.
  3. Proceed to installing image

Note: The legacy uboot source code for Soc H5 was provided by Xunlong but missing ARM trusted firmware source code (binary included instead)

Checking out source

mkdir -p ~/buildroot
cd ~/buildroot

# Build script
git clone https://github.com/pt-studio/orangepih5_scripts.git scripts

# Binary blob / prebuild firmware
git clone https://github.com/pt-studio/orangepih5_external.git external

# uBoot source code
git clone https://github.com/pt-studio/orangepih5_uboot.git uboot

# Kernel source code
git clone https://github.com/pt-studio/orangepih5_kernel.git kernel

ln -sf build.sh script/main.sh

Install toolchain

cd ~/buildroot
# Toolchain
git clone https://github.com/orangepi-xunlong/OrangePiH5_toolchain.git toolchain
cd toolchain

ROOT=`cd .. && pwd`
TOOLS="$ROOT/toolchain"
TOOLTARXZ="$ROOT/toolchain/toolchain_tar/toolchain"
TOOLTAR="$ROOT/toolchain/toolchain.tar.gz"
UBOOTTAR="$ROOT/toolchain/uboot-tools.tar.gz"
UBOOTTARXZ="$ROOT/toolchain/toolchain_tar/u-boot-compile-tools"
UBOOTS="$TOOLS/gcc-linaro-aarch"

cat ${TOOLTARXZ}* > ${TOOLTAR}
tar xzvf $TOOLTAR -C $TOOLS

cat ${UBOOTTARXZ}* > ${UBOOTTAR}
tar xzvf $UBOOTTAR -C $UBOOTS

Build board support package

Supported cross platform build:

  • libcedrus: Sunxi Video Engine library. https://linux-sunxi.org/Cedrus
  • libvdpau-sunxi: VDPAU for Allwinner sunxi SoCs. https://linux-sunxi.org/Cedrus/libvdpau-sunxi
cd ~/buildroot
./build.sh

# Type 6 for Build Board Support Packages

Building Images

cd ~/buildroot
./build.sh

# Type 0 for build image

Proceed to installing image

cd ~/buildroot
sudo apt-get install -y dc3dd
sudo dc3dd if=out/image/OrangePiH5_Zero_Plus2.img of=/dev/mmcblX <~ replace x by sdcard device
sudo sync