4)Makefile
……DRIVERS-$(CONFIG_PLD) += drivers/pld/pld.oDRIVERS-$(CONFIG_TEST) += drivers/test/test.aDRIVERS-$(CONFIG_TEST_CPU) += drivers/test/cpu/test_cpu.aDRIVERS := $(DRIVERS-y)……
在顶层 Makefile 中加入 DRIVERS-$(CONFIG_TEST) += drivers/test/test.a 和 DRIVERS-$(CONFIG_TEST_CPU) += drivers/test/cpu/test_cpu.a。如何用户选择了 TEST Driver,那么 CONFIG_TEST 和 CONFIG_TEST_CPU 都是 y,test.a 和 test_cpu.a 就都位于 DRIVERS-y 列表中,然后又被放置在 DRIVERS 列表中。在前面曾经提到过,Linux 内核文件 vmlinux 的组成中包括 DRIVERS,所以 test.a 和 test_cpu.a 最终可被链接到 vmlinux 中。
参考资料
Document/kbuild/makefiles.txt,Linux Kernel Source code
Document/kbuild/config-language.txt,Linux Kernel Source code
Contributing to the Linux Kernel--The Linux Configuration System,Linux Journal, http://www.linuxjournal.com/categories.php?op=newindex&catid=178
Unreliable Guide To Hacking The Linux Kernel,Paul Rusty Russell,rusty@rustcorp.com.au
关于作者
汤凯,通过 tangk73@hotmail.com可以跟他联系。
