Difference between revisions of "BBench-gem5"

From gem5
Jump to: navigation, search
m (Android Full-System Files)
m (Added note about which kernel version to use.)
Line 6: Line 6:
 
# Download the basic full system files from the [[Download]] page and build gem5 for the ARM ISA according to these instructions [[Compiling_M5]]
 
# Download the basic full system files from the [[Download]] page and build gem5 for the ARM ISA according to these instructions [[Compiling_M5]]
 
# Point the <code>M5_PATH</code> environment variable to this location. E.g, type <code>export M5_PATH=/path_to_gem5_system/system/</code>
 
# Point the <code>M5_PATH</code> environment variable to this location. E.g, type <code>export M5_PATH=/path_to_gem5_system/system/</code>
# Download and uncompress the ARM/Android [http://www.gem5.org/dist/current/bbench/vmlinux_and_config_arm.tgz Kernel]  and place it in the /path_to_gem5_system/system/binaries directory  
+
# Download and uncompress the ARM/Android [http://www.gem5.org/dist/current/bbench/vmlinux_and_config_arm.tgz Kernel]  and place it in the /path_to_gem5_system/system/binaries directory. Do not use the one under New Full System Files on the [[Download]] page; it does not boot correctly.
 
# Download and uncompress the [http://www.gem5.org/dist/current/bbench/Gingerbread_disk_image.tgz Gingerbread Disk Image] or the [http://www.gem5.org/dist/current/bbench/ICS_disk_image.tgz ICS Disk Image] and place it in the /path_to_gem5_system/system/disks directory
 
# Download and uncompress the [http://www.gem5.org/dist/current/bbench/Gingerbread_disk_image.tgz Gingerbread Disk Image] or the [http://www.gem5.org/dist/current/bbench/ICS_disk_image.tgz ICS Disk Image] and place it in the /path_to_gem5_system/system/disks directory
 
# Run <code>/path_to_gem5_root/build/ARM/m5.fast configs/example/fs.py -b bbench-ics --kernel=vmlinux.smp.mouse.arm --frame-capture</code> to run BBench on Android ICS using ARM. Replace bbench-ics with bbench-gb if you wish to run BBench on Android Gingerbread. Invoke from <code>/path_to_gem5_root</code>.
 
# Run <code>/path_to_gem5_root/build/ARM/m5.fast configs/example/fs.py -b bbench-ics --kernel=vmlinux.smp.mouse.arm --frame-capture</code> to run BBench on Android ICS using ARM. Replace bbench-ics with bbench-gb if you wish to run BBench on Android Gingerbread. Invoke from <code>/path_to_gem5_root</code>.

Revision as of 12:20, 15 April 2013

This page provides everything you need to get Android, and BBench, working on gem5. BBench is a new web-page rendering benchmark; you can read about it here: BBench. We have provided pre-compiled disk images and an Android kernel, as well as step-by-step instructions on how to get Android running on gem5 using the ARM ISA.

Running BBench on Android with gem5

Everything required to run BBench on gem5 is provided in the next section. You will need the kernel and the disk image (containing BBench).

  1. Get gem5 from the Repository
  2. Download the basic full system files from the Download page and build gem5 for the ARM ISA according to these instructions Compiling_M5
  3. Point the M5_PATH environment variable to this location. E.g, type export M5_PATH=/path_to_gem5_system/system/
  4. Download and uncompress the ARM/Android Kernel and place it in the /path_to_gem5_system/system/binaries directory. Do not use the one under New Full System Files on the Download page; it does not boot correctly.
  5. Download and uncompress the Gingerbread Disk Image or the ICS Disk Image and place it in the /path_to_gem5_system/system/disks directory
  6. Run /path_to_gem5_root/build/ARM/m5.fast configs/example/fs.py -b bbench-ics --kernel=vmlinux.smp.mouse.arm --frame-capture to run BBench on Android ICS using ARM. Replace bbench-ics with bbench-gb if you wish to run BBench on Android Gingerbread. Invoke from /path_to_gem5_root.
  7. If you wish, you can view the output of the frame buffer inside m5out/frame_system.vncserver, or by using a vnc viewer.

Note: These instructions and images are only for Android on the ARM ISA.

Android Full-System Files

These files contain everything you need to get Android, and BBench, up and running on gem5.

These, as well as more up-to-date versions of BBench, can also be found here.

  • Gingergread Disk Image with BBench -- Disk image with a pre-compiled Android Gingerbread file-system. This disk image contains all of the files generated during initial boot, as well as a self-terminating version of BBench and BusyBox.
  • Clean Gingerbread Disk Image -- Disk image containing only the pre-compiled Android Gingerbread file system. This disk image contains no benchmarks and has never been booted.
  • ICS Disk Image with BBench -- Disk image with a pre-compiled ICS file-system. This disk image contains all of the files generated during initial boot, as well as a self-terminating version of BBench and BusyBox.
  • Clean ICS Disk Image -- Disk image containing only the pre-compiled Android ICS file system. The disk image contains no benchmarks and has never been booted.

Building Your Own Android File System and Kernel

This section gives step-by-step instructions for building a gem5 compatible Ice Cream Sandwich (ICS) disk image.

  1. Initialize your build environment and download the Android source.
  2. Get a copy of the Armdroid patches using the following command: git clone git://linux-arm.org/armdroid.git.
  3. Checkout the matching revision:
    1. cd ./android_source
    2. git --git-dir=.repo/manifests/.git/ checkout 6f056451e4eee641872a4a8b9165f9c9f9799d39
  4. Copy the arm device files into the Android device folder: cp path_to_armdroid/fs/src/IceCreamSandwich/Android-ICS-device-arm.tar.bz2 path_to_android_src/device/. Then, untar it.
  5. Copy the Armdroid patches to the appropriate Android source directory. These directories can be inferred from the patch file itself.
  6. Apply those patches by changing to the directories in which the patches were copied and running the command: git apply *.patch
  7. Optional Step: It may be useful to disable the screen lock. To do so, modify KeyguardViewMediator.java by returning immediately from doKeyguardLocked().
  8. Change into the Android source root directory and build using: make PRODUCT-armboard_v7a-eng -jn.
  9. Create a blank image using the gem5img.py utility: ./gem5img.py init android_ics_arm.img 1024
  10. Create a mount point: sudo mkdir -p /mnt/ics
  11. Mount the image: sudo mount -o loop,offset=32256 android_ics_arm.img /mnt/ics
  12. Copy the root/ and system/ folders to the mounted image:
    1. cp -a path_to_android_src/out/target/product/armboard_v7a/root/* /mnt/ics
    2. cp -a path_to_android_src/out/target/product/armboard_v7a/system/* /mnt/ics/system
  13. Unmount the image: sudo umount /mnt/ics

Now, to build the 2.6.35 kernel.

  1. Get the kernel source: git clone git://linux-arm.org/linux-2.6-armdroid.git -b 2.6.35-armdroid
  2. Get the 2.6.35 config file packaged with the linux kernel above.
  3. Copy it to the kernel source directory as .config.
  4. Build the kernel source: make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- -jn vmlinux EXTRA_CFLAGS=-mno-unaligned-access

Note: these instructions assume you are using the arm-none-linux-gnueabi compiler toolchain from Sourcery CodeBench Lite.

Tips for Making Your Disk Image gem5 Friendly

Speeding Up the Boot Process

When a fresh Android image is booted it generates a lot of files and does a lot of JIT compiling; this can slow down the boot process significantly. gem5 uses a copy-on-write (COW) layer between the simulator and the actual disk image, because of this COW layer none of the changes are stored to the disk image. To make these changes permanent, and avoid having to repeat them in the future, you can remove the COW layer during the first boot of an image. This will significantly speedup future runs. To do so make the following changes to configs/common/FSConfig.py:

   class RawIdeDisk(IdeDisk):
       image = RawDiskImage(read_only=False)
       def childImage(self, ci):
           self.image.image_file=ci

Then, inside of makeArmSystem(), change from:

   self.c0 = CowIdeDisk(driveID='master')

to

   self.c0 = RawIdeDisk(driveID='master')

Be careful when doing this. Any changes made to the disk image will be permanent when using the raw ide disk. To ensure that all the changes are written to the disk image properly you can use the sync and halt Linux commands. These are not available on Android so it is recommended that you use something like BusyBox. Once the image has finished booting and has settled, you can run busybox sync and busybox halt -f from a gem5 terminal to write all changes to the disk and halt it properly. You will likely get a panic when the simulator exits regarding an unrecognized byte, however, this doesn't seem to cause any problems. Remember to re-enable the COW layer once you've finished setting up your disk image.

BusyBox

BusyBox is a useful tool providing many common Linux utilities for embedded systems. To build busybox, download the source and compile statically using the following commands:

  1. make CROSS_COMPILE=arm-none-linux-gnueabi- defconfig
  2. LDFLAGS="--static" make CROSS_COMPILE=arm-none-linux-gnueabi- -jn

Place the busybox binary into the /sbin/ directory of your Android file-system. Run busybox --help to see a full list of the available utilities.

Android Init Process

To have your benchmarks start automatically you will likely need to modify the init.rc script located in the file-system's root directory. You can see the changes made to the init.rc script for BBench by looking at the init.rc script in the images we distribute with BBench, this may be a useful template. Another useful resource for understanding the init process is located here.

m5 Utility

You will likely need the m5 utility, whose source is located in util/m5/, to do anything useful with your disk image. Build this (statically) and place it in the /sbin/ directory of your Android file-system.

Publications

If you use BBench in your work please cite our IISWC 2011 paper:

A. Gutierrez, R.G. Dreslinski, T.F. Wenisch, T. Mudge, A. Saidi, C. Emmons, and N. Paver. Full-System Analysis and Characterization of Interactive Smartphone Applications. IEEE International Symposium on Workload Characterization, pages 81-90, Austin, TX, November 2011.