“FATAL: Module not found error” using modprobe

前端 未结 6 632
猫巷女王i
猫巷女王i 2021-01-31 18:03

I have a problem with modprobe command... I compiled the hello world module and loaded it with insmod, it works fine and when I do lsmod,

6条回答
  •  悲&欢浪女
    2021-01-31 18:45

    The best thing is to actually use the kernel makefile to install the module:

    Here is are snippets to add to your Makefile

    around the top add:

    PWD=$(shell pwd)
    VER=$(shell uname -r)
    KERNEL_BUILD=/lib/modules/$(VER)/build
    # Later if you want to package the module binary you can provide an INSTALL_ROOT
    # INSTALL_ROOT=/tmp/install-root
    

    around the end add:

    install:
            $(MAKE) -C $(KERNEL_BUILD) M=$(PWD) \
               INSTALL_MOD_PATH=$(INSTALL_ROOT) modules_install
    

    and then you can issue

        sudo make install
    

    this will put it either in /lib/modules/$(uname -r)/extra/

    or /lib/modules/$(uname -r)/misc/

    and run depmod appropriately

提交回复
热议问题