内核模块选择操作方式:
选择模块是按Y会出现*,按M会出现M,按N可以取消选择。也可以按空格键从*切换到无,为大写M(键下大写M)表示编译成可动态加载的模块,*表示编译进入内核。
(iii)内核支持APIC
此外必须保证内核支持APIC(Advanced Programmable Interrupt Controller高级可编程中断控制器),这是因为后面papi要使用,所以请保证选中了APIC相关项,可以按"/",然后键入APIC,搜索以下与之相关的模块是否选择了,这个模块实际上在在Processor type and features选项下,模块选择完毕,可以使用命令grep PIC /usr/src/linux-2.6.19/.config查看apic是否选择,选择了的话应该显示CONFIG_X86_GOOD_APIC=y等字样,papi的INSTALL文件中说到“SMP(多核,对称多处理器)上默认选择了该项,但是UP(单处理器)上默认没选择”。
----------------------------------------------------------------------------------------
以下摘自perfctr的INSTALL文件
You should either configure with modules (CONFIG_MODULES=y) AND module
versions (CONFIG_MODVERSIONS=y), or completely without modules
(CONFIG_MODULES=n). Modules without module versions is an inherently
unsafe configuration which is not recommended.
Loadable module support选项
You should also enable at least CONFIG_PERFCTR, CONFIG_PERFCTR_VIRTUAL,
and CONFIG_PERFCTR_GLOBAL.
Processor type and features选项下的Performance-monitoring counters support(即PERFCTR)选项下的所有选项都选中
You may also select CONFIG_PERFCTR=m to build the bulk of the driver (或者设为M,编译成动态加载的模块)
as a loadable kernel module; the module will be named `perfctr'.
Note: The perfctr kernel patch adds one word to the `thread_struct'
type, which makes the patched kernel binary incompatible with an
unpatched one. This is why it is important to distinguish the patched
kernel via EXTRAVERSION and CONFIG_MODVERSIONS.
----------------------------------------------------------------------------------------
(7)修改/usr/src/linux-2.6.19/Makefile,加上扩展版本号,对该内核给一个标记,
EXTRAVERSION =-zkl-perfctr
这样做之后,您编译内核完成后,你的内核版本就是linux-2.6.19-zkl-perfctr
(8)编译内核
第一种做法=================================================================================
# make clean
# make vmlinux modules <使用此命令编译内核和模块> 动作完成后在/usr/src/linux-2.6.19/下生成了模块相关文件,例如在drivers中有很多相关文件
# make modules_install 安装模块,此命令会利用上面在/usr/src/linux-2.6.19/下生成的模块相关文件,对它们进行编译,在系统目录/lib/modules/2.6.19-zkl-perfctr下生成模块,例如可以在drivers中看到perfctr模块
# make bzImage 编译生成内核文件,/usr/src/linux-2.6.19/arch/x86_64/boot/目录下生成了内核文件bzImage
# make install 执行此命令必须保证之前生成了内核文件bzImage
sh /usr/src/linux-2.6.19/arch/x86_64/boot/install.sh 2.6.19-zkl-perfctr arch/x86_64/boot/bzImage System.map "/boot"
此命令等同于第二种方法中的(e),只不过使用make install命令会自动完成e中的几种动作,实现内核多重启动
=====================================================================================
或者
第二种做法
<建议使用第一种>
===============================================================================
(a) make clean 将之前生成的.o文件删除掉,这样不会产生新旧版本的误差
(b) make bzImage
命令执行成功将提示如下信息,在/usr/src/linux-2.6.19/arch/x86_64/boot/目录下生成了内核文件bzImage
Root device is (8, 3)
Boot sector 512 bytes.
Setup is 7252 bytes.
System is 1794 kB
Kernel: arch/x86_64/boot/bzImage is ready (#1)
(c) make modules 制作出模块相关的文件
(d) make modules_install 安装模块