最近在提交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