- Download Android SDK, NDK, system and kernel source code;
- Download modified lxc and libcap source code (ppoffiec/lxc-android, ppoffice/libcap-android)
- Build Android system from source first so that we can link to its shared library when we build lxc (or maybe we don't have to);
- Modify Android kernel config and make sure lxc-checkconfig does not report any missing features. Then build kernel;
- Modify Android
system/core/rootdir/init.rc
according toinit.rc.diff
. Make sure you mount all the cgroup subsystems needed (cpu, cpuacct, cpuset, memory, pids, devices, freezer, blkio) under/sys/fs/cgruop
, otherwise lxc won't find them; - Rebuilt the Android system image so that the modified init.rc is in the image;
- Fire up the emulator with custom kernel (
emulator -kernel kernel-file-path
) and use adb shell and dmesg to check if everything is doing ok.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get Pre-reqs | |
apt-get install libattr1-dev git unzip make gcc automake pkg-config | |
# Get Android NDK | |
cd /root | |
mkdir -p build && cd build | |
wget http://dl.google.com/android/repository/android-ndk-r10e-linux-x86_64.zip -O /tmp/android-ndk-r10e-linux-x86_64.zip | |
unzip /tmp/android-ndk-r10e-linux-x86_64.zip -d /root/build | |
# Set paths |
All packages, except for Tini have been added to termux-root. To install them, simply pkg install root-repo && pkg install docker
. This will install the whole docker suite, left only Tini to be compiled manually.
Google has traditionally been against upgrading the compiler as it comes with new warnings and potentially changes behavior. However, these are actually good reasons to upgrade, they help shake out undefined behavior.
In order to compile with a newer version of GCC, you'll need to do a few modifications to your kernel in addition to a new toolchain. I recommend using the ones available from Bootlin.
- Remove gcc-wrapper and any instances of
-Werror
: gcc-wrapper is CAF's shitty way of enabling-Werror
, which is unnecessary since regular-Werror
will suffice. We need to remove it for the time being because there will be new warnings to fix. Pick Google's revert of it (3.18, 4.4) then remove any other instances of-Werror
(such as in prima, qcacld-2.0, and qc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get Pre-reqs | |
apt-get install libattr1-dev git unzip make gcc automake pkg-config | |
# Get Android NDK | |
cd /root | |
mkdir -p build && cd build | |
wget http://dl.google.com/android/repository/android-ndk-r10e-linux-x86_64.zip -O /tmp/android-ndk-r10e-linux-x86_64.zip | |
unzip /tmp/android-ndk-r10e-linux-x86_64.zip -d /root/build | |
# Set paths |