📄 building_modules.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head> <title></title> <link rel="stylesheet" media="screen" type="text/css" href="./style.css" /> <link rel="stylesheet" media="screen" type="text/css" href="./design.css" /> <link rel="stylesheet" media="print" type="text/css" href="./print.css" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head><body><a href=start.html>start</a></br><h2><a name="building_2.6_kernel_modules" id="building_2.6_kernel_modules">Building 2.6 Kernel Modules</a></h2><div class="level2"><p> A new method is used to trigger the kernel to build a module outside the kernel tree. The device drivers section will show you how to simply add module building instructions to a normal kernel makefile</p><p> Here is an example of a 2.6 module makefile ( out of tree ) </p><pre class="code"> ifneq ($(KERNELRELEASE),) ################################################## # PASS 2 do this when called by the kernel make process ################################################## # produce a module from a single C fileobj-$(CONFIG_MYMOD) += mymod.o# or produce a module from multiple C files # obj-$(CONFIG_MYMOD) += mymod.o # mymod-objs := mymod_main.o mymod_lib.o mymod_io.o else ################################################## # PASS 1 do this when called from the user make ################################################## KDIR := /home/student/work/uClinux-dist/linux-2.6.x PWD := $(shell pwd) default: <TAB>$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules install: <TAB>$(MAKE) -C $(KDIR) INSTALL_MOD_PATH=$(IDIR) \ SUBDIRS=$(PWD) modules_install endif </pre></div><h5><a name="kernel_module_out_of_tree_build" id="kernel_module_out_of_tree_build">Kernel Module out of tree build</a></h5><div class="level5"><p> The module build process can be instructed to place the modules in a different target directory and use source directories outside the kernel source tree.</p><p>When the modules needs to be installed under another directory the <strong>INSTALL_MOD_PATH</strong> directive can be used to prefix “/lib/modules” as seen in the following example: </p><pre class="code"> make INSTALL_MOD_PATH=/home/student/work/build/image modules_install </pre><p>This will install the modules in the directory </p><pre class="code"> /home/student/work/build/image/lib/modules. </pre><p>This directory can be a NFS mounted filesystem on another machine, allowing out-of-the-tree support for installation on remote machines. </p></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -