Introduction: Creating an Android Emulator Using Qemu
As a part of an academic research I've done during the last summer, I have created an android operating system emulator on a Linux computer using Qemu. After installing the Android emulator, I am able to use the Android system as if I were using a Android smartphone; I can surf the internet, listen to music and play games of the Android system. I find this project very interesting and the Android emulator is a fun to play with, thus I will show you how to create your own Android emulator on your computer and I hope your will have fun doing so.
Note: I did this project on a computer with Linux Ubuntu operating system, hence all my instructions may only apply to Ubuntu machines. The general concepts should be applicable to Windows systems using VirtualBox or VMWare, however, I don't know the specific steps for Windows machines.
Step 1: Step 1: Installing Qemu
Qemu is a hardware virtualization software that obscures the actual physical hardware specifics of the machine from the higher level software programs. Such virtualization software, Qemu, enables the installation of different operating systems without the operating systems being directly linking to the hardware machine. This ability presented by Qemu is crucial to the creation of an Android emulator on a computer. Smartphones and computers are similar in that they both have CPU chips to process information, however, with the differences physical dimensions between the two devices, their CPU chips are not the same in terms of architecture. Just like cars and airplanes, while they all have engines to power their movements, their engines are not the same. With different CPU architectures, a smartphone operating system can't be directing installed and used on a normal computer.
Since we are creating an Android emulator on a computer instead of installing one on a smartphone, we'll first have to install Qemu on our computer; Qemu allows us to run an Android operating system image on our computer. Installing Qemu is easy; just type in the "sudo apt-get install" as shown in the picture above in the system terminal, the system would then automatically download and install the Qemu project for you. If you're not login to your machine as the root user, the terminal would prompt your to enter your computer password before the installation.
Step 2: Step 2 Download Android OS .iso Image
Go to the Android-x86.org website to download an Android OS .iso image (http://www.android-x86.org/download).
Once we are in the Android-x86.org website, we'll need to go to the Download tap that is located at the top left side of the web page.
Under the Download page, click on the Android-x86 4.4 folder; the folder is shown as the first listed option in the picture. In the Android-x86 4.4 folder, we will need to click on the "Download Android-x86 ISO file" option to download the Android OS image we need.
Step 3: Step 3: Create a Script to Run the Qemu
In Linux systems, when a program is initiated to be executed in the terminal as a command, the user are often given the abilities to add different options when executing the command with different flags. For example, the ls command in Linux is the command to show a list of directory contents for the current working directory (folder). By adding a "-author" flag after the ls command, the result would include in the author of each files.
For the Qemu software to work with the Android OS image, we will need to add in specific option flags each time we execute qemu to start our emulator. These numerous option flag are tedious to type in and often or not, we may forget one or two. To avoid future frustration, we can create a script file. A script file is a file that contains all the terminal commands we want to execute. Instead of manually typing in the commands, we can write our commands into a script file and run the script file each time we want to start our Android emulator.
To create a script file is easy. In the system terminal, type "nano <filename>.sh" (place your own file name at the <filename> place), this will open up a text editor as shown in the picture. Then in the text editor type in the commands as shown in the picture. After we have finished writing our script, we can exit and save the file by pressing "ctlr+x" and confirm when asked if we want to save the file by pressing "y".
To execute the script we wrote, we will need to first make it into an executable by entering the command "chmod u+a yourfile.sh" in the terminal with the working directory (folder) pointed set to the directory containing your script file. Then, when we want to execute the file, we can just enter the command "./qemu.sh" in the terminal.
Step 4: Step 4: Executing the Android Emulator
To execute the Android emulator, we will need the script file we wrote in step 3, and we will also need to know the directory location of the Android OS image. As we've done so in step 2, we downloaded the Android OS image file by using a web browser. If so, we can find the Android OS image file in our Download folder, which is the directory "/home/<user>/Downloads/" (the <user> field should be the user name of your own computer user).
Once we have located the Android OS image file, we can start our Android emulator by typing in "./qemu.sh <AndroidOS_directory>/android-x86-4.4-r5.iso". When entering the directory for your Android OS image file, you can use "tab" button to auto-complete or find valid directories names. Once the command is executed, the Qemu screen will open up with the Android OS image already loaded. The screen will print several options as presented in the picture. For a quick start, we can just chose the first option by highlighting the option using the up for down keys and confirm with the enter key.
Step 5: Step 5: Advanced Development
By following steps 1-4, we have create a simple Android emulator on our computer. However, the Android emulator we've created is a very simple one; it can't save and load files between uses. To do that, we will need to create a hard disk image for the Android system to save all it's changes. This step requires deeper understandings of how the computer memory system works and how Linux systems handles, create, and format memory space into different disks. To explain and present all the necessary steps to create, configure, and install a hard disk image file for the Android system is too hard to do within a few slides and pictures. Thus, we will not cover this step in our tutorial.
If you're interested in perfecting your Android emulator by creating your own hard disk file, I suggest you to look through the instructions shown in the picture, which can be found at http://www.android-x86.org/documents/virtualboxhowto. Please do realize that these steps don't cover all the necessary steps to complete a hard disk file installation.
We have a be nice policy.
Please be positive and constructive.