Step 1: We need /dev/binder and /dev/ashmem devices for android support.
Because the kernel is 4.9.140, its not possible dkms, or build them as loadable modules. But we can still build the modules in-tree with a kernel build.
Edit the file:
Linux_for_Tegra/source/public/kernel/kernel-4.9/arch/arm64/configs/tegra_defconfig file
and add these lines at the end
#Anbox Configuration
CONFIG_ANDROID=y
CONFIG_ANDROID_BINDER_IPC=y
CONFIG_ANDROID_BINDER_IPC_SELFTEST=y
CONFIG_ASHMEM=y
And do a kernel build with nvbuild.sh and install the modules and new kernel. Now we have the /dev/binder and /dev/ashmem.
Step 2: Set the permissions for the special files
cd /etc/udev/rules.d
Add a new file called 99-anbox.rules with content as:
KERNEL==“ashmem”, NAME=“%k”, MODE=“0666”
KERNEL==“binder”, NAME=“%k”, MODE=“0666”
then
sudo udevadm control --reload-rules && udevadm trigger
Step 3: Install an upgraded libSDL2 library
Due to a bug in the libSDL2 library available in 18.04, we need an upgraded version to be built from sources.
Download the libSDL2 sources of 19.04 from here:
https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/libsdl2/2.0.9+dfsg1-1ubuntu1.19.04.1/libsdl2_2.0.9+dfsg1-1ubuntu1.19.04.1.debian.tar.xz
Extract and build:
sudo apt-get build-dep libsdl2-2.0-0
./configure
make
sudo make install
Step 4: Build anbox arm64 from sources
Get the anbox arm64 sources from here:
https://github.com/HarleyPato/anbox-arm64
(Have no idea how upto-date it is, but this is the only source I know of. It seems a work in progress and some crashes occur now and then)
Follow the instruction to install all the pre-requisites, and the build steps, except one small change is required before you do the step “cmake …”
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
which will allow cmake to find the upgraded libSDL2 library.
continue with make and then sudo make install.
Step 5: Make it a proper installation
The Step 4 build and install of anbox is not a complete installation unfortunately. We need android image and services and launcher to be setup.
Download a sample android image from here:
http://anbox.postmarketos.org/android-7.1.2_r39-anbox_arm64-userdebug.img
Copy to /var/lib/anbox and rename it as android.img
Since we have to make it a proper installation, we refer to 20.04 arm64 deb of anbox. Its found here:
http://ports.ubuntu.com/pool/multiverse/a/anbox/anbox_0.0~git20191115-1build1_arm64.deb
Extract the deb file and make a copy of the files in data folder in our filesystem with a few changes.
i) copy the anbox executable from /usr/local/bin to /usr/bin
ii) Add this line:
Environment=“DISPLAY=:0”
before ExecStart in /usr/lib/systemd/user/anbox-session-manager.service file
iii) Remove the lines
ExecStartPre=/sbin/modprobe ashmem_linux
ExecStartPre=/sbin/modprobe binder_linux
In file lib/systemd/system/anbox-container-manager.service because there are built into the kernel.
Step 6: Start the anbox services
sudo systemctl unmask anbox-container-manager.service
sudo systemctl start anbox-container-manager.service
sudo systemctl enable anbox-container-manager.service
systemctl --user unmask anbox-session-manager.service
systemctl --user start anbox-session-manager.service
systemctl --user enable anbox-session-manager.service
// Check status of the services
sudo systemctl status anbox-container-manager.service
systemctl --user status anbox-session-manager.service
reboot
Check the anbox launcher in the search and launch it!
You can install more apps by using adb. Just check on the net.
Or you can use F-Droid repos
wget https://f-droid.org/FDroid.apk
adb install FDroid.apk