Skip to content
This repository was archived by the owner on Nov 18, 2022. It is now read-only.
This repository was archived by the owner on Nov 18, 2022. It is now read-only.

Installer for Android, based on NDK #538

@hugbug

Description

@hugbug

Android is based on Linux. That allowed us to use binaries compiled for Linux on Android. Unfortunately these binaries don't work in Android 8 anymore. We are going to fix this.

C libraries

POSIX defines API - a list of functions available for applications written in C (and other languages which can access C API). All these functions are usually implemented by platform vendors as standard C library. GNU/Linux has glibc which is used on server and desktop systems. There are also other C libraries such as uClibc or musl. C libraries contain high level functions such as for string manipulation but also low level system functions such as for file access. The latter rely on kernel functions to access device drivers or other hardware related manipulations.

Android has it's own C library called Bionic. Like other C libraries it needs to call kernel functions for low level things.

Restrictions in Android 8

In Android 8 an attempt was made to improve security by restricting third-party applications from accessing certain kernel functions. Android developers have built a list of kernel functions used in Bionic and declared it whitelist. All other kernel functions are not available for third-party applications.

NZBGet binaries included in installer for Linux are compiled using glibc and uClibc. It happened that glibc and uClibc do use certain kernel functions which Bionic doesn't use and which weren't added to whitelist. As a result nzbget binaries compiled for Linux are not working on Android 8 anymore.

Interesting fact: whitelist restrictions are applied to processes launched via Android UI. When launching nzbget from android debugger shell it (nzbget) works. That doesn't help us though as we need a way to launch nzbget from Android UI.

What to do?

A logical solution is to compile nzbget using Android's C library Bionic. That means:

  • prepare cross-compiling toolchains based on Android NDK - armv7 and x86 for the start; aarch64 and x86_64 may be added later;
  • make nzbget code compatible with Bionic;
  • extend nzbget build script build-nzbget to work with NDK based toolchains;
  • extend unpacker build script build-unpack to work with NDK based toolchains;
  • build 7zip and unrar for Android targets;
  • extend installer script to work with Android targets;
  • update Android installer app to use Android installer packages instead of Linux installer packages;
  • build busybox (used in Android installer app) using new NDK toolchains.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions