Вы находитесь на странице: 1из 3

How To

How To

Getting started with


ARM Linux
Want to get started with development on ARM systems, but don’t have the required
processor for the purpose? This article teaches you how to get started with emulating
the ARM architecture under an i686 system.

A
RM Linux is a port of the Linux
Kernel to ARM processor-based
machines. The ARM Linux kernel
is being ported, or has been
ported to more than 500 different
machine variations, including complete
computers, network computers, hand-held
devices and evaluation boards.
In this article, we will see how we can use
the Qemu ARM PC Emulator, ‘qemu-arm-
system’, to boot a DirectFB graphical user
interface-based ARM Linux kernel image.

Cross compilation
Before we proceed, I shall introduce to you
the concept of ‘cross compilation’. According
to Wikipedia, “A cross compiler is a compiler
capable of creating executable code for a
platform other than the one on which the
compiler is run. Cross compiler tools are
generally used to generate compiles for
embedded systems or multiple platforms. It is
a tool that one must use for a platform where
it is inconvenient or impossible to compile on
that platform, like micro-controllers that run
with a minimal amount of memory...”
In a cross compilation process we have a
‘host’ system and a ‘target’ system. The ‘host’
system is the one that is being used for cross
compiling the kernel—in this case, an i686
machine. The ‘target’ system is the one for

12 February 2008 | LINUX For You | www.openITis.com

cmyk
How To

which the kernel is being compiled to be run on—ARM in


our case.

QEMU ARM emulation tools


QEMU (http://fabrice.bellard.free.fr/qemu/) is a generic and
open source machine emulator and virtualiser. When used as
a machine emulator, QEMU can run OSs and programs made
for one machine (for example, an ARM board) on a different
machine (for example, your own PC).
You can install QEMU (in Debian/Ubuntu) by using the
following command (provided your software repositories are
configured):

$ sudo apt-get install qemu

We shall use the ARM PC emulator that is part of QEMU,


‘qemu-system-arm’:
Figure 1: The ARM kernel image once booted from within the Ubuntu OS

$ qemu-system-arm
QEMU PC emulator version 0.8.2, Copyright (c) 2003-2005 Fabrice
Bellard
usage: qemu [options] [disk_image]

Host and target system configuration


The host system:
l OS: Ubuntu Linux 7.04
l Architecture, kernel: i686, 2.6.20-15-generic
l Development tools: GCC cross compiler
The architecture and kernel for the target system are
ARM and 2.6.21.1, respectively.

Tiny QEMU ARM system with a DirectFB interface


The Web page at http://free-electrons.com/community/
demos/qemu-arm-directfb/ provides a very small ARM Linux
kernel image that can be directly used to start an ARM Linux
session using ‘qemu-system-arm’. DirectFB adds a GUI to the Figure 2: The contents of /proc/cpuinfo confirms ARM emulation is successful
ARM Linux kernel.
To get started, download the vmlinuz-qemu-arm-2.6.20
binary from http://free-electrons.com/pub/qemu/demos/
arm/directfb/1.0/vmlinuz-qemu-arm-2.6.20. Once done,
start the system by executing the following command from a
shell prompt:

$ qemu-system-arm -M versatilepb -m 16 -kernel \


vmlinuz-qemu-arm-2.6.20 -append “clocksource=pit quiet rw”

In the above command, the -M switch specifies the


hardware type to emulate. You can find the other supported
architectures by executing the following command:

$ qemu-system-arm -M ?
Supported machines are:
integratorcp926 ARM Integrator/CP (ARM926EJ-S) (default)
integratorcp1026 ARM Integrator/CP (ARM1026EJ-S)
versatilepb ARM Versatile/PB (ARM926EJ-S)
versatileab ARM Versatile/AB (ARM926EJ-S) Figure 3: The graphical demo demonstrating DirectFB usage

www.openITis.com | LINUX For You | february 2008 13

cmyk
How To

executable. It provides replacements for most of the


utilities you usually find in GNU fileutils, shellutils,
etc. The utilities in BusyBox generally have fewer
options than their full-featured GNU cousins; however,
the options that are included provide the expected
functionality and behave very much like their GNU
counterparts.
3. DirectFB (http://www.directfb.org/) is a thin library
that provides developers with hardware graphics
acceleration, input device handling and abstraction,
an integrated windowing system with support for
translucent windows and multiple display layers on
top of the Linux Framebuffer Device. DirectFB adds
graphical power to embedded systems and sets a new
standard for graphics under Linux.
Figure 4: Results of the ‘benchmarking’ tests carried out by DirectFB GUI
Interface
Looking ahead
This article was mainly a demonstration of the use of the
Once the system boots up, you get a shell prompt where pre-built ARM Linux kernel image. In another article,
you can issue the usual Linux commands. hopefully next month, we shall try and build a simple ARM
Let us now have a look at the information provided by Linux system, using some of the tools mentioned earlier.
the /proc/cpuinfo file: Also, you can consult the references to delve more into the
internals and try a thing or two.
$ cat /proc/cpuinfo

References
Figure 2 shows the terminal output. The output verifies
l ARM architecture—http://en.wikipedia.org/wiki/ARM_ar-
that we are now on an emulated ARM architecture.
chitecture
You can also try out the graphical demo that l The ARM Linux Project—http://www.arm.linux.org.uk
demonstrates the usage of DirectFB as follows: l Tiny QEMU ARM system with a DirectFB interface—
http://free-electrons.com/community/demos/qemu-
$ run_demo arm-directfb/
l Cross compilation—http://en.wikipedia.org/wiki/Cross_
Tools that have been used to construct the above ARM- compiler
l QEMU—http://fabrice.bellard.free.fr/qemu/
Linux image are:
l Running Linux for ARM processors under QEMU—
1. Buildroot (http://buildroot.uclibc.org/) is a set of http://www.nepotismia.com/linux/qemu/arm/
Makefiles and patches that make it easy to generate a
cross-compilation toolchain and root filesystem for the
By: Amit Kumar Saha. The author is a technical writer, a
target Linux system using the uClibc C library (http://
contributor to Open Source projects and a researcher. More
uclibc.org/).
on his works is available at http://amitsaha.in.googlepages.
2. BusyBox (http://busybox.net/) combines tiny versions
com
of many common UNIX utilities into a single small

14 February 2008 | LINUX For You | www.openITis.com

cmyk

Вам также может понравиться