更新时间:2022-06-24 03:07:25
'所有并清理':-如果默认运行"make",它将运行"all:". 但是我们可以全部使用make进行清理.它只会运行那些特定的命令.
'all and clean' :- If you run 'make' by default it will run "all :". But we can use all and clean with make. it will run only those specific command.
Example :-
'make all' will run "make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules"
'make clean will run "make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean"
3.' uname -r ':-获取有关当前内核的名称和信息.
3.'uname -r' :- get name and information about current kernel.
Example :- for me, my kernel is "4.6.0-rc1".
选项" -C目录":-在读取makefile之前更改为目录dir.
Option ‘-C dir’ :- Change to directory dir before reading the makefiles.
Example :- "make -C /lib/modules/$(shell uname -r)/build" will change to "make -C /lib/modules/4.6.0-rc1/build.
现在,您要使用" make -C/lib/modules/$(shell uname -r)/build M = $(PWD)模块"来创建可加载模块.
Now you want to create your loadable module by using "make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules".
您的源代码需要运行环境.这就是为什么我们必须使用-C选项更改构建目录的原因.这些都具有所需的定义,头文件,宏等.现在,在更改构建目录后,您需要告诉您模块所在的位置,这就是我们使用M = $ PWD的原因.
Your source code need environment to run. That's why we have to use -C option to change build directory. Which have all needed definition, header file, Macro and etc. Now after changing to build directory you need to tell where is your module present, that's why we are using M=$PWD.