gem5全系统启动:FATAL: kernel too old

在使用gem5进行全系统启动时遇到'FATAL: kernel too old'错误。为解决此问题,需更换内核至2.6.24或2.6.28.4版本。首先下载对应内核,解压并复制.config配置文件。接着编译内核,处理Makefile中关于VDSO_LDFLAGS的错误。在遇到需要低版本gcc的报错后,使用4.4版本的gcc完成编译。最后将新内核放置于binaries目录,重启gem5,问题得到解决。

接上篇,换了自己的新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)下载内核

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
arch     CREDITS        drivers   include  Kbuild  MAINTAINERS  net             samples   sound
block    crypto         firmware  init     kernel  Makefile     README          scripts   usr
COPYING  Documentation  fs        ipc      lib     mm           REPORTING-BUGS  security  virt

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
.      config   crypto         fs          ipc     .mailmap     net             scripts   virt
..     .config  Documentation  .gitignore  Kbuild  MAINTAINERS  README          security
arch   COPYING  drivers        include     kernel  Makefile     REPORTING-BUGS  sound
block  CREDITS  firmware       init        lib     mm           samples         usr

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 \
把-m elf_x86_64改成-m64

72行的
VDSO_LDFLAGS_vdso32.lds = -m elf_i386 -Wl,-soname=linux-gate.so.1
把-m elf_i386 改成-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
评论 9
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值