启动gem5 X86 Ubuntu完整系统仿真

时间:2016-06-19 10:51:19

标签: linux-kernel ubuntu-12.04 x86-64 diskimage gem5

我需要在gem5上运行相对较新版本的x86磁盘映像。从this guide开始,我使用Ubuntu 12.04磁盘映像和Kernel v3.2.1,因为该组合适用于其他人。

经过一段时间,模拟器刚挂起,请分享有关原因和可能的解决方案的任何想法。谢谢!

您可以在下面的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

关于错误消息或冻结等原因/解决方案的任何评论都会非常有帮助。提前谢谢!

1 个答案:

答案 0 :(得分:0)

启动FS模式的最佳解决方案如下,但IMHO Ubuntu不是一个好选择,因为systemd大大减慢了启动阶段:

使用this配置文件编译linux内核。内核4.8.13应该可以工作(Credits转到Jason Lowe Power,gem5的审核者之一。)

现在你想要的是系统的形象。最好的选择是this image基于gentoo。