Porting Android to the PowerPC architecture
Android OS is quietly making inroads into embedded industrial applications, moving beyond its ubiquitous presence in mobile communications to the rugged surroundings of heavy industry, which means exposure to water, chemicals, temperature variations, heat and other stress factors. However, a migration to industrial settings is only possible by porting Android to suitably identified hardware components such as PowerPC, which is widely used in embedded and high-performance computing platforms. For technical teams that are working on hardware and embedded engineering projects and would like to port Android on PowerPC, this article offers some basic guidance on porting Android. It is expected that the audience is already familiar with Linux tools and build environment and the Android framework, file system, Linux kernel, and the like.
Although the idea of using touchscreens in industrial settings isn’t new, the porting procedure is far from straightforward when it comes to Android OS. To begin with, there are communication interfaces (I/O) in the PowerPC platform, which has, by and large, no Android support because the OS was primarily designed for smartphones and tablets. In fact, Google has very limited support for this platform.
With one of our recent project successes, eInfochips became the first company in the world to port Android 4.4 to the PowerPC architecture on behalf of an aerospace client that will use it for engine health monitoring (EHM). EHM data is important to aircraft primes and airline companies but usually they don’t have direct access to it. The client, a leading engine manufacturer in aerospace, wanted to democratize this by giving access to engine data through an open platform for them to perform engine health management independently.
This project was implemented on the XPedite 6101 evaluation board from X-ES Inc. which contains the Freescale T1042 processor, 8GB DDR3, 4GB NAND Flash. Since PowerPC-Android conjunction has not been attempted that frequently before, technical information and support on this project is barely available.
The porting was achieved through the following essential steps:
Step-1: Kernel modifications for XPedite 6101 board and Android platform
Step-2: Toolchain development for PowerPC platform
Step-3: Android Open Source Project (AOSP) modifications for PowerPC platform
A more detailed project flow is depicted in Fig.1.
Figure 1: Step-by-step procedure depicting Android porting on PowerPC (Source: eInfochips)
Generating executables for native codes was done using two primary methods. First, using Android Run Time (ART) and second through Dalvik Virtual Machine (DVM). Both these methods work in two ways: fast interpreter mode and portable mode. Google has developed its own interpreter for ARM, x86 etc for fast interpreter mode, whereas PowerPC interpreter is not readily available.
Now, to support PowerPC architecture, portable mode can be used with open source libffi for interpretation, which was subsequently used in our project. As Google doesn’t provide any technical support for ART portable mode, we chose DVM portable mode. DVM portable mode is available in Android KitKat version 4.4.4 with the support of GCC version 4.7 but for PowerPC, GCC 5.2 was used. Also, Android KitKat uses Linux 3.4 but the XPedite Board BSP patch has been developed for Linux 3.12.19. The final choice was to use Kernel 3.12.19.
Figure 2: A stack overview of applications over Android framework. (Source: eInfochips)
Step 1: Kernel modifications for XPedite 6101 board and Android platform
The Android platform is based on Linux but with some modifications to standard Linux kernel, along with a few Android-specific drivers. Android kernel has many additional enhancements like alarm driver, Android shared memory driver, binder driver for inter process communication (see Figure 2), power management, low memory killer, kernel debugger and logger. In order to make Android porting a real possibility, all these kernel enhancements have to be essentially added as contributions in the open source community under the GNU Public License. Linux Kernel 3.12.19 was made Android-ready by putting updates at various driver levels.
Figure 3: Some of the changes made to Linux Mainline Kernel to make it Android-ready for mainline community. (Source: eInfochips)
Initially, mainstream Linux Kernel 3.12.19 was downloaded followed by applying XPedite 6101 Board BSP patch on the Kernel. Further to make it pass as an Android kernel, the Android patch was applied. Later the procedure was followed by installing the toolchain available in the BSP patch package. The uImage was created after building the kernel.