Objective
This article takes the developer through the Android* Gingerbread* Intel® Architecture (x86) Emulator. We discuss building an emulator image with AOSP sources, and afterwards, we emulate the resulting system images for x86. Some new features introduced in Gingerbread* are also discussed.
Table of Contents
- What is Gingerbread*, and what is new?
- Why Emulate Gingerbread*?
- Building an Emulator Image
- Setting up the SDK to Use x86 Emulator Images
- New GB Feature: Battery Usage Stats
- New GB Feature: Task Manager
- New GB Feature: Cut and Paste Text
- Summary
What is Gingerbread*, and What is New?
Gingerbread (GB) is Android* version 2.3, the follow-on to its 2.2 predecessor, Froyo*. Both Froyo* and Gingerbread* target phone form factors, as opposed to Honeycomb* (Android* 3.x) which runs on tablets.
Gingerbread* provides additional performance benefits along with added power management. Several features have also been added for an enhanced user experience. For a more exhaustive list of the changes, the developer should read this article: http://blogs.computerworld.com/17479/android_gingerbread_faq
Why Emulate Gingerbread*?
It's free. The Android* SDK and its third-party add-ons cost the developer nothing. Essentially, the developer can emulate devices which he or she does not own. This is important as not all phones acquire the latest Android* OS versions via Over The Air (OTA) updates, and it may not be feasible for the developer to purchase every device that is expected to support his or her software package(s).
Development and Testing. The developer can use the SDK to create several Android* Virtual Device (AVD) configurations for development and testing purposes. Each AVD could vary by screen dimension, SD card size, or even version of the Android* SDK for testing backward compatibility with prior Android* builds.
Playing with a new build. The developer can simply just have fun with a new build of Android* to learn about it! This article now walks through building and running an emulator image to emulate Gingerbread* on an x86 build.
Building an Emulator Image
The developer should first follow the prerequisites listed here: http://source.android.com/source/initializing.html
Google* has made Gingerbread* sources available at a new location. The documentation at http://source.android.com/source/downloading.html has been updated to reflect these changes.
Currently, the default repo initialization instructions are only for getting the latest master branch or a specific branch such as when using the command “android-2.3.7_r1”. The repo and branch instructions for building Gingerbread* x86 Emulator images were not given.
Please use the branch label “gingerbread” to download the latest Android* source branch. This branch has the required build files and modules needed to build the x86 SDK Emulator images.

Initialize the build env:

Use the "lunch" command to configure the build for building the x86 SDK. This will build the emulator images for x86, along with other SDK modules.


Finally, we can issue the make command “make sdk” to kick off the build, as shown in the screenshot below.


Additionally, we can specify the number of parallel jobs for “make” using the –j parameter, to speed up the build process. (It is recommended to use a value that is at least equal to or greater than the total number of CPUs in the system.)
The build will create 3 images, including the QEMU Android* kernel image:t system.img (Android*), userdata.img, and ramdisk.img.
When the build completes, the images will be in the build folder $ANDROID_BUILD_TOP/out/target/product/generic_x86/ - as shown in the screenshot below.


The Android* kernel image for QEMU (“kernel-qemu”) comes with Android* Sources. It is located under the “prebuilt” folder ($ANDROID_BUILD_TOP/prebuilt/android-x86/kernel).


We now have all the image files required for running x86 Android* Gingerbread* on Android* x86 Emulator. The image files need to be set up with the SDK, which will be covered in next section.
Setting up the SDK to Use x86 Emulator Images
The Android* SDK tools (“android”, the avd manager) expect the x86 emulator images to be present in the default SDK folders for platform images – “/platforms/android-10/images.
The screenshots below assume the $ANDROID_SDK_TOP environment variable is set to the location of the Android* SDK installation folder.



As in the screenshot above, by default, Android-10 comes with emulator images for ARM*. In order to setup the x86 emulator images in SDK, we need to create an x86 folder and copy the images we build into the folder. We can also move the ARM* images to their own folder as shown below.

The screenshots below show instructions for the x86 folder:

The final images folder of Android-10 platform:

Before using the Gingerbread* Intel® Architecture images with x86 Emulator, the user needs to first create an AVD configuration that specifies the required software and hardware customizations. For more detailed information about AVDs, please refer to the article Android* Virtual Device Emulation for Intel® Architecture.
It is now time to use the Gingerbread* x86 emulator for emulating an x86 image.
Open the Android* tool or bring up the AVD creation tool directly from Eclipse*.
The screenshot below shows the creation of an AVD for Gingerbread* with Intel® Atom™ (x86) CPU.


Test the x86 Gingerbread* AVD by selecting the AVD and clicking on Start, as shown in the screenshot below.

The screenshot below shows the home screen of the Gingerbread* for Intel Atom (x86) on emulator-x86

The screenshot below shows the “About phone” view of the settings.

It is recommended to use the x86 emulator with Intel® VT hardware acceleration. On Linux*, this can be done using the Linux* KVM. Ubuntu* has further documentation on how to configure and use it: https://help.ubuntu.com/community/KVM

With KVM, (-enable-kvm) users will likely notice performance boosts during Android* boot along with quicker emulator responsiveness.
New GB Feature: Battery Usage Stats
In “About Phone” there is a “Battery Use” section. Battery stats will vary based on the emulation device and build. In the case where the developer can telnet into the emulated device, some simple commands can be used to mock battery drain. Take a look at one such example: http://android-er.blogspot.com/2010/09/how-to-set-battery-status-of-android.html
New GB Feature: Task Manager
In Settings -> Applications -> Running Services, there is a “Running” tab, which shows what’s currently running:

Figure 8: The Task Manager
For example, the developer can close “Settings” process by clicking on the item and selecting “Stop”.
New GB Feature: Cut and Paste Text
Opening the “Messaging” application and choosing “New Message” allows the user to type a message as if sending an SMS. By clicking in the text field and typing on the host keyboard, characters appear seamlessly on the Android* screen. After typing “Hello 2.3.5!” the screen looks like this:

Figure 9: Messaging Fun
By dragging the mouse into the text field where “Hello 2.3.5!” is found and holding down the mouse button (or touchpad button) for about 2 seconds, a tool tip menu appears to “Edit Text”. Choosing, “Select all” and then repeating the mouse operation, the user sees the option to cut the text. After cutting text, repeating the mouse operation once again allows the user to paste back the text.
Summary
Gingerbread* is feature-rich, and now users can explore the possibilities on x86. This guide provided the basic essentials for the developer going through the process of building an emulator image using the SDK and evaluating it. The new Gingerbread* features that were discussed are only a subset of what Android* has to offer, and it's up to the user/developer to have fun exploring the possibilities!
Notices
* Other names and brands may be claimed as the property of others
Copyright © 2011 Intel Corporation. All rights reserved.
Intel and Atom are trademarks of Intel Corporation in the U.S. and/or other countries.
INFORMATION IN THIS DOCUMENT IS PROVIDED IN CONNECTION WITH INTEL PRODUCTS. NO LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL PROPERTY RIGHTS IS GRANTED BY THIS DOCUMENT. EXCEPT AS PROVIDED IN INTEL'S TERMS AND CONDITIONS OF SALE FOR SUCH PRODUCTS, INTEL ASSUMES NO LIABILITY WHATSOEVER AND INTEL DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY, RELATING TO SALE AND/OR USE OF INTEL PRODUCTS INCLUDING LIABILITY OR WARRANTIES RELATING TO FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT.
UNLESS OTHERWISE AGREED IN WRITING BY INTEL, THE INTEL PRODUCTS ARE NOT DESIGNED NOR INTENDED FOR ANY APPLICATION IN WHICH THE FAILURE OF THE INTEL PRODUCT COULD CREATE A SITUATION WHERE PERSONAL INJURY OR DEATH MAY OCCUR.
Intel may make changes to specifications and product descriptions at any time, without notice. Designers must not rely on the absence or characteristics of any features or instructions marked "reserved" or "undefined". Intel reserves these for future definition and shall have no responsibility whatsoever for conflicts or incompatibilities arising from future changes to them. The information here is subject to change without notice. Do not finalize a design with this information.
The products described in this document may contain design defects or errors known as errata which may cause the product to deviate from published specifications. Current characterized errata are available on request.
Contact your local Intel sales office or your distributor to obtain the latest specifications and before placing your product order.
Copies of documents which have an order number and are referenced in this document, or other Intel literature, may be obtained by calling 1-800-548-4725, or go to: http://www.intel.com/design/literature.htm

Comments
Hi
Great article !! Thanks a ton for this :). I got everything working. There is one glitch though. The new folder that you make for the arm images should be called armeabi and not arm. (ie you should do mkdir armeabi ) and then put all the images and kernel-qemu there. Otherwise, it works without a glitch :). With hardware virtualization, and the kernel support for virtualization, it's blazing quick overall :)
Anirudh
This works great :) !! Thanks a ton for the information. One minor glitch is that the folder arm should be called armeabi for the android tool to be able to create the AVD once you have both x86 and ARM images.
Hi,
Thank you . I want to emulate HTC 762100 android os(this device specific image ) on sdk emulator. How can I boot the device specific file on android emulator or any other ways. I have system.img, ramdisk.zip(img), userdata.img, boot.img, build.config... etc..
what kind of changes need to run this file on emulator or on top any os ...
Plase could guide me.
appreciated,
Reagrds