Sei sulla pagina 1di 15

Embedded Systems Virtualization Services by Virtual Open Systems - Android ICS on Fast Models

Android Ice Cream Sandwich on Fast Models

A quick guide for utilizing the latest version of the Android OS on Cortex-A15 Fast Models
Author: Updated: Contacts: Alexander Spyridakis, Virtual Open Systems on 2012-04-18 Tel +33 09 63 54 99 49, Email contact@virtualopensystems.com

Sarl Virtual Open Systems - Registered at 529 212 987 RCS Grenoble - www.virtualopensystems.com - Page 1/15 -

Embedded Systems Virtualization Services by Virtual Open Systems - Android ICS on Fast Models

Summary
1 Introduction 2 KVM for ARM 2.1 Requirements 2.2 Cortex-A15 2.3 big.LITTLE 3 Versatile Express 3.1 Platform Overview 3.2 Peripheral Components 4 ICS Android & ARM Fast Models 4.1 Fast Models 5 Android host and booting a guest 5.1 Compiling the kernel 5.2 Userland and simulation execution 5.3 Booting on big.LITTLE 5.4 Running a guest OS 5.5 Limitations 6 Future work & References 6.1 References 7 About Virtual Open Systems Golden Guides 8 About Virtual Open Systems 8.1 Virtual Open Systems Android-Virtualization Services 3 4 4 4 5 6 7 7 8 9 10 10 10 11 12 13 13 14 15 15 15

Sarl Virtual Open Systems - Registered at 529 212 987 RCS Grenoble - www.virtualopensystems.com - Page 2/15 -

Embedded Systems Virtualization Services by Virtual Open Systems - Android ICS on Fast Models

1 Introduction
The advent of tablets and smartphones has revolutionized the mobile market. Currently, many of the ARM-based (Advanced RISC Machine) tablet and smartphone products are running the Android software. With the newly released version of Android, the Ice Cream Sandwich, Google unifies tablets and mobile devices, by incorporating the 1 Honeycomb features and various enhancements into the new OS . In addition, during 2012 it is expected a new generation of tablet and mobile products based on ARM Cortex-A15 MPCore. This processor is a multicore ARM architecture providing an out-of-order superscalar pipeline ARM v7 instruction set running at up to 2.5 GHz. The cortex-A15 is the first ARM processor supporting the hardware virtualization extensions and the Large Physical Address Extensions (LPAE). With these features, ARM cortex A15 is suitable either for consumer market or for lightweight server tasks, like running a web server, and in a micro-server configuration for cloud computing. In this context, Virtualization is an ubiquitous technology in enterprise data-centers and cloud computing infrastructures. Virtualization introduces one level of indirection between logical and physical context. Such indirection has proven to be remarkably powerful and efficient. In modern platforms for consumer and server markets, this indirection is used in numerous ways. For instance in an hypervisor, a software layer that decouples an operation system and its applications from the real hardware, or in a virtual machine (VM) that is a software layer emulating a hardware platform. In order to start software development for modern platforms based on cortex-A15 that use virtualization technologies ahead of real platforms, it is possible to provide a virtual representation of the hardware platform. Using technologies such as the ARM Fast Models, software developers can capture different application scenarios quite in advance compared to the availability of real hardware. Thus Fast Models can help software engineers to debug, to optimize and to analyze applications and middleware environments, such as Android. In this document we will describe how to completely boot the Android Ice-Cream-Sandwich (ICS) on Fast Models. For the purpose of this guide, the Cortex-A15 Versatile Express hardware platform has been chosen.

Sarl Virtual Open Systems - Registered at 529 212 987 RCS Grenoble - www.virtualopensystems.com - Page 3/15 -

Embedded Systems Virtualization Services by Virtual Open Systems - Android ICS on Fast Models

2 KVM for ARM


KVM (Kernel-based Virtual Machine) is an open-source hypervisor, used extensively for achieving full hardware virtualization (and optionally paravirtualization 2). KVM relies on the Linux kernel process and memory management features, to handle Virtual Machines. Instead of performing emulation by itself, it needs a user space program (e.g. QEMU) to set up guest VM address space and map devices 3. KVM can take advantage of specific CPU hardware extensions, such as Intel VT, AMD-V and ARM to optimize and to accelerate the virtualization process. The Cortex-A15 is the first ARM processor using the hardware virtualization extensions, for which KVM needs to be ported 4. Virtual Open Systems is already actively developing the KVM port for the latest multicore ARM processor, such as the Cortex-A15 SMP and big.LITTLE 5.

2.1 Requirements
The following requirements will either be described or provided, for successfully completing this guide: Installation and setup of the simulation platform. ARM Fast Models simulator is needed to generate a Cortex-A15 Versatile Express model. An Android-ready Linux kernel. We provide a pre-compiled kernel which will boot Android on our simulation platform. The Android ICS OS userland files. Pre-compiled AOSP binaries (v4.0.3) to boot the host OS. QEMU and a guest OS. Utilize QEMU in conjunction with KVM to boot a guest OS under Android.

2.2 Cortex-A15
The new Cortex A15 MPCore processor, is the first in the ARM A series to introduce hardware virtualization, 6 together with increased performance (up to 40% faster than A9) and the standard ARM low power requirements . Full Hardware Virtualization Large Physical Address Extensions (LPAE) VFPv4 Floating point NEON Advanced SIMD 1-4X SMP within a single processor cluster, up to 2 clusters per chip

Sarl Virtual Open Systems - Registered at 529 212 987 RCS Grenoble - www.virtualopensystems.com - Page 4/15 -

Embedded Systems Virtualization Services by Virtual Open Systems - Android ICS on Fast Models

Cortex-A15 block diagram

2.3 big.LITTLE
big.LITTLE 7 is the synergy of the powerful Cortex-A15 processor and the energy efficient Cortex-A7, for the purpose of achieving power critical use cases and offering drastic performance gains when needed. Cortex-A7 is feature and architecturally identical with Cortex-A15 but with the best power to performance ratio ever seen in an ARM processor. The low power requirements of Cortex-A7 are mostly related to its reduced pipeline compared to Cortex-A15. To lower even further the power profile of the system, each core has its own Level 2 cache memory. While sharing an L2 cache would be a more area optimized design, integration of an L2 cache on each processor, yields better power results. The first use model of the big.LITTLE system is task migration to Cortex-A15 when performance is critical, while execution of simpler tasks must be done on Cortex-A7 for low power operation. Another option is utilizing both clusters for an AMP (asymmetrical multiprocessing) setup.

Sarl Virtual Open Systems - Registered at 529 212 987 RCS Grenoble - www.virtualopensystems.com - Page 5/15 -

Embedded Systems Virtualization Services by Virtual Open Systems - Android ICS on Fast Models

big.LITTLE system overview

3 Versatile Express
The Versatile Express family of development platforms provides the right environment for prototyping the next generation of system-on-chip designs. Thanks to its flexible, modular architecture, and high-speed interfaces, hardware and software applications can be developed and debugged quickly and efficiently.

Versatile Express Block Diagram


Sarl Virtual Open Systems - Registered at 529 212 987 RCS Grenoble - www.virtualopensystems.com - Page 6/15 -

Embedded Systems Virtualization Services by Virtual Open Systems - Android ICS on Fast Models

3.1 Platform Overview


The platform consist of three main blocks: Motherboard: Consists of several peripherals and the optional addition of plug-in daughter boards. CoreTile: CPU block supporting Cortex-A15, Cortex-A9 and Cortex-A5 processors. LogicTiles: Optional daughter board blocks for the purpose of enhancing the usability of the platform, granting various customizable features.

Versatile Express diagram

3.2 Peripheral Components


Some of the major peripheral components of the Versatile Express platform are 8: PL011 Uart (serial communication) Telnet Terminal PL031 Real Time Clock PS2 Mouse & Keyboard PL111 Color LCD (software rendering, no GPU) MultiMedia Card interface
Sarl Virtual Open Systems - Registered at 529 212 987 RCS Grenoble - www.virtualopensystems.com - Page 7/15 -

Embedded Systems Virtualization Services by Virtual Open Systems - Android ICS on Fast Models

SP804 Timer SP805 Watchdog timer PL390 Generic Interrupt Controller SMSC91C111 Ethernet Controller PL041_AACI audio interface (partially implemented)

4 ICS Android & ARM Fast Models


As described in the official documentation, Android 4.0 (Ice Cream Sandwich) is the latest version of the Android platform for various devices, including but not limited to mobile phones, tablets and net-books. It continues to advance and optimize things people love most about Android easy multitasking, rich notifications, customizable home screens, sizable widgets, and deep interactivity and adds powerful new ways of communicating and sharing. Android consists of a multi level architecture based on top of a customized Linux kernel. Middleware and libraries are written in C, while application software is utilizing a Java compatible framework. It also includes the Dalvik virtual machine, which enables further optimizations by just-in-time compilation of Java bytecode. Main Android features: Application framework (Java compatible) Dalvik Virtual Machine (JIT compilation) Rich development environment (device emulator, debugging, profiling etc.) Linux kernel (hardware drivers, networking, file system access etc.)

Android system architecture

Sarl Virtual Open Systems - Registered at 529 212 987 RCS Grenoble - www.virtualopensystems.com - Page 8/15 -

Embedded Systems Virtualization Services by Virtual Open Systems - Android ICS on Fast Models

4.1 Fast Models


The model of the hardware platform that we use in the simulator is that of the Versatile Express platform, together with a Cortex-A15 core tile. As the name suggests, ARM provides this product family for the development of flexible and modular prototyping systems 9. To install and setup Fast Models (version 7), it is advised to follow the installation procedure in chapter 2 of of Virtual Open Systems KVM-on-ARM guide. Additionally, it is recommended to choose a 32 bit build configuration even if using Fast Models on a 64 bit system, due to slightly better performance. For example, under Select Active Project Configuration, choose Linux-Release-GCC-4.1 instead of Linux64-Release-GCC-4.1.

Tip
Build a static version of the model Optionally, the user can choose to build a static version of the model by selecting the Integrated simulator (ISIM system) check-box option in the "Targets" tab, under Settings. This will create an isim_system executable that can be used directly, instead of loading the cadi_system library under model shell.

Fast Models offers a range of processors and platforms to simulate. On this guide we will mainly focus on the Versatile Express platform, with Cortex-A15 and the Cortex-A15 + Cortex-A7 system, also known as big.LITTLE. For performance reasons, on big.LITTLE models it is important to disable the cache_state_modelled parameter on System Canvas, before compiling the simulator. To do that, right click on the top-level coretile component and select properties. From there uncheck the property cache_state_modelled. Do the same for the CCI400 sub-component located inside the coretile. The following models can be used for this guide: RTSM_VE_Cortex-A15x1 RTSM_VE_Cortex-A15x2 RTSM_VE_Cortex-A15x4 RTSM_VE_Cortex-A15x1-A7x1 RTSM_VE_Cortex-A15x4-A7x4

Sarl Virtual Open Systems - Registered at 529 212 987 RCS Grenoble - www.virtualopensystems.com - Page 9/15 -

Embedded Systems Virtualization Services by Virtual Open Systems - Android ICS on Fast Models

5 Android host and booting a guest


Google has made significant changes to the Linux Kernel that are still not present in the upstream vanilla version. The Android OS is heavily dependent on these additions and to fully boot our system, we need a kernel with the Android patch set applied to it. In this guide we will use a pre-compiled kernel based on the kvm-a15-v7 branch of the Virtual Open Systems KVM-on-ARM Linux repository. The kernel used includes the Android kernel modification, KVM, Large Physical Address Extensions (LPAE) and support for the new Cortex-A15 processor. Download the kernel:

$ wget http://www.virtualopensystems.com/media/android/uImage

Then the boot-wrapper:

$ wget http://www.virtualopensystems.com/media/android/linux-system-semi.axf

5.1 Compiling the kernel


Fortunately, starting from kernel v3.3, there is an ongoing effort to mainline the Android related modifications . For the time being the Android staging drivers are back, with a fully planned integration on the upcoming v3.4. As a result of this, only a minimal and considerably less complex patchset is required to fully boot Android. If you want to compile the kernel yourself, you must apply the provided Android patchset against the kvm-a15-v7 branch and configure it with the correct configuration. Get the Android patchset:
10

$ wget http://www.virtualopensystems.com/media/android/android-kvm-a15-v7.patch

As well as the kernel configuration:

$ wget http://www.virtualopensystems.com/media/android/.config

Put them both in the kernel source code directory and run:

$ patch -p1 -u < android-kvm-a15-v7.patch $ CROSS_COMPILE=arm-unknown-eabi- ARCH=arm make

For a more detailed process of compiling the kernel, consult our previous KVM-on-ARM guide on chapter 3.

5.2 Userland and simulation execution


First, we need to download the Android userland files:

$ wget http://www.virtualopensystems.com/media/android/ics_ve_4.0.3.tar.gz

Then, create an image file and format it as an ext3 filesystem:

Sarl Virtual Open Systems - Registered at 529 212 987 RCS Grenoble - www.virtualopensystems.com - Page 10/15 -

Embedded Systems Virtualization Services by Virtual Open Systems - Android ICS on Fast Models

$ dd if=/dev/zero of=./disk.img bs=1MiB count=256 $ mkfs.ext3 ./disk.img

Finally, mount the image file and extract the userland files in it:

$ $ $ $

mkdir mnt sudo mount -o loop disk.img mnt sudo tar -C mnt -xf ics_ve_4.0.3.tar.gz sudo umount mnt

We are now able to start the simulator and boot our system with the following command:

$ ./isim_system \ -a cluster.cpu0=linux-system-semi.axf \ -C motherboard.vis.rate_limit-enable=0 \ -C motherboard.mmc.p_mmc_file="disk.img" \ -C cluster.cpu0.semihosting-cmd_line="--kernel uImage -- console=ttyAMA0 mem=512M mem=512@0x880000000 root=/dev/mmcblk0 rw androidboot.console=ttyAMA3 init=/init"

Upon booting click the upper right corner in the CLCD display to open the Android main menu.

5.3 Booting on big.LITTLE


On big.LITTLE, we will use ARM's Virtualizer/Switcher that allows stable context switching between the two available clusters, or utilization of both clusters in an AMP setup. The Virtualizer sits on top of the payload (Linux kernel + Android), in a completely transparent way for the OS. Beyond the task migration capabilities, the Virtualizer makes sure to completely abstract any differences between A15 and A7 to the running application.

Sarl Virtual Open Systems - Registered at 529 212 987 RCS Grenoble - www.virtualopensystems.com - Page 11/15 -

Embedded Systems Virtualization Services by Virtual Open Systems - Android ICS on Fast Models

It should be noted though that due to the nature of the Virtualizer, it is currently in conflict with KVM. Both of them utilize specific Hypervisor calls and registers of the virtualization extensions, disallowing simultaneous usage of the two for the time being. Download the bootwrapper + Virtualizer:

wget http://www.virtualopensystems.com/media/android/biglittle_switcher.zip unzip biglittle_switcher.zip

And finally run the big.LITTLE model with the same kernel for A15:

$ ./isim_system \ -a coretile.cluster0.cpu0=biglittle_switcher.axf \ -C motherboard.vis.rate_limit-enable=0 \ -C motherboard.mmc.p_mmc_file="disk.img"

As soon as the model starts, you will notice the virtual LEDs in the upper part of the CLCD view, blinking at around 120 million instructions. This blinking activity represents the task migration between the two clusters. Similar behaviour can be seen in the instruction counters of the clusters. Virtual Open Systems has extended the functionality of the virtualizer, to allow selection between AMP or SMP (switching) mode during the instantiation of the big.LITTLE model, avoiding the need of recompiling. In AMP mode the cluster switcher is suppressed at boot time and the payload sees a single cluster with double the amount of cores. To enable AMP functionality, add the following parameter when starting the model:

-C coretile.dualclustersystemconfigurationblock.CFG_ACTIVECLUSTER=3

5.4 Running a guest OS


Now that the Android host is fully operational, we can utilize QEMU to load a guest OS. Detailed instructions on how to compile QEMU, can be found in Chapter 4.2 of the KVM-on-ARM guide. The only additional requirement in this case, is to add the --static argument while configuring QEMU.

Tip
Boot the guest with initrd It is advised to boot the guest with initrd (ramdisk) and not MMC. Due to performance issues, initrd booting is several times faster than MMC.

To create the initrd for the guest, you need to execute as root:

$ $ $ $ $ $

mkdir mnt1 mnt2 sudo mount -o loop filesystem_bin_alip-ael-armv7-thumb-min-debug.cramfs mnt1 sudo cp -a ./mnt1/* ./mnt2/ cd ./mnt2 sudo ln -s sbin/init init find ./ | cpio -o -H newc | gzip > ./initrd.cpio.gz

Sarl Virtual Open Systems - Registered at 529 212 987 RCS Grenoble - www.virtualopensystems.com - Page 12/15 -

Embedded Systems Virtualization Services by Virtual Open Systems - Android ICS on Fast Models

Alternatively, the Android userland files already include properly pre-compiled binaries of QEMU, a guest kernel and the initrd of a BusyBox filesystem. To run the guest OS simply execute the following commands from the open terminal of the Android host:

$ cd /root $ ./start_qemu.sh

5.5 Limitations
The main limitation of the system is the absence of a GPU. Any output to the frame buffer must be rendered from the CPU, wasting valuable simulation cycles in an already performance degraded system. This behavior can be exaggerated by the bootanimation service. When booting, the default animated Android logo can seize up to 90% of the CPU. Replacing it with a static image (as in our case), will drop CPU utilization near 0%, making the boot process much faster. The current known limitations include: Due to software rendering, performance is sub-par. Sound doesn't work, because the PL041_AACI audio interface is partially implemented. There is no USB support in Fast Models, thus some applications refuse to work without it. Currently, QEMU can be operated only in a terminal. This limitation prohibits guests with a GUI.

6 Future work & References


To enhance the usability and performance of Android on Fast Models, additional extensions can be taken into account in near future: General userland tweaks and optimizations, in order to completely remove unused services from the OS. Things like bluetooth, the radio interface layer, etc. (minor gains) Mitigate the current limitation of graphic-less guests. Improve frame buffer rendering.

Sarl Virtual Open Systems - Registered at 529 212 987 RCS Grenoble - www.virtualopensystems.com - Page 13/15 -

Embedded Systems Virtualization Services by Virtual Open Systems - Android ICS on Fast Models

6.1 References
1 2 3 Introducing Android 4.0: http://www.android.com/about/ice-cream-sandwich/ Paravirtualized drivers for KVM: http://www.linux-kvm.org/page/Virtio Kernel-based Virtualization with KVM: http://www.linux-magazine.com/w3/issue/86/Kernel_Based_Virtualization_With_KVM.pdf Cortex-A15 Processor: http://www.arm.com/products/processors/cortex-a/cortex-a15.php Virtual Open Systems KVM repository: https://github.com/virtualopensystems/linux-kvm-arm Cortex-A15 Technical Reference Manual: http://infocenter.arm.com/help/topic/com.arm.doc.ddi0438c/DDI0438C_cortex_a15_r2p0_trm.pdf big.LITTLE White Paper: http://www.arm.com/files/downloads/big_LITTLE_Final_Final.pdf Versatile Express platform: http://www.arm.com/products/tools/development-boards/versatile-express/index.php ARM Fast Models: http://infocenter.arm.com/help/topic/com.arm.doc.dui0423l/DUI0423L_fast_model_rm.pdf

4 5 6

7 8 9

10 Bringing Android closer to the mainline: http://lwn.net/Articles/472984/

Sarl Virtual Open Systems - Registered at 529 212 987 RCS Grenoble - www.virtualopensystems.com - Page 14/15 -

Embedded Systems Virtualization Services by Virtual Open Systems - Android ICS on Fast Models

7 About Virtual Open Systems Golden Guides


Virtual Open Systems is an open source minded company, believing in and operating for open and unchained continuous progress and innovation. Sharing technical guides on different software technologies is a way for Virtual Open Systems to contribute in accelerating and stimulating developments from open source communities and private third parties, while building relationships with companies sharing similar technical fast innovation targets. Virtual Open Systems technical guides are continuously improved and optimized to take into account new related patches by developers from Virtual Open Systems, linux, kvm, android open source communities. To be alerted by Virtual Open Systems on new KVM-on-ARM, Android-Virtualization technical guide developers can subscribe by simply dropping an email to contact@virtualopensystems.com with name, affiliation and email. Alert messages will be sent by Virtual Open Systems for any new technical guide submission and update.

8 About Virtual Open Systems


Virtual Open Systems is an innovative and dynamic start-up company specializing in open source virtualization solutions for Linux/Android and cloud computing. Virtual Open Systems delivers efficient solutions that help customers to optimize system costs and to reduce development cycle for products introduction to market while improving control, security and meeting new business targets. Virtual Open Systems provides development & integration, consulting and support services on Linux & Android virtualization solutions, specializing on the Linux Kernel Virtual Machine (KVM) for embedded multi-core architecture systems and ARM based servers. For any discussion related to embedded systems virtualization and porting services of KVM hypervisor to ARM cortex-A15 and big.LITTLE platforms, the company can be reached via email at contact@virtualopensystems.com

8.1 Virtual Open Systems Android-Virtualization Services


Today, next generation of SoC platforms based on Cortex-A15 for consumer devices, smartphones, internet connected TVs, data center servers, (such as Snapdragon S4, Samsung Exynos 5250, TI Omap 5, AppliedMicro X-Gene and others) can use the native virtualization to introduce new types of applications or services or a way to improve security and to reduce their carbon footprint. Virtual Open Systems, while building a strong know-how based on forefront KVM on ARM software developments, can provide customized Android-Virtualization software services. For any inquiry related to virtualization and porting services, the company can be reached via email at contact@virtualopensystems.com

This activity has been funded by the FP7 Virtical Project

Sarl Virtual Open Systems - Registered at 529 212 987 RCS Grenoble - www.virtualopensystems.com - Page 15/15 -

Potrebbero piacerti anche