将外部Linux内核模块安装到/ lib / modules /`uname -r` /目录中

时间:2014-04-20 07:04:05

标签: linux linux-kernel makefile linux-device-driver

我有一个小的USB驱动程序内核模块,现在我想将此模块安装到运行的内核目录中,即(/ lib / modules / uname -r /)。其中还应该更新modules.alias和modules.usbmap文件。

任何可用于安装外部内核模块的脚本?

由于

1 个答案:

答案 0 :(得分:1)

all:  
    make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules  

install:  
    make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules_install  

clean:
    make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean

“make”和“make install”

--- 5.2 INSTALL_MOD_DIR

External modules are by default installed to a directory under
/lib/modules/$(KERNELRELEASE)/extra/, but you may wish to
locate modules for a specific functionality in a separate
directory. For this purpose, use INSTALL_MOD_DIR to specify an
alternative name to "extra."

    $ make INSTALL_MOD_DIR=gandalf -C $KDIR \
           M=$PWD modules_install
    => Install directory: /lib/modules/$(KERNELRELEASE)/gandalf/