KaiOS
This page contains information about the Mozilla/KaiOS collaboration including building instructions, links to the code and various other resources. The scope of the project is to modernize the old Boot2Gecko codebase to run atop a modern Gecko so that it can be used by KaiOS as a basis for their future phones.
Building
There's two ways to build the project: a full emulator build or a stand-alone Gecko build. Generally speaking you won't need the full emulator build unless you're doing work specifically on it.
Building a stand-alone Gecko
Clone the kaios project branch:
hg clone https://hg.mozilla.org/projects/kaios
Bootstrap your build environment via mach (this needs to be implemented see bug 1653198
./mach bootstrap --no-system-changes --no-interactive --application-choice b2g
Add a suitable mozconfig file, this should have at least the following options (TODO: prepare a default mozconfig for first-time users)
ac_add_options --enable-application=b2g ac_add_options --with-target-arch-name=x86_64
Build as usual with ./mach build
Building the emulator
This involves downloading the entire AOSP tree and building an Android emulator from it, including the Gecko bits. It's a long and slow process and it requires at least 120GB of free space on your disk.
Clone the B2G tree
git clone https://github.com/kaiostech/B2G.git
Configure the tree for building the x86-64 emulator. This step will download all the AOSP sources required for the build which are 10s of GB so be patient
REPO_INIT_FLAGS="--depth=1" ./config.sh emulator-10-x86_64
Setup your environment to fetch the custom NDK
export LOCAL_NDK_BASE_URL='ftp://ftp.kaiostech.com/ndk/android-ndk'
Install Gecko dependencies
cd gecko && ./mach bootstrap --application-choice mobile
Build by invoking the build.sh script in the top-level directory. Depending on your machine this step can take anywhere from 30 minutes to several hours
./build.sh
Running the emulator
If you've built the emulator yourself you can launch it from the root *B2G* folder. First source the setup for your build, you will have to execute this step only once before launching the emulator
source setup.sh
Once the environment is primed launch the emulator with the following command
emulator -writable-system -selinux permissive