Linux:modpost不会构建任何东西 [英] Linux: modpost does not build anything

查看:265
本文介绍了Linux:modpost不会构建任何东西的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有问题让我的机器上建立任何内核模块。每当我创建一个模块时,modpost总是说有零个模块:

  MODPOST 0模块


<$ <

>

  #include< linux / module.h> / *所有模块都需要* / 
#include< linux / kernel.h> / *需要KERN_INFO * /
#include< linux / init.h> / *需要宏* /

static int __init hello_start(void)
{
printk(KERN_INFO正在载入hello模块... \\\
);
printk(KERN_INFOHello world \\\
);
返回0;


static void __exit hello_end(void)
{
printk(KERN_INFOGoodbye Mr.\\\
);
}

module_init(hello_start);
module_exit(hello_end);

以下是模块的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

当我在我的机器上构建它时,我得到以下输出:

  make -C /lib/modules/2.6.32-27-generic/build M = / home / waffleman / tmp / mod-test modules 
make [1] :进入目录`/usr/src/linux-headers-2.6.32-27-generic'
CC [M] /home/waffleman/tmp/mod-test/hello.o
构建模块,第2阶段。
MODPOST 0模块
make [1]:离开目录`/usr/src/linux-headers-2.6.32-27-generic'

当我在另一台机器上创建模块时,该模块成功:

  make -C /lib/modules/2.6.24-27-generic/build M = / home / somedude / tmp / mod-test modules 
ma ke [1]:进入目录`/usr/src/linux-headers-2.6.24-27-generic'
CC [M] /home/somedude/tmp/mod-test/hello.o
构建模块,阶段2.
MODPOST 1模块
CC /home/somedude/tmp/mod-test/hello.mod.o
LD [M] / home / somedude / tmp / mod-test / hello.ko
make [1]:离开目录`/usr/src/linux-headers-2.6.24-27-generic'

我查找了有关modpost的任何相关文档,但发现很少。任何人都知道modpost是如何决定构建什么的?有没有我可能缺少的环境?



这里是我正在运行的程序:

  uname -a 
Linux waffleman-desktop 2.6.32-27-generic#49 -Ubuntu SMP Wed Dec 1 23:52:12 UTC 2010 i686 GNU / Linux






编辑

以下是使用V = 1运行的版本:

  make -C /lib/modules/2.6。 32-27-generic / build M = / home / waffleman / tmp / mod-test modules $ b $ make [1]:进入目录`/usr/src/linux-headers-2.6.32-27-generic'
test -e include / linux / autoconf.h -a -e include / config / auto.conf || (\
echo; \
echoERROR:Kernel configuration is invalid。; \
echoinclude / linux / autoconf.h或include / config / auto.conf丢失; \
echoRun'make oldconfig&& make'在内核src上进行修复; \
echo; \
/ bin / false )
mkdir -p /home/waffleman/tmp/mod-test/.tmp_versions; rm -f /home/waffleman/tmp/mod-test/.tmp_versions/*
make -f scripts / Makefile.build obj = / home / waffleman / tmp / mod-test
gcc -Wp, -MD,/ home / waffleman / tmp / mod-test / .hello.od -nostdinc -isystem /usr/lib/gcc/i486-linux-gnu/4.4.3/include -Iinclude -I / usr / src / linux -headers-2.6.32-27-generic / arch / x86 / include -include include / linux / autoconf.h -Iubuntu / include -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing - fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -O2 -m32 -msoft-float -mregparm = 3 -freg-struct-return -mpreferred-stack- boundary = 2 -march = i586 -mtune = generic -maccumulate-outgoing-args -Wa,-mtune = generic32 -freestanding -fstack-protector -DCONFIG_AS_CFI = 1 -DCONFIG_AS_CFI_SIGNAL_FRAME = 1 -pipe -Wno-sign-compare -fno-asynchronous -unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -Wframe-greater-than = 1024 -fno-omit-frame-pointer -fno-optimize -sibling-calls -pg -Wdeclaration-after - 陈述-Wn O-pointer-sign -fno-strict-overflow -fno-dwarf2-cfi-asm -fconserve-stack -DMODULE -DKBUILD_STR(s)=#s-DKBUILD_BASENAME = KBUILD_STR(hello)-DKBUILD_MODNAME = KBUILD_STR(hello)-c -o /home/waffleman/tmp/mod-test/.tmp_hello.o /home/waffleman/tmp/mod-test/hello.c
set -e; perl /usr/src/linux-headers-2.6.32-27-generic/scripts/recordmcount.pli38632objdumpobjcopygccldnm1 /home/waffleman/tmp/mod-test/hello.o;
(cat / dev / null; echo kernel // home / waffleman / tmp / mod-test / hello.ko;)> /home/waffleman/tmp/mod-test/modules.order
make -f /usr/src/linux-headers-2.6.32-27-generic/scripts/Makefile.modpost
scripts / mod / modpost -m -a -i /usr/src/linux-headers-2.6.32-27-generic/Module.symvers -I /home/waffleman/tmp/mod-test/Module.symvers -o / home / waffleman /tmp/mod-test/Module.symvers -S -w -s
make [1]:离开目录`/usr/src/linux-headers-2.6.32-27-generic'
waffleman @ waffleman-desktop:〜/ tmp / mod-test $ cat /home/waffleman/tmp/mod-test/modules.order
kernel // home / waffleman / tmp / mod-test / hello.ko


解决方案

错误神秘地消失了。如果有人有一个想法可能会导致这种情况。我想知道下次有没有。


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 modules

To troubleshoot the problem, I wrote a test module (hello.c):

#include <linux/module.h>       /* Needed by all modules */
#include <linux/kernel.h>       /* Needed for KERN_INFO */
#include <linux/init.h>         /* Needed for the macros */

static int __init hello_start(void)
{
printk(KERN_INFO "Loading hello module...\n");
printk(KERN_INFO "Hello world\n");
return 0;
}

static void __exit hello_end(void)
{
printk(KERN_INFO "Goodbye Mr.\n");
}

module_init(hello_start);
module_exit(hello_end);

Here is the Makefile for the module:

obj-m = hello.o
KVERSION = $(shell uname -r)
all:
        make -C /lib/modules/$(KVERSION)/build M=$(shell pwd) modules
clean:
        make -C /lib/modules/$(KVERSION)/build M=$(shell pwd) clean

When I build it on my machine, I get the following output:

make -C /lib/modules/2.6.32-27-generic/build M=/home/waffleman/tmp/mod-test modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.32-27-generic'
  CC [M]  /home/waffleman/tmp/mod-test/hello.o
  Building modules, stage 2.
  MODPOST 0 modules
make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-27-generic'

When I make the module on another machine, it is successful:

make -C /lib/modules/2.6.24-27-generic/build M=/home/somedude/tmp/mod-test modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.24-27-generic'
  CC [M]  /home/somedude/tmp/mod-test/hello.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /home/somedude/tmp/mod-test/hello.mod.o
  LD [M]  /home/somedude/tmp/mod-test/hello.ko
make[1]: Leaving directory `/usr/src/linux-headers-2.6.24-27-generic'

I looked for any relevant documentation about modpost, but found little. Anyone know how modpost decides what to build? Is there an environment that I am possibly missing?

BTW here is what I am running:

uname -a
Linux waffleman-desktop 2.6.32-27-generic #49-Ubuntu SMP Wed Dec 1 23:52:12 UTC 2010 i686 GNU/Linux


Edit

Here is make ran with V=1:

make -C /lib/modules/2.6.32-27-generic/build M=/home/waffleman/tmp/mod-test modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.32-27-generic'
test -e include/linux/autoconf.h -a -e include/config/auto.conf || (        \
    echo;                               \
    echo "  ERROR: Kernel configuration is invalid.";       \
    echo "         include/linux/autoconf.h or include/config/auto.conf are missing.";  \
    echo "         Run 'make oldconfig && make prepare' on kernel src to fix it.";  \
    echo;                               \
    /bin/false)
mkdir -p /home/waffleman/tmp/mod-test/.tmp_versions ; rm -f /home/waffleman/tmp/mod-test/.tmp_versions/*
make -f scripts/Makefile.build obj=/home/waffleman/tmp/mod-test
  gcc -Wp,-MD,/home/waffleman/tmp/mod-test/.hello.o.d  -nostdinc -isystem /usr/lib/gcc/i486-linux-gnu/4.4.3/include  -Iinclude  -I/usr/src/linux-headers-2.6.32-27-generic/arch/x86/include -include include/linux/autoconf.h -Iubuntu/include  -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -O2 -m32 -msoft-float -mregparm=3 -freg-struct-return -mpreferred-stack-boundary=2 -march=i586 -mtune=generic -maccumulate-outgoing-args -Wa,-mtune=generic32 -ffreestanding -fstack-protector -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -Wframe-larger-than=1024 -fno-omit-frame-pointer -fno-optimize-sibling-calls -pg -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fno-dwarf2-cfi-asm -fconserve-stack  -DMODULE -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(hello)"  -D"KBUILD_MODNAME=KBUILD_STR(hello)"  -c -o /home/waffleman/tmp/mod-test/.tmp_hello.o /home/waffleman/tmp/mod-test/hello.c
  set -e ; perl /usr/src/linux-headers-2.6.32-27-generic/scripts/recordmcount.pl "i386" "32" "objdump" "objcopy" "gcc" "ld" "nm" "" "" "1" "/home/waffleman/tmp/mod-test/hello.o";
(cat /dev/null;   echo kernel//home/waffleman/tmp/mod-test/hello.ko;) > /home/waffleman/tmp/mod-test/modules.order
make -f /usr/src/linux-headers-2.6.32-27-generic/scripts/Makefile.modpost
  scripts/mod/modpost -m -a -i /usr/src/linux-headers-2.6.32-27-generic/Module.symvers -I /home/waffleman/tmp/mod-test/Module.symvers  -o /home/waffleman/tmp/mod-test/Module.symvers -S -w  -s
make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-27-generic'
waffleman@waffleman-desktop:~/tmp/mod-test$ cat /home/waffleman/tmp/mod-test/modules.order
kernel//home/waffleman/tmp/mod-test/hello.ko

解决方案

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.

这篇关于Linux:modpost不会构建任何东西的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆