- Follow the guide in the website.
scons build/ARM/gem5.opt -j4
- If protobuf_min_version error then edit SConstruct in the root of gem5 directory. At line 390, append to the list '-Wno-error=undef'.
-
Download the provided kernel and image from link.
-
Extract the download archive and add a path to the directory. (export M5_PATH or edit the "<gem5 dir>/configs/common/SysPaths.py" -> line 53, append path to the list.)
-
Create a dummy image named linux-bigswap2.img in the disks folder of the $M5_PATH.
dd if=/dev/zero of=./binaries/linux-bigswap2.img count=1 bs=16k
Check this link.
- Use the default fs.py config for running a simulation. Run gem5 simulator:
./build/X86/gem.opt ./configs/examples/fs.py --disk-image=x86Linux --kernel=x86_64-vmlinux-2.6.22.9
Also please note that with correct kernel config it is possible to use the base old image with the new kernel.
- Then connect to the simulator using telnet.
telnet 127.0.0.1 <port>
These steps has been taken for running a full system simulation.
-
Read the blog post here.
-
Download kernel version 4.8.13
-
Download config file linked to in the post.
-
Build the kernel with that config file.
cp config ./kernel directory/.config
cd ./kernel directory/
make oldconfig
make -j9
-
Copy vmlinux file (built kernel) to $M5_PATH/binaries
-
Run simulation.
./build/X86/gem5.opt ./configs/examples/fs.py --disk-image=test.img --kernel=x86_64-vmlinux-4.8.13
-
After some time, just after running init process of kerenl, the simulation ends. There is an error with TLB I guess. It might be because of system configuration. Check error logs at here.
-
Read post here for creating a system configuration. After following the tutorial I get the following error:
AttributeError: object 'MySystem' has no attribute 'mmubus'
(C++ object is not yet constructed, so wrapped C++ methods are unavailable.)
- The issue was solved there was some typing errors in the toturials code. (I opened an issue for them). System config is available here.
./build/X86/gem5.opt ./configs/my_config/run.py
-
Follow this link to create an image file. Ubuntu Server version 18.04.2 was used. I have Tried to run simulation with ubuntu image and kernel 4.8.13 on my_config system but it was stoped by kernel panic. Logs for the error is available here. (Check create disk image section)
-
In my_config/simple_full_system.py, boot_options, change
root=/dev/hda1
toroot=/dev/hda2
. A new kernel panic message. check here. -
Stuck, but this repository looks promising.
-
This repository has some tips an tricks.
This part is obtained from this post writen by Jason Lowe-Power.
Dependencies: qemu
- Create an empty disk image
qemu-img create ubuntu-test.img 8G
- Boot the installation image and install it on the disk image.
qemu-system-x86_64 -hda \<path to ubuntu-test.img\> -cdrom \<path to installation image\> -m 1024 -enable-kvm -boot d
- Boot from disk and add data, programs, ...
qemu-system-x86_64 -hda \<path to ubuntu-test.img\> -m 1024 -enable-kvm
- Setup init script:
- build m5
cd util/m5
make -f Makefile.x86
- mount image file system (check out mounting image file system)
- copy m5 binary to /sbin
- create a link from
/sbin/gem5
to/sbin/m5
ln -s /sbin/m5 /sbin/gem5
- create a file at
/lib/systemd/system/gem5.service
(file content is here) - create a file at
/sbin/initgem5
(file content is here) - boot the image and enable the gem5.service
systemctl enable gem5.service
For copying files from host to guest file-system, you can mount the image. (Read this post.)
- First find the partition's offset with command below
fdisk -lu ubuntu-test.img
- Mount the partition (4096 start of file system offset, 512 block size)
sudo mount -o loop,offset=$[4096*512] ubuntu-test.img mnt/
- Copy files and ...
In the configuration the gem5 is connected to ttyS0.
Check the post here.
- Use command below
systemctl edit serial-getty@ttyS0
- Add lines below
[Service]
ExecStart=
ExecStart=-/sbin/agetty --autologin root --keep-baud 115200,38400,9600 %I $TERM
- Check edited config
systemctl cat serial-getty@ttyS0 | grep Exec
-
Using
system.readfile
attribute defined atSystem.py
a pointer to a script can be send to guest. -
guest can use
m5
binary for accessing the file using command:m5 readfile
For automating the process, we are going to create a systemd service.
this part has been explained above, when creating a new ubuntu image