我需要在 gem5 上运行一个相对较新版本的 x86 磁盘映像。从本指南开始,我使用带有内核 v3.2.1 的 Ubuntu 12.04 磁盘映像,因为该组合适用于其他人。
过了一段时间,模拟器就挂了,请分享有关原因和可能解决方案的任何想法。谢谢!
您可以在下面的 m5term/telnet 上找到输出。之后,就是准备磁盘映像和内核以供参考的过程。
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.
以下是准备磁盘映像的完整故事:
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
内核编译步骤:
我下载了 v3.2.1,然后将 v2.6.28.4 的配置文件复制为 v3.2.1 的 .config 文件。点击 后make vmlinux
,为每个问题按回车键以获取默认值。
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
最后,命令是这样的:
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
任何关于错误消息或冻结原因/解决方案等的评论都会非常有帮助。提前致谢!