静态编译qemu_如何用QEMU运行x86 kernel

最近在提交cpufreq patch,稍微有点逻辑改动的Rafael都要你test, test。有个改动涉及setpolicy driver,要验证,第一印象就是用qemu。

让我们来看下如何搭环境(initrd=ramdisk):

my linux server(xeon) for building can not access internet,also vb under win is not. install qemu deb offline has too many dependens, forget it, let admin apt-get qemu(qemu-system-x86_64), it's done.

I have already download the linux-pm git repo, below operations r based on this code.

kernel编译

1.generate .configmake O=out_x86_64/ x86_64_defconfig

btw: gcc is default for x86_64 in xeon.tj@bsvr:/sys/devices/system/cpu/cpu0/cpufreq$ file /usr/bin/gcc

/usr/bin/gcc: symbolic link to `gcc-4.8'

tj@bsvr:/sys/devices/system/cpu/cpu0/cpufreq$ file /usr/bin/gcc-4.8

/usr/bin/gcc-4.8: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=fd10e59c8b3fd9ff72ecb1586fa83be45e339f7b, stripped

2.makemake O=out_x86_64/ bzImage -j8

遇到了错误:You are building kernel with non-retpoline compiler.

Please update your compiler.

make[1]: *** [checkbin] Error 1

直接disable RETPOLINE:arch/x86/Kconfig:

config RETPOLINE

bool "Avoid speculative indirect branches in kernel"

- default y

+ default n

继续又错:error: Cannot generate ORC metadata for CONFIG_UNWINDER_ORC=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel

我们用menuconfigmake O=out_x86_64/ menuconfig

改选Frame pointer...Kernel hacking > Choose kernel unwi

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值