site  contact  subhomenews

Kernel 5.15.74 compiled with Android drivers

October 18, 2022 — BarryK

There was a request to run Anbox on EasyOS. Well, EasyShare ("share" icon on the desktop) can display an Android screen in Linux, connected via USB. That works really well; however, I can see that running some apps natively in EasyOS might be useful -- for example, I have an Android password manager.

There has been a lot of investigation of Anbox in the Puppy Forum, for example this thread started by 'bigpuppyfan':

https://forum.puppylinux.com/viewtopic.php?t=2517

Another contender is Waydroid, which looks like it might be more up-to-date. Homepages:

https://anbox.io/

https://waydro.id/

There are two kernel drivers needed, 'binder_linux' and 'ashmem_linux', and these are in the kernel source. However, they can only be builtin, not as modules. There are apparently some issues to have them builtin, so there are two patches available to enable building them as modules.

Debian maintains these patches here:

https://salsa.debian.org/kernel-team/linux/-/tree/bullseye/debian/config

I applied them and configured the kernel:

> Device Drivers > Android ───────────────────────────────────────────────────────────────────── 
┌───────────────────────────────────────── Android ─────────────────────────────────────────┐
│ Arrow keys navigate the menu. <Enter> selects submenus ---> (or empty submenus ----). │
│ Highlighted letters are hotkeys. Pressing <Y> includes, <N> excludes, <M> modularizes │
│ features. Press <Esc><Esc> to exit, <?> for Help, </> for Search. Legend: [*] built-in │
│ [ ] excluded <M> module < > module capable │
│ ┌───────────────────────────────────────────────────────────────────────────────────────┐ │
│ │ [*] Android Drivers CONFIG_ANDROID │ │
│ │ <M> Android Binder IPC Driver CONFIG_ANDROID_BINDER_IPC │ │
│ │ [*] Android Binderfs filesystem CONFIG_ANDROID_BINDERFS │ │
│ │ (binder,hwbinder,vndbinder) Android Binder devices CONFIG_ANDROID_BINDER_DEVICES
│ │ [ ] Android Binder IPC Driver Selftest (NEW) │ │
│ │ │ │

And:

> Device Drivers > Staging drivers > Android ─────────────────────────────────────────────────── 
┌───────────────────────────────────────── Android ─────────────────────────────────────────┐
│ Arrow keys navigate the menu. <Enter> selects submenus ---> (or empty submenus ----). │
│ Highlighted letters are hotkeys. Pressing <Y> includes, <N> excludes, <M> modularizes │
│ features. Press <Esc><Esc> to exit, <?> for Help, </> for Search. Legend: [*] built-in │
│ [ ] excluded <M> module < > module capable │
│ ┌───────────────────────────────────────────────────────────────────────────────────────┐ │
│ │ <M> Enable the Anonymous Shared Memory Subsystem CONFIG_ASHMEM │ │

However, got these compile errors:

Kernel: arch/x86/boot/bzImage is ready  (#1)
LDS scripts/module.lds
MODPOST modules-only.symvers
ERROR: modpost: "init_ipc_ns" [drivers/android/binder_linux.ko] undefined!
ERROR: modpost: "put_ipc_ns" [drivers/android/binder_linux.ko] undefined!
ERROR: modpost: "close_fd_get_file" [drivers/android/binder_linux.ko] undefined!

So, I created another patch to export those symbols, and this time success. Here are the three patches, applied in this order:

android-enable-building-ashmem-and-binder-as-modules.patch.gz
export-symbols-needed-by-android-drivers.patch.gz
2-export-symbols-needed-by-android-drivers.patch.gz

Note, ashmem is deprecated, removed from the 5.18 kernel; however, Anbox and Waydroid, as far as I know, have not yet migrated to working without ashmem.

Hopefully I have configured and patched the kernel properly, so that those modules work. Haven't tested them. That will be a future project, to get Anbox or Waydroid running. Another item from my reading: it seems Anbox uses Android 7, Waydroid uses Android 10. This kernel will be in the next release of EasyOS.       

Tags: easy