Difference between revisions of "Hybris"

From postmarketOS
Jump to: navigation, search
m (Test whether lxc-android works properly and kernel is correctly configured)
(Add xorg configuration)
Line 3: Line 3:
 
== Using libhybris with your device ==
 
== Using libhybris with your device ==
  
''This is a stub copied from chat messages in #postmarketOS. Please extend if you are porting your device to libhybris.''
+
=== Android system image ===
  
* convert the halium system.img to a mountable image (basically what the [https://github.com/Halium/halium-scripts/blob/master/halium-install#L41-L52 halium install script] does)
+
First thing to do is convert the halium generated '''system.img''' to a mountable image (basically what the [https://github.com/Halium/halium-scripts/blob/master/halium-install#L41-L52 halium install script] does)
* install postmarketOS on the device without user interface and copy the new system.img to the device, to <code>/var/lib/lxc/android/system.img</code>
+
and the new '''system.img''' to the device, to <code>/var/lib/lxc/android/system.img</code>
* install the hybris related packages:
+
 
 +
=== Install the hybris related packages ===
  
 
<syntaxhighlight lang="shell-session">
 
<syntaxhighlight lang="shell-session">
 
$ sudo apk add lxc-android \
 
$ sudo apk add lxc-android \
 
               xf86-video-hwcomposer \
 
               xf86-video-hwcomposer \
              xf86-video-hwcomposer-7.1-caf \
 
 
               libhybris \
 
               libhybris \
 
               libhybris-egl \
 
               libhybris-egl \
 
               libhybris-gles \
 
               libhybris-gles \
 
               libhybris-libwayland-egl \
 
               libhybris-libwayland-egl \
              libhybris-7.1-caf \
 
 
               wayland-libs-client \
 
               wayland-libs-client \
 
               wayland-libs-server
 
               wayland-libs-server
 
</syntaxhighlight>
 
</syntaxhighlight>
  
* start the service:
+
Depending if you need software which is built for Code Aurora Forum’s Android for MSM (generally nicknamed “CAF” for short):
 +
<syntaxhighlight lang="shell-session">
 +
$ sudo apk add libhybris-7.1-caf \
 +
              xf86-video-hwcomposer-7.1-caf             
 +
</syntaxhighlight>
 +
 
 +
For all the other devices:
 +
<syntaxhighlight lang="shell-session">
 +
$ sudo apk add libhybris-7.1 \
 +
              xf86-video-hwcomposer-7.1             
 +
</syntaxhighlight>
 +
 
 +
=== Start the android container ===
 
<syntaxhighlight lang="shell-session">
 
<syntaxhighlight lang="shell-session">
 
$ sudo rc-service lxc-android start
 
$ sudo rc-service lxc-android start
 +
</syntaxhighlight>
 +
 +
=== Configure Xorg ===
 +
 +
You need to create the <code>/etc/X11/xorg.conf.d/10-<device>.conf</code> with the following:
 +
<syntaxhighlight>
 +
Section "Device"
 +
  Identifier "Card0"
 +
  Driver "hwcomposer"
 +
EndSection
 
</syntaxhighlight>
 
</syntaxhighlight>
  

Revision as of 18:25, 5 December 2018

Libhybris allows devices lacking FLOSS drivers to make full use of their hardware by using the proprietary drivers from Android. Mainlining and using free software drivers is of course the better approach, but it is not possible for all devices. We will not list devices that need hybris as featured devices (see postmarketos.org#83).

Using libhybris with your device

Android system image

First thing to do is convert the halium generated system.img to a mountable image (basically what the halium install script does) and the new system.img to the device, to /var/lib/lxc/android/system.img

Install the hybris related packages

$ sudo apk add lxc-android \
               xf86-video-hwcomposer \
               libhybris \
               libhybris-egl \
               libhybris-gles \
               libhybris-libwayland-egl \
               wayland-libs-client \
               wayland-libs-server

Depending if you need software which is built for Code Aurora Forum’s Android for MSM (generally nicknamed “CAF” for short):

$ sudo apk add libhybris-7.1-caf \
               xf86-video-hwcomposer-7.1-caf

For all the other devices:

$ sudo apk add libhybris-7.1 \
               xf86-video-hwcomposer-7.1

Start the android container

$ sudo rc-service lxc-android start

Configure Xorg

You need to create the /etc/X11/xorg.conf.d/10-<device>.conf with the following:

Section "Device"
  Identifier "Card0"
  Driver "hwcomposer"
EndSection

Test whether lxc-android works properly and kernel is correctly configured

1) Ensure you installed the packages above, started the lxc-android service and checked that it's running

2) Download the Halium reference rootfs from bshah’s personal server: http://bshah.in/halium/halium-rootfs-20170630-151006.tar.gz

3) Extract to a temporary folder

4) Bind some folders into the halium rootfs

$ mount --bind /dev /tmp/halium-rootfs/dev
$ mount --bind /sys /tmp/halium-rootfs/sys
$ mount --bind /proc /tmp/halium-rootfs/proc
$ mount --bind /system /tmp/halium-rootfs/system
$ ln -s /system/vendor /tmp/halium-rootfs/vendor

5) Chroot into halium

$ chroot /tmp/halium-rootfs /bin/bash

6) Update

$ echo "deb http://repo.halium.org/caf xenial main" >> /etc/apt/sources.list.d/halium-caf.list
$ apt-get update
$ apt-get dist-upgrade

7) Test

$ EGL_PLATFORM=hwcomposer test_hwcomposer

See also