I am trying to run a simple hello world C++ program in FS mode in ALPHA
ISA. I am following the steps as follows:

1) Cross compiling the program using a pre-compiled cross-compiler for
target ALPHA.

$ wget http://www.m5sim.org/dist/current/alphaev67-unknown-linux-gnu.tar.bz2
$ tar -xjvf alphaev67-unknown-linux-gnu.tar.bz2
$ export
CXX=/home/iiitd/Desktop/compiler/compiler/alphaev67-unknown-linux-gnu/bin
$  export
CC=/home/iiitd/Desktop/compiler/compiler/alphaev67-unknown-linux-gnu/bin
$ export
PATH=$PATH:/home/iiitd/Desktop/compiler/compiler/alphaev67-unknown-linux-gnu/bin
$  alphaev67-unknown-linux-gnu-g++ -static new1.cpp -o hello6

2) Placing the program into the disk image.

I have downloaded the Full system image file from http://gem5.org/Download.
$ ls test-full-system
binaries disks
$ ls test-full-system/disks
 linux-bigswap2.img linux-latest.img
$ cd test-full-system
$ mkdir tmpdir
$ ls tmpdir
benchmarks  bin  dev  etc  iscsi  lib  linuxrc  lost+found  mnt  modules
proc  sbin  sys  tmp  usr  var
$ sudo mount -o loop,offset=32256 disks/linux-latest.img tmpdir
$ cd tmpdir
$ sudo cp /home/iiitd/Desktop/hello6 benchmark
$ cd ..
$ sudo umount tmpdir

3) Created a .rcS file:

#! /bin/sh
cd benchmarks
/sbin/m5 dumpresetstats
echo "executing hello world"
./hello6
echo "Done"
/sbin/m5 exit

4) Run in Gem5

$ echo "export M5_PATH=/home/iiitd/test-full-system" >> ~/.bashrc
$ source ~/.bashrc
$ cd gem5
$ build/ALPHA/gem5.opt configs/example/fs.py
--disk-image=/home/iiitd/test-full-system/disks/linux-latest.img
--script=/home/iiitd/a.rcS

In another terminal:
$ cd util/term
$ ./m5term localhost 3457
==== m5 slave terminal: Terminal 0 ====
M5 console: m5AlphaAccess @ 0xFFFFFD0200000000
Got Configuration 623
memsize 20000000 pages 10000
First free page after ROM 0xFFFFFC0000018000
---------------------------------------------------------
-------------------------------------------------------------
EXT2-fs warning: checktime reached, running e2fsck is recommended
loading script...
executing hello world
Segmentation fault
Done


Also, should I use the linux-bigswap2.img instead of linux-latest.img?
When I try to mount the linux-bigswap2.img, I get the following error:

$ sudo mount -o loop,offset=32256 disks/linux-bigswap2.img tmpdir
[sudo] password for iiitd:
NTFS signature is missing.
Failed to mount '/dev/loop2': Invalid argument
The device '/dev/loop2' doesn't seem to have a valid NTFS.
Maybe the wrong device is used? Or the whole disk instead of a
partition (e.g. /dev/sda, not /dev/sda1)? Or the other way around?





-- 
Mitali Sinha,
PhD Scholar,
IIIT Delhi
_______________________________________________
gem5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

Reply via email to