Plasma/Mobile/Porting
Current Architecture of Plasma Mobile
For ARM devices which requires Android binary blobs
- Kernel, either provided by vendor or thirdparty with config options enabled to support LXC containers
- AOSP/LineageOS base, built with core_tiny target, just base items
- LXC container with Neon/Ubuntu rootfs containing KWin/Wayland and Plasma Mobile
Kernel
Kernel needs to support the various config options, you can use lxc-checkconfig script provided by lxc userspace tools to check if all required features are enabled, for example:
% CONFIG=arch/arm64/configs/bullhead_defconfig lxc-checkconfig --- Namespaces --- Namespaces: enabled Utsname namespace: enabled Ipc namespace: enabled Pid namespace: enabled User namespace: enabled Network namespace: missing Multiple /dev/pts instances: enabled --- Control groups --- Cgroup: enabled Cgroup clone_children flag: enabled Cgroup device: enabled Cgroup sched: enabled Cgroup cpu account: enabled Cgroup memory controller: enabled Cgroup cpuset: enabled [..]
Below is the list of the config options,
CONFIG_CGROUP_DEVICE=y CONFIG_CPUSETS=y CONFIG_CGROUP_MEM_RES_CTLR=y CONFIG_CGROUP_PERF=y CONFIG_UTS_NS=y CONFIG_IPC_NS=y CONFIG_USER_NS=y CONFIG_PID_NS=y CONFIG_DEVPTS_MULTIPLE_INSTANCES=y
AOSP/LineageOS base
AOSP/LineageOS base should have all non-required things removed and some changes in base to accomodate needs of libhybris and container containing Linux system. Below is list of various changes,
Export PATH and LD_LIBRARY_PATH to point to lxc userspace tools
We use prebuilt lxc userspace tools from linux containers CI. Those are installed in /data partition which by default is not in the PATH android shell looks binaries into. Modify the system/core/rootdir/init.environ.rc file to include the path of LXC userspace tools in $PATH and export LD_LIBRARY_PATH.
project system/core/ diff --git a/rootdir/init.environ.rc.in b/rootdir/init.environ.rc.in index c32337a..9d91d60 100644 --- a/rootdir/init.environ.rc.in +++ b/rootdir/init.environ.rc.in @@ -1,6 +1,6 @@ # set up the global environment on init - export PATH /sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin + export PATH /data/lxc/lxc/bin:/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin export ANDROID_BOOTLOGO 1 export ANDROID_ROOT /system export ANDROID_ASSETS /system/app @@ -8,6 +8,7 @@ on init export ANDROID_STORAGE /storage export ASEC_MOUNTPOINT /mnt/asec export LOOP_MOUNTPOINT /mnt/obb + export LD_LIBRARY_PATH /data/lxc/lxc/lib export BOOTCLASSPATH %BOOTCLASSPATH% export SYSTEMSERVERCLASSPATH %SYSTEMSERVERCLASSPATH% export LD_PRELOAD libsigchain.so%TARGET_LDPRELOAD%
However, LD_LIBRARY_PATH doesn't work for AOSP based android image and needs investigation. See phabricator task for more details.
Disable enforced PIE executables in bionic
Disable SELinux
Remove the nosuid,nodev option from the data partition
Apply bionic patch to shift TLS slots
Fix Permission for backlight brightness file
For devices which don't require Android binary blobs
- Normal Linux system with kernel and drivers supporting Wayland
- KWin/Wayland and Plasma Mobile packages