This test uses a Linux 2.6.19 kernel built for the standalone
Or1ksim as described in
Embecosm Application Note 2. The OpenCores OpenRISC 1000 Simulator and
Tool Chain: Installation Guide.
[4]. A configuration file, which enables the
internal memory management units
(MMUs) and Programmable Interrupt Controller
(PIC) of the Or1ksim is provided,
linux.cfg
. This also declares additional
internal memory space in Or1ksim for flash and
SRAM.
The SystemC model is then run with this configuration file and the Linux kernel binary.
./IntrSocSC linux.cfg ../linux-2.6.19/vmlinux
Initially Linux copies itself from flash memory to RAM.
Copying Linux... Ok, booting the kernel.
After a pause while initial booting is taking place the serial interface is ready, allowing the normal kernel boot messages to appear:
Linux version 2.6.19-or32 (jeremy@thomas) (gcc version 3.4.4) #59 Wed Jun 25 18: 48:06 BST 2008 Detecting Processor units: Signed 0x391 Setting up paging and PTEs. write protecting ro sections (0xc0002000 - 0xc024c000) Setting up identical mapping (0x80000000 - 0x90000000) Setting up identical mapping (0x92000000 - 0x92002000) Setting up identical mapping (0xb8070000 - 0xb8072000) Setting up identical mapping (0x97000000 - 0x97002000) Setting up identical mapping (0x99000000 - 0x9a000000) Setting up identical mapping (0x93000000 - 0x93002000) Setting up identical mapping (0xa6000000 - 0xa6100000) Setting up identical mapping (0x1e50000 - 0x1fa0000) dtlb_miss_handler c00040c8 itlb_miss_handler c00041a8 Built 1 zonelists. Total pages: 3953 Kernel command line: root=/dev/ram console=ttyS0 <Lots more Linux kernel messages...> Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing disabled serial8250.0: ttyS0 at MMIO 0x90000000 (irq = 2) is a 16450 <Lots more Linux kernel messages...> VFS: Mounted root (ext2 filesystem) readonly. Freeing unused kernel memory: 104k freed init started: BusyBox v1.4.1 (2007-03-22 18:53:56 EST) multi-call binary init started: BusyBox v1.4.1 (2007-03-22 18:53:56 EST) multi-call binary Starting pid 22, console /dev/ttyS0: '/etc/init.d/rcS' Please press Enter to activate this console.
This takes a simulated time of about 37 seconds, and on a modern PC an elapsed time of around 20-25 seconds (the Or1ksim ISS in this minimal configuration runs at 150-200MHz [11]).
At this point hitting return will start up a Linux shell, running some basic commands and in this example the BusyBox utilities (see the website for more details).
Please press Enter to activate this console. Startingpid 25, console /dev/ttyS0: '/bin/sh' BusyBox v1.4.1 (2007-03-22 18:53:56 EST) Built-in shell (ash) Enter 'help' for a list of built-in commands. # ls /proc 1 2 bus iomem self 10 25 cmdline ioports slabinfo 11 26 cpuinfo kcore stat 12 3 crypto kmsg sys 13 4 devices loadavg sysrq-trigger 14 5 diskstats locks sysvipc 15 6 driver meminfo tty 16 7 execdomains misc uptime 17 8 filesystems mounts version 18 9 fs net vmstat 19 buddyinfo interrupts partitions zoneinfo # busybox mount rootfs on / type rootfs (rw) /dev/root on / type ext2 (ro) proc on /proc type proc (rw) #
The importance of choosing a suitable value for the global quantum is well illustrated here. Rebuild the model with a global quantum of 100μs—rather longer than the time it takes to transmit one character at 115,200 baud.
#define QUANTUM_US 100
The time taken to boot is marginally faster (19s), but this time the terminal cannot cope with the erratic interrupt behavior.
VFS: Mounted root (ext2 filesystem) readonly. Freeing unused kernel memory: 104k freed init started: BusyBox v1.4. Please press Ent
The Linux serial driver loses interrupts and the system locks up and will eventually crash with an unhandled interrupt exception.
[11] This may seem exceptionally fast for an interpreting ISS, but this model is configured with slow RAM with a 20-25 cycle access time and no caches. So 150-200MHz represents only 5-10 MIPS. That's why booting a basic Linux kernel takes 37s of simulated time, rather than the 2-3s that might reasonably be expected!