Saturday, December 6, 2014

[Book Review] Embedded Android

Embedded Android by Karim Yaghmour

The book starts with introduction chapter about the Android ecosystem and code licenses that are useful to know when developing a product that is going to be shipped.
The second chapter starts to explore the tools and the requirements you need to build the Android Open Source Project (AOSP) on your machine. The book then explains the Android concept from an app developer point of view describing also the lifecycle of the applications. The discussion then moves to the Android SDK and NDK as well as the linux kernel used by android and the related discussions about porting the modifications to the streamline kernel. Those paragraphs are really small and can be used as a starting point for reference and further investigation. From the linux kernel the author goes into deeper detail about the changes that Android introduced into the kernel and how to access the hardware APIs for each component of the system. It's worth mentioning that the author also describes differences for the various version of Android and the current edition covers up to Jelly Bean (Android 4.2). The boot process is then described together with the services that the kernel will start at boot time and the toolbox available on the target platform; the chapter is concluded with a discussion about the JNI and how the applications interacts with the services and system functions. Through this chapter you can find lots of tables and pictures explaining the relations within the components, libraries present on the system, services and so on.
The third chapter starts to get more practical. It will begin explaining how to obtain the AOSP source code and the tools needed to build it. The source code is decomposed in its main components and described before actually explain how to build it. At the end of the build process the created image is used to run on the android emulator. A paragraph explains how to run it and described all the options to master the emulator. Concluding this chapter there is a paragraph about the ADB (Android Debugger Bridge) tool that allows to retrieve information about the running system, execute commands, debugging and so on.
The forth chapter is about the build system. In this chapter the author explains in great detail how the build system works and how to modify it to do what you need. The chapter explores both the how to build and how to add your own modification such as libraries, tools, devices, etc to the produced AOSP image.
The fifth chapter moves to the hardware part of an embedded system. This chapter is more a description of what an embedded system and SOCs are and what are the main components of it.
The sixth chapter starts describing the native user-space system. The initial part of the chapter gives a overview of the filesystem and how it is structured. Most of the folders are described focusing on the ones mainly used by the applications. The chapter continues with some more commands for the ADB tool with attention to logging, remote debugging, filesystem operation and root access. After showing and exploring all the commands that are available from the adb shell,the init process for the user space application is described and explored to allow modification to it.
The seventh chapter talks about the Android Framework. The Android framework is the set of libraries and functionalities that are provided by AOSP after it has been built. The zygote and System services such as SurfaceFlinger. The discussion continues describing the apps that start to execute after the initialization process is near is end. A list of useful utility commands is also provided and a description of daemons supporting the system services is then provided.

Overall I found this book a really good reference for building and debugging android on an embedded system. Clear language and a lot of figures and tables to look complete the text providing a single reference for most of the questions related to the Android runtime and how to debug it. It also provides a lot of references to cover the topics that are not part of the book such as the SDK and NDK.