Siduction Forum

Siduction Forum => Installation - Support => Installation Support (EN) => Topic started by: demailly on 2020/06/11, 21:37:42

Title: Suggestion of additional modules for the towo kernel
Post by: demailly on 2020/06/11, 21:37:42
Hi,
Some users might want to be able to install anbox to run android apk's on their linux boxes. This requires compiling 3 additional modules: binder_linux, ashmem_linux and xt_CHECKSUM.ko. The latter is no problem, but the standard kernel 5.6 or 5.7 only allows built-in compilation of  binder_linux, ashmem_linux, which would be a bit too much for people who don't need anbox.
Unfortunately, the dkms kernel modules do not compile any more with recent kernels, as a consequence of symbol "kallsyms_lookup_name" no longer being exported. To be able to compile in-tree modules , it seems that is sufficient to introduce 2 small patches, as explained
on https://docs.anbox.io/userguide/install_kernel_modules.html (https://docs.anbox.io/userguide/install_kernel_modules.html)
* debian_patches_debian_export-symbols-needed-by-android-drivers.patch
* debian_patches_debian_android-enable-building-ashmem-and-binder-as-modules.patch
(I could easily do this on my installation here, with experimental kernel 5.7.2).
So I would suggest this small addition to Torsten Wohlfahrt  for the next siduction kernels !
Best, JP Demailly
Title: Re: Suggestion of additional modules for the towo kernel
Post by: towo on 2020/06/14, 19:36:12
Patches are in the latest kernel in experimental, feel free to test and report, if anbox is working or not.
Title: Re: Suggestion of additional modules for the towo kernel
Post by: demailly on 2020/06/20, 17:43:29
Dear Torsten,

Apologies for the somewhat late testing !
I confirm that Anbox works with the recent kernels offering binder_linux & ashmem_linux as modules
(both the last experimental kernel and the newer  5.7.4-towo.1-siduction-amd64 work).
However, I still add to insmod  xt_CHECKSUM.ko  which is required by the script 'anbox-bridge.sh'. It turns out that the module I had compiled for an earlier version of the kernel could still be used for 5.7.4. But it would probably be better to also have xt_CHECKSUM.ko  be offered as a module - or find an ad hoc replacement for the iptables command that requires  the functions of xt_CHECKSUM.ko (those might very well have become obsolete for the iptables workflow).
Best,
Jean-Pierre
PS1. Here is the iptables call in anbox-bridge.sh :
iptables "${use_iptables_lock}" -t mangle -A POSTROUTING -o "${BRIDGE}" -p udp -m udp --dport 68 -j CHECKSUM --checksum-fill -m comment --comment "managed by anbox-bridge"

PS2. A strange fact is that it is impossible to rmmod  these modules once anbox has been used - the only way is to reboot. There might be a zombie process keeping them busy under the hood, but I could not find it (I didn't try much, admittedly).
Title: Re: Suggestion of additional modules for the towo kernel
Post by: towo on 2020/06/20, 20:47:03
The recent kernel now have CONFIG_NETFILTER_XT_TARGET_CHECSUM=m.
Title: Re: Suggestion of additional modules for the towo kernel
Post by: demailly on 2020/08/07, 09:18:54
Hi:
Many thanks again for the continued hard work on new kernels. As an anbox user, I noticed that the experimental kernel 5.8.0 does not include the binder_linux and ashmem_linux modules required by anbox. Of course, I can stick to 5.7.x (or eventually patch and recompile by myself) if there is any issue with kernel 5.8 in this respect.
Best, Jean-Pierre
Title: Re: Suggestion of additional modules for the towo kernel
Post by: towo on 2020/08/07, 09:31:10
Not true! I have switched to y instead of compile as module!

Code: [Select]
~/source/kernel/5x/5.8/linux-siduction/debian/config
towo:newdev> egrep -i "binder|ashmem" config
CONFIG_ASHMEM=y
CONFIG_ANDROID_BINDER_IPC=y
CONFIG_ANDROID_BINDERFS=y
CONFIG_ANDROID_BINDER_DEVICES="binder"
# CONFIG_ANDROID_BINDER_IPC_SELFTEST is not set

Title: Re: Suggestion of additional modules for the towo kernel
Post by: demailly on 2020/08/07, 14:25:08
Apologies - I just checked for the modules, but didn't look at the kernel configuration !
Unfortunately, for a reason that I still have to investigate, my anbox setup does not
work any more with kernel 5.8 (which is also the reason why I believed that binder
and ashmem were not there.) Rebooting to 5.7.13 solves the issue.


I'll keep you updated if I find an explanation for this behavior. (One possible reason
would be that the patch allowing to compile binder_linux and ashmem_linux as
modules also affects the way things work, but that seems a bit strange...)


Best, Jean-Pierre
Title: Re: Suggestion of additional modules for the towo kernel
Post by: demailly on 2020/08/08, 10:03:02
Hi:
I have recompiled the kernel by preceding the siduction patches with the two Debian patches allowing to compile binder_linux and ashmem_linux as modules (and which have just been ported to 5.8), namely

https://salsa.debian.org/kernel-team/linux/blob/master/debian/patches/debian/android-enable-building-ashmem-and-binder-as-modules.patch

https://salsa.debian.org/kernel-team/linux/blob/master/debian/patches/debian/export-symbols-needed-by-android-drivers.patch

There was only a minor collision "patch already applied" for a couple of apparentlly unessential things. The kernel and modules compiled fine, and now anbox works.  That's definitely not a clear explanation of what happens, but it does appear that the additional two patches are useful, at least for my anbox setup.

Best, Jean-Pierre
Title: Re: Suggestion of additional modules for the towo kernel
Post by: demailly on 2020/08/08, 10:08:05
Post-Scriptum : the relevant part of my config is


#
# Android
#
CONFIG_ASHMEM=m
# CONFIG_ION is not set
# end of Android

...


#
# Android
#
CONFIG_ANDROID=y
CONFIG_ANDROID_BINDER_IPC=m
# CONFIG_ANDROID_BINDERFS is not set
CONFIG_ANDROID_BINDER_DEVICES="binder"
# CONFIG_ANDROID_BINDER_IPC_SELFTEST is not set
# end of Android