换了自己的新disk image
1)把img文件复制到disks文件夹下
2)修改gem5/configs/commons/Benchmark.py,改掉img名称,这都是前面的文章中提过的。
重新启动gem5的全系统时,在m5term连接时,报错:
VFS: Mounted root (ext2 filesystem).
Freeing unused kernel memory: 232k freed
FATAL: kernel too old
Kernel panic - not syncing: Attempted to kill init!
通过
zzh@ubuntu14:~/gem5/mnt/lib/x86_64-linux-gnu$ file libc-2.19.so
libc-2.19.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), BuildID[sha1]=b571f83a8a6f5bb22d3558cddda9f943a2a67fd1, for GNU/Linux 2.6.24, stripped
所以觉得应该要换2.6.24版本或者2.6.28.4版本的内核,现在用的是x86_64-vmlinux-2.6.22.9
1)下载内核(https://www.kernel.org/pub/linux/kernel/v2.6/)
zzh@ubuntu14:~/gem5/x86Dist$ wget https://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.28.4.tar.gz
解压:
zzh@ubuntu14:~/gem5/x86Dist$ tar xzvf linux-2.6.28.4.tar.gz
zzh@ubuntu14:~/gem5/x86Dist/linux-2.6.28.4$ ls
2)复制config文件
zzh@ubuntu14:~/gem5/x86Dist/linux-2.6.28.4$ cp ~/gem5/x86Dist/configs/linux-2.6.28.4 .config
注意,这是个隐藏文件
zzh@ubuntu14:~/gem5/x86Dist/linux-2.6.28.4$ ls -a
3)编译:
zzh@ubuntu14:~/gem5/x86Dist/linux-2.6.28.4$ make vmlinux
报错一:
CC arch/x86/vdso/vgetcpu.o
CC arch/x86/vdso/vvar.o
VDSO arch/x86/vdso/vdso.so.dbg
gcc: error: elf_x86_64: No such file or directory
gcc: error: unrecognized command line option ‘-m’
make[1]: *** [arch/x86/vdso/vdso.so.dbg] Error 1
make: *** [arch/x86/vdso] Error 2
修改一个Makefile文件
zzh@ubuntu14:~/gem5/x86Dist/linux-2.6.28.4/arch/x86/vdso$ vim Makefile
28行的
VDSO_LDFLAGS_vdso.lds = -m elf_x86_64 -Wl,-soname=Linux-vdso.so.1 \
改成-m64
72行的
VDSO_LDFLAGS_vdso32.lds = -m elf_i386 -Wl,-soname=linux-gate.so.1
改成-m32
报错二:
kernel/built-in.o: In function `mutex_lock':
/home/zzh/gem5/x86Dist/linux-2.6.28.4/kernel/mutex.c:93: undefined reference to `__mutex_lock_slowpath'
kernel/built-in.o: In function `mutex_unlock':
/home/zzh/gem5/x86Dist/linux-2.6.28.4/kernel/mutex.c:118: undefined reference to `__mutex_unlock_slowpath'
make: *** [.tmp_vmlinux1] Error 1
这里是需要低版本的gcc就可以 4.4版本是OK的
重新编译,没问题了。
zzh@ubuntu14:~/gem5/x86Dist/linux-2.6.28.4$ make CC=gcc-4.4
4)放到binaries目录下
zzh@ubuntu14:~/gem5/x86Dist/linux-2.6.28.4$ cp vmlinux ~/gem5/x86Dist/binaries/
5)重新启动gem5
重新启动gem5
zzh@ubuntu14:~/gem5$ sudo build/X86/gem5.opt configs/example/fs.py --disk-image=ubuntu-14.04.img --kernel=/home/zzh/gem5/x86Dist/binaries/vmlinux