Sim-iPAQ
A SimpleScalar-based Platform Simulator for the iPAQ Computing Environment
The following is the first release of the
SimpleScalar iPAQ
platform simulator. It is capable of booting the Linux operating system
and
provides a root filesystem with a variety of useful ARM Linux
utilities.
Comments, questions, or bug fixes may be directed to the authors via
email at ss-sa@cs.colorado.edu.
In this release, the critical platform components have been implemented
including ARM instruction emulation, ARM MMU support, and I/O models
for the
ARM iPAQ real-time clock, interrupt controller, serial devices, FLASH
and DRAM
memory, and the OS timer. The simulator model is able to boot the
Linux kernel;
however, some bootloader and Linux commands are still not functioning
due to a
few remaining implementation issues. Nevertheless, a significant amount
of
functionality exists in this release, therefore we have made it
available and will
update the code as bugs are identified and fixed.
1 Sim-IPaq
Distribution Components
Platform Simulator - The platform simulator is derived from
SimpleScalar
version 3.0 located at www.simplescalar.com.
It includes ARM instruction emulation, ARM MMU support, and I/O models
for the
ARM iPAQ real-time clock, interrupt controller, serial devices, FLASH
and DRAM
memory, and the OS timer.
Platform Console - The platform console provides serial terminal
emulation. It connects to the platform
simulator and
allows the user to issue bootloader and Linux command-line commands to
the
simulator.
ARM Bootloader - The ARM bootloader is installed into memory at
simulator
initialization time. It decompresses the kernel and initializes
the filesystem.
ARM Linux Kernel - The ARM Linux Kernel provides operating system
functionality
and is decompressed by the bootloader at initialization.
ARM Linux Root Filesystem - The ARM Linux Root Filesystem provides a
number of standard utilities in the root filesystem that are available
after the ARM
Linux Kernel boots on the platform simulator.
A few examples of these standard utilities are ls, diff, and
mount.
2 Building
the Simulation Environment
The following sections will describe how to build the various components of the Sim-iPAQ simulation environment. One thing to note before beginning is that this release of Sim-iPAQ has only been tested on RedHat Linux version 8.0 for x86. However, it will probably work on any little-endian platform provided that the build uses GNU GCC for the compilation.
2.1 iPAQ
Platform Model
The Sim-iPAQ platform model, located in the "sim-ipaq/" directory of
the download archive, must be configured before it can be built.
In
addition to the normal SimpleScalar configuration parameters found in
the
README file, the variable LINUX_PATH in the Makefile must be set to the
root
location of the Linux build. Once the normal configurations are
made and
the Makefile is configured as above, the platform simulator, called
sim-ipaq,
is built with the following command:
make
The build processor will also compile the Platform Console,
conveniently called
console.
2.2 iPAQ
Bootloader, ARM Linux Kernel, and Root Filesystem
Before beginning with this step, it should be noted that pre-built
versions of
the iPAQ Bootloader, ARM Linux Kernel, and Root Filesystem are provided
in the
Sim-iPAQ distribution, thus you may skip this step unless a custom
kernel or
filesystem is required.
If a custom environment is desired, the first thing that will be needed is an ARM cross compiler to build the bootloader and ARM Linux Kernel. One such cross compiler is available for SimpleScalar at the following location: http://www.simplescalar.com/v4test.html.
The iPAQ Bootloader, located in the
"linux-build/bootldr"
directory, is a free ARM-based bootloader distributed by Compaq.
It
provides a variety of debug functions, plus Linux kernel decompression,
and
root filesystem initialization. To build the bootloader execute
the
following command in the bootloader directory:
make
This will produce the file "bootldr.bin", which is an ELF binary
format bootloader, in the format expected by the Sim-iPAQ platform
simulator. See the README files for details on the commands
supported by
the bootloader. Additional documentation
is available by executing the "help" command at the bootloader
prompt.
The ARM Linux Kernel, located in the directory "linux-build/linux",
has a complete kernel build. A large number of build options are
available for the kernel which can be seen in the README file located
in the above
linux-build/linux directory. The kernel has been pre-configured
with the
options expected by the Sim-iPAQ platform simulator. To build the
ARM
Linux Kernel, execute the following command in the kernel directory:
make zImage
This will create "zImage.bin", which is a compressed ARM Linux Kernel
with devices compiled in to match the devices supported by the Sim-iPAQ
platform
simulator.
The ARM Linux Root Filesystem provides a minimal filesystem available
to users
once the ARM Linux Kernel boots on the Sim-iPAQ platform simulator. The
root
filesystem is loaded into simulated FLASH memory as a compressed-RAM
filesystem
(CRAMFS). The first step to building a compressed-RAM filesystem
is to
build the filesystem build utility "mkcramfs", which is located in
the directory "linux/kernel/scripts/cramfs/". Build this
utility with the following command in the CRAMFS directory:
make
Next, assemble a filesystem, on the local host filesystem, with exactly
the
same ARM binaries and permissions desired on the CRAMFS. To create the
CRAMFS
filesystem, execute the following command:
linux/kernel/scripts/cramfs/mkcramfs init-2-56 init-2-56.cramfs
Where "init-2-56" is the top-level directory of the local
representation
of the filesystem to create, and "init-2-56.cramfs" is the name of
the file that will contain the compressed filesystem.
3 Running
the IPAQ Platform Model
To run the IPAQ platform model, first run the platform simulator,
located in
the "sim-ipaq/" directory, with the following command:
sim-ipaq linux-boot
The argument "linux-boot" indicates that the platform simulator should
initiate a standard Linux boot sequence. The standard boot
sequence accesses
files in the directory specified by the build parameter LINUX_PATH. The
sequence first reads the bootloader executable "bootldr.bin", then
the compressed Linux ARM Kernel "zImage.bin", and finally the root
filesystem "init-2-56.cramfs".
After reading the FLASH ROM components into simulated FLASH RAM, the
platform simulator will connect to the terminal emulator. The
terminal
emulator is the user's access point to the Linux simulation, providing
a means
for entering command lines to the bootloader and Linux shells.
The
platform console is a front-end to the serial device emulator. To
start
the platform console, enter the following command in a separate window:
console -s script-boot.txt
This will initiate a platform console connection to the running
sim-ipaq
simulator, and run an initial set of bootloader commands, listed in the
file
"script-boot.txt". These
commands are required to initialize the Linux kernel memory and CRAMFS
filesystem. Once the commands complete, the Linux kernel will
boot, after
which the user can enter additional commands from the platform console
window.