Skip to content

Building

christianhaitian edited this page Sep 22, 2022 · 29 revisions

Looking to build ArkOS from scratch?

Since ArkOS is based on Ubuntu 19.10 for Arm, the process is different from a typical fully open source software build. Below describes the process:

Last but not least, Emulationstation-FCAMOD from here

The rest I add via scripted updates from here:

Sources I modified myself are available through my github account here.
Many of the recipes I use to build various emulators, libretro cores, and other tools are here

Many of my sources have been modified to support my build process. My process involves the use of both 32bit and 64bit ARM debian based chroots within an Ubuntu Mate 20.04 Oracle VirtualBox based VM I utilize. You can download the prebuilt VM either through this Mega or Google Drive link.

More info about this VM is available here.

To create debian based chroots in a Linux environment.

These instructions are based on a Ubuntu 16 or newer install or VM.

install Prereqs:

sudo apt update
sudo apt install -y build-essential debootstrap binfmt-support qemu-user-static

Then install armhf and arm64 chroots:

sudo qemu-debootstrap --arch armhf buster /mnt/data/armhf http://deb.debian.org/debian/

sudo qemu-debootstrap --arch arm64 buster /mnt/data/arm64 http://deb.debian.org/debian/


Optional Note
You can choose to use the newer Bullseye debian stable for your chroots which has a newer gcc, however there's an extra step needed to get the arm64 version going. This may have weird quirks so install and use with caution.

Per this post, you'll need to refresh qemu-user-static using a docker command. To do this, do the following after installing the prereqs noted above.:

sudo apt install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt install docker-ce -y
sudo docker run --rm --privileged multiarch/qemu-user-static --reset -p yes

Then install armhf and arm64 chroots:

sudo qemu-debootstrap --arch armhf bullseye /mnt/data/armhf http://deb.debian.org/debian/

sudo qemu-debootstrap --arch arm64 bullseye /mnt/data/arm64 http://deb.debian.org/debian/

If the arm64 fails to complete due to a "Failure trying to run: /sbin/ldconfig" error, then do the following:
sudo rm -rf /mnt/data/arm64
sudo docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
sudo qemu-debootstrap --arch arm64 bullseye /mnt/data/arm64 http://deb.debian.org/debian/
The install of the arm64 chroot should complete now.


To get into chroots:

For 32 bit Arm environment:
sudo chroot /mnt/data/armhf/
or create a Arm32 shortcut on the desktop gui and click on Arm32 shortcut on desktop

For 64 bit Arm environment:
sudo chroot /mnt/data/arm64/
or create a Arm64 shortcut on the desktop gui and click on Arm64 shortcut on desktop

Helpful tools to install in both environments for RK3326 app builds

apt -y install build-essential git wget libdrm-dev python3 python3-pip python3-setuptools python3-wheel ninja-build libopenal-dev premake4 autoconf libevdev-dev ffmpeg libsnappy-dev libboost-tools-dev magics++ libboost-thread-dev libboost-all-dev pkg-config zlib1g-dev libpng-dev libsdl2-dev clang cmake cmake-data libarchive13 libcurl4 libfreetype6-dev libjsoncpp1 librhash0 libuv1 mercurial mercurial-common libgbm-dev libsdl2-ttf-2.0-0 libsdl2-ttf-dev

ln -s /usr/include/libdrm/ /usr/include/drm

pip3 install meson

git clone https://github.com/mesonbuild/meson.git
ln -s /meson/meson.py /usr/bin/meson

Compile and install librga and copy it's headers to appropriate folders:

git clone https://github.com/christianhaitian/linux-rga.git
cd linux-rga
git checkout 1fc02d56d97041c86f01bc1284b7971c6098c5fb <--- If this is not done, you may get c_RkRgaBlit failed or c_RkRgaColorFill failed. errors.
meson build && cd build
meson compile
cp librga.so* /usr/lib/aarch64-linux-gnu/ for arm64 chroot or cp librga.so* /usr/lib/arm-linux-gnueabihf/ for arm32 chroot <---Ignore the error of not copying a librga folder as it's not needed.
cd ..
mkdir /usr/local/include/rga
cp drmrga.h /usr/local/include/rga/
cp rga.h /usr/local/include/rga/
cp RgaApi.h /usr/local/include/rga/
cp RockchipRgaMacro.h /usr/local/include/rga/

libgo2 install and development headers:

git clone https://github.com/OtherCrashOverride/libgo2.git
cd libgo2
premake4 gmake
make
cp libgo2.so* /usr/lib/aarch64-linux-gnu/ for arm64 chroot or cp libgo2.so* /usr/lib/arm-linux-gnueabihf/ for arm32 chroot
mkdir -p /usr/include/go2
cp -L src/*.h /usr/include/go2/

Docker option

There's also a docker available created by MrRatBurn. It's designed to build apps compatible with RetroOZ, however, RetroOZ is a fork of ArkOS so it should work for most if not all app builds for ArkOS as well. You can find more information about it here