Debugging the Android userspace¶
Debugging the Android userspace
lxc-android is the container in which the Android userspace is running. You can check that it is started with the following command:
systemctl status lxc@android
LXC needs some kernel config to make sure it runs correctly. Check that you have all the needed options by running the following command on the device:
All option except
User namespace need to be the green word enabled. If one of the options is a yellow missing or a red required, then you need to change the kernel config, rebuild hybris-boot and check the status again.
I was getting the following error, which I didn’t understand:
lxc-start: utils.c: mkdir_p: 254 Invalid argument - failed to create directory '/sys/fs/cgroup/net_cls//lxc/android'
It appears like LXC is expecting some functionality that doesn’t work yet in Linux 3.4. Counter-intuitively I had to disable the following functionalities in the defconfig to make it work:
Logcat is a tool that reads the Android user space logs. This includes all services that should be running in Halium. You can run it at any time with the following command:
For radio (Wi-Fi, GSM, LTE) logs, you can add a flag:
/system/bin/logcat -b radio
If you’re not able to run this command for any reason (for example, because you’re running an armhf rootfs on an arm64 device), you can try to run it inside the Android container via
lxc-attach -n android -- /system/bin/logcat
You may similarly use this to run any binary inside the Android system. Simply replace the command after the two dashes.
Even though Android logs do not normally end up in dmesg, early initialization of Android and kernel output ends up here:
Debug Libhybris crash¶
One of the main problems with the current Hybris based architecture, is the lack of symbols resolution and mapping once a crash happens at the Android layer. To workaround this we need to manuly import non stripped libaries
Add information for importing debug libhybris libraries.
Document how to deal with firmware partitions.
For example xLeEco Le Max2, codename “x2” has a firmware partition where the vendor blobs are stored. Initially lxc@android would not start. The resolution was roughly:
- no need for a vendor blobs repository in the manifest
- determine firmware partition name
- ensure fix-mountpoints takes it into account
- reflash android to ensure the blobs are in the partition
- reflash halium