Libhybris Let You Use Android Drivers & HW Libraries in Linux

Orange Pi Development Boards

One of the main issues with Linux on ARM is the lack of proper GPU drivers for the platform, as most silicon manufacturers now only focus on Android drivers which are not compatible with the Linux kernel, because Android is based on Bionic C library, whereas Linux is based on glibc or its variants. There are two ways to solve this issue:

  • Open Source GPU drivers. This would be the ideal solution, as you would just be able to cross-compile the drivers for the proper, as well as fix bugs without having to ask the silicon manufacturer to fix the driver for you.
  • Bionic to Glibc library. Such library acts like libdl, and allows to load Bionic library and overrides some symbols from bionic with glibc based ones. This is exactly what libhybris does.

Ubuntu Touch is capable of using Android GPU drivers to run Ubuntu thanks to this library, and Libhybris will provides the interface between the HAL and Mir display server for Ubuntu 14.04.

Libhybris is released under an Apache 2.0 license, and the source code, written in C, is available in github. This library is based on the initial work of .

There are 3 main directories in the source tree:

  • compat
    • ui – Some wrapper for Android UI.
  • hybris
    • common –  Common parts, including parsing /system/build.prop and matching common C functions (e.g. pthread*, str*…) between Bionic and glibc
    • egl – EGL support
    • gles2 – OpenGL ES 2 support
    • hardware – Loads /system/lib/libhardware.so
    • tests – Test programs for egl, gles2, lights, sensors, offscreen rendering, and ui
    • ui – Loads /system/lib/libui_compat_layer.so and creates bindings for the related functions.
  • utils –  Contains load_sym_files.py utility that loads symbol files for debugging.

Libhybris not only let you access the GPU, but also other hardware such as lights and sensors. I assume, but I may be wrong, that it could also be used with Wi-Fi and Bluetooth closed source drivers. Hopefully, work can also be done for VPU (Video Processing Unit) support in order to take advantage of hardware video decoding and encoding in Linux with Android libs, but I’m not knowledgeable enough to know if it’s feasible or not.

Using Libhybris is not an optimal solution, as there may be a small performance degradation, and you’ll be using the Android kernel, so many of the things you’d got used to with the Linux kernel won’t be available, and you’ll have to use the “Android” way. The implementation is not straightforward either, as Canonical’s Ubuntu Touch preview makes use of SurfaceFlinger which means applications relying on X11, GTK… will not work at the beginning, and you’ll have to wait until 2014 and and implementation with Mir display server to get a full solution based on libhybris with X11 compatibility. Nevertheless, even though libhybris is not a perfect solution, it’s a practical one, as it’s a technical solution, and not one which relies on convincing management and lawyers to release open source drivers.

There’s also some work on reverse-engineered open source GPU drivers such as the lima project, and some companies, e.g. Freescale / Vivante, release proper (closed-source) drivers for ARM Linux, but the company with the highest market share, namely Imagination Technologies, does not participate in any of those initiatives, and libhybris could become the way of the future, so most people may end-up using Android kernels on their ARM “Linux” distribution. Comments are welcome!

Leave a Reply

10 Comments on "Libhybris Let You Use Android Drivers & HW Libraries in Linux"

avatar
  Subscribe  
newest oldest most voted
Notify of
Sander
Guest

So this is like what NDISwrapper does for using WinXP-drivers on Linux?

trackback

[…] Gli interessati e gli addetti ai lavori potranno trovare ulteriori informazioni sulla suddetta libreria direttamente in questa pagina. […]

sky770
Guest

@Sander nah..NDISwrapper is something at more upper level..
it does not modify *anything* at the source code level rather it just acts as an “interface”.

On the other hand Libhybris is actually modifying compile time flags and some more stuff..in order to make android driver’s source “compatible” to be run on linux.

Paul
Guest

Yep, it’s pretty much like NDISwrapper in idea, so one may only wonder why it took so long to come up with it, and why it’s still so little known in the community. And there’s of course no need to wait for 14.04, just go port http://en.wikipedia.org/wiki/KDrive to run against libhybris (because full X.org is bloat) and enjoy your X.

Also, “Android” kernel doesn’t differ much from “Linux” kernel, not more than kernel of one Linux distro differs from another. Most things possible on “Linux” kernel certainly possible on “Android” kernel.

trackback

[…] PowerVR GPU in AllWinner A31 is another issue, as there won’t be Linux support, but thanks to libhybris, and the projects taking advantage of the library such as Ubuntu Touch / Mir display server, it […]

trackback

[…] may have heard about libhybris, a library that cleverly loads Android HW adaptations and convert calls from bionic to glibc. One […]

trackback

[…] may have heard about libhybris, a library that cleverly loads Android HW adaptations and convert calls from bionic to glibc. One […]

onebir
Guest

Any libhybris news lately?

trackback

[…] Linux for Rockchip RK3188 currently does not support Mali-400 GPU, so 2D and 3D hardware acceleration are both missing. This has already been done on RK3066 also featuring Mali-400MP4 GPU, and I don’t really understand which technical details make it difficult to implement, but it’s clearly a challenge or it would have happened already. On the positive side, lima packages should work on RK3188, and work will soon be done to try it out on Radxa board. In the meantime, if you think GPU support is important you can “+” Linuxium’s post on RK3188 GPU matter to make your voice heard, as well as to motivate voluntary developers. Having said that, it’s possible the lack of ARM SoC’s GPU support in Linux, at least Ubuntu, will disappear in April 2014 with the release of Ubuntu 14.04 because it can make use of Android kernel and drivers via libhybris. […]