From 6c4bd921e102d7859d4fc51397eef86876962fce Mon Sep 17 00:00:00 2001 From: "rick.chan" Date: Mon, 27 Jul 2020 10:33:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20=E7=8B=AC=E7=AB=8B?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E7=9A=84=E7=BC=96=E8=AF=91.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: rick.chan --- .../Linux/Kernel/Linux_Kernel_开发总结.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Software/Development/OperatingSystem/Linux/Kernel/Linux_Kernel_开发总结.md b/Software/Development/OperatingSystem/Linux/Kernel/Linux_Kernel_开发总结.md index ff91ed5..ef5816c 100644 --- a/Software/Development/OperatingSystem/Linux/Kernel/Linux_Kernel_开发总结.md +++ b/Software/Development/OperatingSystem/Linux/Kernel/Linux_Kernel_开发总结.md @@ -17,9 +17,27 @@ make modules_install INSTALL_MOD_PATH= make clean # 类似 make clean,但同时也将configure生成的文件全部删除掉,包括Makefile。 make distclean +``` +## 独立模块的编译 + +有些模块在开发时往往独立于内核进行组织和编译,其编译方法如下: + +```bash # 独立于内核源码编译内核外部模块,-C 指定内核源码目录(必须已经编译过),M 指定外部模块所在源码目录 make -C M= modules +# 清除外部模块的编译结果 +make -C M= clean +``` + +以上命令经常以下列形式写入到 Makefile 中: + +```Makefile +all: + $(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules + +clean: + $(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean ``` ## make menuconfig 常用快捷键