This talk explores the options when trying to bing up a device using an Android Board Support Package (BSP) or AOSP. In particular the options when you don't want to ship a traditional Android device or you have an existing Embedded Linux code base, but all you have available is Android. Headless can mean both be an Android without Java and a device without a display, both are discussed.
3. Patricia Aas
Vivaldi Technologies
Cisco Systems
Opera Software
Twitter: @pati_gallardo
Johan Herland
Cisco Systems
Opera Software
Git Dev Community
Twitter: @jherland
7. And why should you care?
Full Android
Using Google’s AOSP, or a more
customized Android Board Support
Package (BSP) from a chip vendor.
Embedded Linux
No Android parts.
Typically based on
glibc, busybox, etc.
9. Important questions
Do you have:
- Existing codebase?
- Upstream BSP?
- 3rd party dependencies?
What kind of device:
- Display?
- Single or multiple apps?
- Custom H/W?
11. Full Stack Android
- Java App ecosystem
- Graphics infrastructure
- Supported by modern SoCs
- Linux kernel w/Android features
- Libc : Bionic
Embedded Linux
- Stable/well-known components
- “Mix-and-match”
- C/C++ or web apps
- “Vanilla” kernel (or not...)
- Libc : GNU glibc
12. Bionic
- Developed specifically for Android
- Focus: small size and speed
- Compatibility:
- Almost all of C11 and POSIX
- Some GNU/BSD extensions
- C++ : “It’s complicated”
GNU glibc
- Used “everywhere”
- Focus:
- Application support
- Standards compliance
- Completeness
- Compatibility: Yes ☺
13. Platform Architecture - Embedded Linux
Linux kernel
Device drivers GNU glibc
Libraries (SSL, SQLite, etc.) System utils (systemd, busybox)H/W abstraction (OpenGL, alsalib, etc.)
Compositor (XServer, Wayland)
Application framework (Qt, GTK, Chromium)
Apps
Services/daemons (sshd, httpd)
Your application
22. No display
Multi app
Single app
Embedded LinuxFull stack Android Headless GlibcHeadless Bionic
Java app/service C/C++ app/service C/C++ app/daemon C/C++ app/daemon
No bionic dependencies
23. No display
Multi app
Single app
Embedded LinuxFull stack Android Headless GlibcHeadless Bionic
Java app/service C/C++ app/service C/C++ app/daemon C/C++ app/daemon
OpenWRT et al
24. Single full-screen app
Single-purpose device :
- Digital signage
- Kiosk-style device
- Videoconferencing endpoint
Needs Graphics Integration
No Complex Composition
25. No display
Multi app
Single app
Embedded LinuxFull stack Android Headless GlibcHeadless Bionic
Java app/service
One “home screen” app EGL Window/Framebuffer
C/C++ app/service C/C++ app/daemon C/C++ app/daemon
SurfaceFlinger/HWC SurfaceFlinger/HWC via
e.g. Hybris
Needs glibc/bionic bridge
for graphics integration
26. No display
Multi app
Single app
Embedded LinuxFull stack Android Headless GlibcHeadless Bionic
Java app/service
One “home screen” app EGL Window/Framebuffer
C/C++ app/service C/C++ app/daemon C/C++ app/daemon
SurfaceFlinger/HWC SurfaceFlinger/HWC via
e.g. Hybris
Cisco Sparkboard Cisco Spark Room Series
Cisco TelePresence MX/SX
Tesla Car OS?
OpenWRT et al
27. Multiple Apps
Consumer Device :
- Phone
- Tablet
- Smart TV
Needs App Store (e.g. Google Play)
Needs Complex Composition
28. No display
Multi app
Single app
Embedded LinuxFull stack Android Headless GlibcHeadless Bionic
Java app/service
One “home screen” app
App Store (Google’s Play
Store if CDD-compliant)
Multiple apps composited
by XServer/Wayland
EGL Window/Framebuffer
C/C++ app/service C/C++ app/daemon C/C++ app/daemon
Multiple apps composited
by SurfaceFlinger/HWC
via e.g. Hybris
Multiple apps composited
by SurfaceFlinger/HWC
SurfaceFlinger/HWC SurfaceFlinger/HWC via
e.g. Hybris
Needs glibc/bionic bridge
Needs complex composition
29. No display
Multi app
Single app
Embedded LinuxFull stack Android Headless GlibcHeadless Bionic
Java app/service
One “home screen” app
App Store (Google’s Play
Store if CDD-compliant)
Multiple apps composited
by XServer/Wayland
EGL Window/Framebuffer
C/C++ app/service C/C++ app/daemon C/C++ app/daemon
Multiple apps composited
by SurfaceFlinger/HWC
via e.g. Hybris
Multiple apps composited
by SurfaceFlinger/HWC
SurfaceFlinger/HWC SurfaceFlinger/HWC via
e.g. Hybris
Kindle Fire Boot2Qt (1st version) Sailfish (Jolla), Ubuntu Touch
Cisco Sparkboard Cisco Spark Room Series
Samsung Tizen, LG webOS
Cisco TelePresence MX/SX
Tesla Car OS?
OpenWRT et al
31. Composition
Need to get pixels on screen
- Compose just one window
with OpenGL
- Compose multiple windows
using external composer /
Hardware Composer
32. The Hardware Composer
Standardized Android porting
API for rendering to the screen.
Takes a set of surfaces and
composes them to the full frame
for the screen.
34. What is LibHybris?
Dynamically loads and links
bionic libc and bionic linked libs
into a glibc process
Gives access to the bionic libs in
a glibc process
Creator : Carsten Munk
35. Linux kernel (w/Android features: binder, wakelocks, etc.)
Headless Glibc Android using LibHybris
Your Compositor / GUI App
LibHybris
Bionic
SurfaceFlinger / HWC
OpenGL shared lib
GUI lib
GNU glibc
Other libs
36. A bionic GPU process?
Pipe GPU commands over a
local pipe to a bionic process
that does the composition.
37. Linux kernel (w/Android features: binder, wakelocks, etc.)
Headless Glibc Android using a Bionic GPU Process + IPC
GUI AppCompositor
GUI lib
GNU glibc
IPC-GL client
SurfaceFlinger / HWC
OpenGL shared lib
Bionic
IPC
Other libs
IPC-GL server
39. Composing With Chromium
- Single App : Single
fullscreen webapp
(e.g. Electron model)
- Multi App : Browser model,
several webapps composed
together
42. Existing Codebase
Porting to Java?
Porting from glibc to Bionic?
Rewrite to Android APIs?
What about other APIs you use?
- Do they exist in Android?
43. 3rd-party dependencies?
Port to Bionic? Really !?
Will upstream accept the port?
Remove deps if possible!
What about alternative deps?
Push towards glibc platform!
44. Bringup & Maintenance
Minimize custom hardware!
Decouple customizations from
upstream BSP/platform
Keep changes out of the BSP
- Above the Android APIs
- Or below user space
(kernel drivers, device tree)
46. Avoid patches when you can!
Minimize changes to the BSP itself
Decouple your changes from the guts of
Android
47. Structure your patches!
Patches across many different repos:
- Common scheme for maintenance
- Enumerate your current patchset
- Integrating new upstream release:
- Remove and Refresh
52. No display
Multi app
Single app
Embedded LinuxFull stack Android Headless GlibcHeadless Bionic
Java app/service
One “home screen” app
App Store (Google’s Play
Store if CDD-compliant)
Multiple apps composited
by XServer/Wayland
EGL Window/Framebuffer
C/C++ app/service C/C++ app/daemon C/C++ app/daemon
Multiple apps composited
by SurfaceFlinger/HWC
via e.g. Hybris
Multiple apps composited
by SurfaceFlinger/HWC
SurfaceFlinger/HWC SurfaceFlinger/HWC via
e.g. Hybris
Your code + 3rd-party
dependencies built
against Bionic
Your code +
3rd-party
dependencies
built against
glibc
Bionic / Glibc
bridge
needed for
graphics &
composition
53. No display
Multi app
Single app
Embedded LinuxFull stack Android Headless GlibcHeadless Bionic
Java app/service
One “home screen” app
App Store (Google’s Play
Store if CDD-compliant)
Multiple apps composited
by XServer/Wayland
EGL Window/Framebuffer
C/C++ app/service C/C++ app/daemon C/C++ app/daemon
Multiple apps composited
by SurfaceFlinger/HWC
via e.g. Hybris
Multiple apps composited
by SurfaceFlinger/HWC
SurfaceFlinger/HWC SurfaceFlinger/HWC via
e.g. Hybris