01_Android_LXC_Note.md
### Steps to build Android kernel and system for LXC:
1. Download Android SDK, NDK, system and kernel source code;
2. Download modified lxc and libcap source code (ppoffiec/lxc-android, ppoffice/libcap-android)
3. 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);
4. Modify Android kernel config and make sure lxc-checkconfig does not report any missing features. Then build kernel;
5. Modify Android `system/core/rootdir/init.rc` according to `init.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;
6. Rebuilt the Android system image so that the modified init.rc is in the image;
7. 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 has been truncated. show original
envsetup.sh
# Please see https://github.com/clondroid/lxc-for-Android-7.1.2
export ANDROID_SDK_HOME=/home/ppoffice/Android/Sdk
export ANDROID_NDK_HOME=/home/ppoffice/Android/android-ndk-r18b
export ANDROID_STANDALONE_TOOLCHAIN_HOME=/home/ppoffice/Android/lxc/toolchain
export SYSROOT=$ANDROID_STANDALONE_TOOLCHAIN_HOME/sysroot
# User specific environment and startup programs
PATH=${ANDROID_NDK_HOME}
PATH=$PATH:${ANDROID_SDK_HOME}/tools:${ANDROID_SDK_HOME}/platform-tools
This file has been truncated. show original
example_container_config.txt
# Template used to create this container: /data/data/com.termux/files/usr/share/lxc/templates/lxc-download
# Parameters passed to the template: --no-validate
# For additional config options, please look at lxc.container.conf(5)
# Uncomment the following line to support nesting containers:
#lxc.include = /data/data/com.termux/files/usr/share/lxc/config/nesting.conf
# (Be aware this has security implications)
# Distribution configuration
This file has been truncated. show original
There are more than three files. show original