Linux: modpost does not build anything

前端 未结 12 1044
-上瘾入骨i
-上瘾入骨i 2020-12-20 14:58

I am having problems getting any kernel modules to build on my machine. Whenever I build a module, modpost always says there are zero modules:

MODPOST 0 modu         


        
相关标签:
12条回答
  • 2020-12-20 15:10

    On the machine that fails does your .config have module support disabled?

    Try doing "make menuconfig" and make sure module support is enabled.

    0 讨论(0)
  • 2020-12-20 15:16

    I just ran into this same problem and for me it was caused by changing the default grep options via the GREP_OPTIONS environment variable. I didn't dig into the details, but something in the module build process didn't like my alternate grep output (include file name and line number). Removing the GREP_OPTIONS environment variable fixed things right up.

    0 讨论(0)
  • 2020-12-20 15:16

    Try to remove modules string from the Makefile:

    obj-m = hello.o
    KVERSION = $(shell uname -r)
    all:
            make -C /lib/modules/$(KVERSION)/build M=$(shell pwd) # <--
    clean:
            make -C /lib/modules/$(KVERSION)/build M=$(shell pwd) clean
    
    0 讨论(0)
  • 2020-12-20 15:17

    In another thread I found that when I copy pasted the makefile contents, the -C after make was using the wrong "-" symbol and I had to re type it. It just so happens that this is the case for the obj-m += ... line above. You need to retype that character to make it valid. This should hopefully be found by anyone following the hello world module tutorial.

    0 讨论(0)
  • 2020-12-20 15:17

    This happens because when you copy the make file contents from the PDF or any other tutorial websites and use it as it is. While you do a copy-paste, the contents will appear a bit weird in Linux environment. ie; Some special character issues will be there. If you retype the contents in Linux environment and do a make, this should work.

    0 讨论(0)
  • 2020-12-20 15:18

    The error mysteriously went away. If anyone has an idea what could cause this. I'd like to know in case there is a next time.

    0 讨论(0)
提交回复
热议问题