Running Android on the Raspberry Pi
Android Pie meets Raspberry Pi
Chris Simmonds
FOSDEM 2019
Running Android on the Raspberry Pi 1 Copyright © 2011-2019, 2net Ltd
License
These slides are available under a Creative Commons Attribution-ShareAlike 4.0 license. You can read the full
text of the license here
[Link]
You are free to
• copy, distribute, display, and perform the work
• make derivative works
• make commercial use of the work
Under the following conditions
• Attribution: you must give the original author credit
• Share Alike: if you alter, transform, or build upon this work, you may distribute the resulting work only
under a license identical to this one (i.e. include this page exactly as it is)
• For any reuse or distribution, you must make clear to others the license terms of this work
Running Android on the Raspberry Pi 2 Copyright © 2011-2019, 2net Ltd
About Chris Simmonds
• Consultant and trainer
• Author of Mastering Embedded Linux Programming
• Working with embedded Linux since 1999
• Android since 2009
• Speaker at many conferences and workshops
"Looking after the Inner Penguin" blog at [Link]
@2net_software
[Link]
Running Android on the Raspberry Pi 3 Copyright © 2011-2019, 2net Ltd
Why?
• Porting Android to a dev board is a great way to learn about Android
• It’s a good testing ground for new ideas
• It’s fun! No, really it is!
Running Android on the Raspberry Pi 4 Copyright © 2011-2019, 2net Ltd
What do you need to run Android?
• Hardware from one of the supported architectures
• ARM, x86 or MIPS, in 32 or 64 bit varieties
• Has a recent version of Linux kernel (v4.4 or later)
• At least 512 MiB RAM
• At least 1 GiB flash storage - e.g. eMMC, SD card
• Touchscreen or external display - e.g. HDMI
• GPU with OpenGL ES 2.0 libraries (more about this later)
Running Android on the Raspberry Pi 5 Copyright © 2011-2019, 2net Ltd
Android on dev boards
DragonBoard, Hikey, BeagleBone, WandBoard, Raspberry Pi, Digi ConnectCore ...
Running Android on the Raspberry Pi 6 Copyright © 2011-2019, 2net Ltd
Why Raspberry Pi?
• It’s cheap
• Easy to get hold of
• Hackable
• Because it is there
Running Android on the Raspberry Pi 7 Copyright © 2011-2019, 2net Ltd
Hasn’t it been done already?
Sure! Here are some notable projects
• Android RPi: [Link]
• LineageOS: (unofficial build from KonstaKang)
[Link]
• RTAndroid: [Link]
tools:rtandroid
• based on research by Igor Kalkov, now merged into [Link]
• [Link]: [Link] (not open source)
• Android Things:
[Link]
(not open source)
Running Android on the Raspberry Pi 8 Copyright © 2011-2019, 2net Ltd
What do you need?
• A copy of the Android Open Source Project (AOSP)
• A Linux kernel with Android extensions
• A fair knowledge of the hardware
• All the help you can get from existing projects
• A fairly fast computer
• Time and patience
Running Android on the Raspberry Pi 9 Copyright © 2011-2019, 2net Ltd
AOSP and RPi
• What follows is based on Konsta’s port of LineageOS
• My version of the code is at
[Link]
• Challenges posed by the Raspberry Pi
• Graphics
• Lack of USB OTG port
Running Android on the Raspberry Pi 10 Copyright © 2011-2019, 2net Ltd
Graphics: OpenGL
• We need OpenGL ES 2.0 libraries with Android extensions
• Three options
• Get a copy of the OpenGLES binaries from the vendor, if they exist (they
don’t for Broadcom BCM2708/2835)
• Use Soft GPU, Swiftshader
• Use Mesa and drm_hwcomposer
Running Android on the Raspberry Pi 11 Copyright © 2011-2019, 2net Ltd
Graphics: Swiftshader
App 3-D graphics HWUI Surface Flinger
[Link].* 2-D graphics
[Link]
Framework OpenGLES libGLESv1_cm.so
[Link]
SwiftShader libEGL_swiftshader.so
HAL libGLESv1_CM_swiftshader.so
OpenGLES libGLESv2_swiftshader.so
FBDEV
Kernel
Running Android on the Raspberry Pi 12 Copyright © 2011-2019, 2net Ltd
Graphics: Mesa3d
App 3-D graphics HWUI Surface Flinger
[Link].* 2-D graphics
[Link]
Framework OpenGLES libGLESv1_cm.so
[Link]
mesa libEGL_mesa.so
HAL libGLESv1_CM_mesa.so
OpenGLES libGLESv2_mesa.so
drm_hwcomposer gralloc
libdrm
DRM
Kernel VC4
Running Android on the Raspberry Pi 13 Copyright © 2011-2019, 2net Ltd
ADB
• Raspberry Pi only has USB host ports, but ADB needs a USB
peripheral port
• Usually provided by a dual mode USB "On The Go" (OTG) port
• (Actually, the BCM283x has OTG hardware but it is used internally to
bridge the USB host controller, Ethernet, and so on)
• But, we can use ADB over Ethernet instead
$ adb connect [Link]
connected to [Link]
$
$ adb shell
rpi3:/ #
Running Android on the Raspberry Pi 14 Copyright © 2011-2019, 2net Ltd
Current status
• Code for Android for
Raspberry Pi is at https:
//[Link]/csimmonds/
a4rpi-local-manifest
• Android Pie 9.0 r 30
• Using Swiftshader
• Early stages: still many things to
do
Running Android on the Raspberry Pi 15 Copyright © 2011-2019, 2net Ltd
Delving deeper
• If you would like to discover more about building Android platforms,
visit [Link] and enquire about
training classes for your company
• 2net training is available world-wide
Running Android on the Raspberry Pi 16 Copyright © 2011-2019, 2net Ltd
Relevant links:
Android 4 RPi
[Link]
My web site
[Link]
Any questions?
Running Android on the Raspberry Pi 17 Copyright © 2011-2019, 2net Ltd