问题
I need to run a relatively newer version of x86 disk image on gem5. Starting from this guide I used Ubuntu 12.04 disk image with Kernel v3.2.1 as that combination was worked for someone else.
After some point, simulator just hangs, please share any ideas about the reason and possible solutions. Thank you!
You may find the output on the m5term/telnet below. After that, is the process to prepare the disk image and the kernel for reference.
The last part of the terminal of gem5 (m5term/telnet):
# The full terminal output is here:
# https://gist.github.com/agyaglikci/018533c8d2ff2a9e86c9144d5f4a9224#file-ubuntu12-04-kernel3-2-1-gem5-terminal
Freeing unused kernel memory: 348k freed
Mount failed for selinuxfs on /sys/fs/selinux: No such file or directory
init: ureadahead main process (997) terminated with status 5
mknod: extra operand '64'
Try 'mknod --help' for more information.
mknod: extra operand '64'
Try 'mknod --help' for more information.
mknod: extra operand '64'
Try 'mknod --help' for more information.
mknod: extra operand '64'
Try 'mknod --help' for more information.
mknod: extra operand '64'
Try 'mknod --help' for more information.
mknod: extra operand '64'
Try 'mknod --help' for more information.
mknod: extra operand '64'
Try 'mknod --help' for more information.
mknod: extra operand '64'
Try 'mknod --help' for more information.
mknod: extra operand '64'
Try 'mknod --help' for more information.
mknod: extra operand '64'
Try 'mknod --help' for more information.
Here is the full story of preparing the disk image:
cd ${M5_PATH}
# Download and mount the disk image
wget http://cdimage.ubuntu.com/ubuntu-base/releases/12.04/release/ubuntu-base-12.04.4-core-amd64.tar.gz
sudo util/gem5img.py init disks/ubuntu-12.04.img 4096
mkdir mnt
sudo util/gem5img.py mount disks/ubuntu-12.04.img mnt
sudo tar xzvf ubuntu-base-12.04.4-core-amd64.tar.gz -C mnt
sudo cp /etc/resolv.conf mnt/etc/
# Nano is used to paste the contents in http://www.lowepower.com/jason/creating-disk-images-for-gem5.html
sudo nano mnt/etc/init/tty-gem5.conf
sudo nano mnt/etc/hosts
sudo nano mnt/etc/fstab
# Copy m5 Binary
cd util/m5
make clean
make all -f Makefile.x86
sudo cp m5 ${M5_PATH}/mnt/sbin/
cd ${M5_PATH}
sudo umount mnt
sudo losetup -d /dev/loop0
The steps for kernel compilation:
I downloaded v3.2.1 then copied the config file of v2.6.28.4 as .config file of v3.2.1. After hitting make vmlinux
, pressed enter for each question to get the default value.
cd ~
git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git
cd linux-stable
git checkout v3.2.1
wget http://www.m5sim.org/dist/current/x86/config-x86.tar.bz2
tar jxvf config-x86.tar.bz2
cp configs/linux-2.6.28.4 .config
make clean
make vmlinux -j 4
# Here compiler asks a lot of configurations, I just hit enter each time to pass the default values.
cp vmlinux ${M5_PATH}/binaries/vmlinux-amd64-v3.2.1
Finally, the command comes like this:
build/X86/gem5.opt -d AMD64 configs/example/fs.py --disk-image ${M5_PATH}/disks/ubuntu-12.04.img --kernel ${M5_PATH}/binaries/vmlinux-amd64-3.2.1
Any comment about the error messages or the reason/solution of freezing etc. would be very helpful. Thanks in advance!
回答1:
The best solution to boot FS mode is the following, but IMHO Ubuntu is not a good option, because systemd slows down the boot phase a lot:
Compile the linux kernel using this config file. The kernel 4.8.13 should work (Credits go to Jason Lowe Power, one of the reviewers of gem5).
Now what you want is the image of the system. The best option is this image based on gentoo.
来源:https://stackoverflow.com/questions/37906425/booting-gem5-x86-ubuntu-full-system-simulation