Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

"make -C $KDIR M=`pwd`"后加与不加"modules"的区别?

106 views
Skip to first unread message

TestKing

unread,
Aug 2, 2008, 12:38:15 AM8/2/08
to
编译内核模块,“make -C $KDIR M=`pwd`”和“make -C $KDIR M=`pwd` modules”的区别是什么?
我看makefiles.txt这篇文档里的说明分别是如下,不过我还是没看明白他们有什么区别,自己
拿了个模块示例代码用两种方式编译了一下,也没发现什么不同,请教一下各位,谢谢。
make -C $KDIR M=`pwd`
Will build the module(s) located in current directory.
All output files will be located in the same directory
as the module source.
No attempts are made to update the kernel source, and it is
a precondition that a successful make has been executed
for the kernel.

make -C $KDIR M=`pwd` modules
The modules target is implied when no target is given.
Same functionality as if no target was specified.
See description above.


--

[m [1;34m※ 来源:·水木社区 newsmth.net·[FROM: 124.65.129.*] [m

孤独的狐狸走在寂寞的路上

unread,
Aug 2, 2008, 1:33:02 AM8/2/08
to
看意思就是一样地。如果没有给出目标,那么隐含地指“modules”。

【 在 TestKing (TestKing) 的大作中提到: 】
: 编译内核模块,“make -C $KDIR M=`pwd`”和“make -C $KDIR M=`pwd` modules”的区别是什么?


: 我看makefiles.txt这篇文档里的说明分别是如下,不过我还是没看明白他们有什么区别,自己
: 拿了个模块示例代码用两种方式编译了一下,也没发现什么不同,请教一下各位,谢谢。

: ...................

--

[m [1;32m※ 来源:·水木社区 newsmth.net·[FROM: 118.146.163.*] [m

TestKing

unread,
Aug 2, 2008, 1:34:48 AM8/2/08
to
谢谢,:-)

【 在 solofox (孤独的狐狸走在寂寞的路上) 的大作中提到: 】
: 看意思就是一样地。如果没有给出目标,那么隐含地指“modules”。

天佑四川|为灾区人民祈祷

unread,
Aug 3, 2008, 5:02:07 AM8/3/08
to
make 编译内核,
make modules 编译内核模块

【 在 TestKing (TestKing) 的大作中提到: 】
: 编译内核模块,“make -C $KDIR M=`pwd`”和“make -C $KDIR M=`pwd` modules”的区别是什么?
: 我看makefiles.txt这篇文档里的说明分别是如下,不过我还是没看明白他们有什么区别,自己
: 拿了个模块示例代码用两种方式编译了一下,也没发现什么不同,请教一下各位,谢谢。
: ...................

--

[m [1;34m※ 来源:·水木社区 newsmth.net·[FROM: 124.200.35.*] [m

TestKing

unread,
Aug 3, 2008, 11:23:53 AM8/3/08
to
我试过,不加M=$(PWD)才是编译内核,我上面写的这两种编译方式,比较了一下结果,
都是一样的。

【 在 luohandsome (天佑四川|为灾区人民祈祷) 的大作中提到: 】
: make 编译内核,
: make modules 编译内核模块


--

[m [1;36m※ 来源:·水木社区 newsmth.net·[FROM: 221.223.229.*] [m

Jike Song

unread,
Aug 3, 2008, 11:22:53 PM8/3/08
to TestKing
不相信别人的回答,也要搞明白才可以:)

编译vmlinux、还是编译modules,和M=...无关。 M=$(shell pwd)只是告诉
kbuild,我在编译一个external module(不在内核tree里的)。

此外,如果我们想重新编译内核的一部分,例如drivers/net目录下的,可以:

$ make M=drivers/net clean
$ make M=drivers/net

0 new messages