2011-01-10 13 views
0

は、私が10.10のUbuntuを使う -コンパイルLinuxカーネルモジュール(lincan)

2.6.35.23-ジェネリック私はlincanモジュール(http://sourceforge.net/projects/ocera/)をコンパイルしたいが、それはdoesnの私が望むような仕事は...それは私の最初のカーネルモジュールのコンパイルです。私はこれをしました:

最初にlincan-sourcesを私のホームディレクトリに解凍しました。

make -C /home/x/can/lincan-0.3.4/src SOURCES_DIR=/home/x/can/lincan-0.3.4/src default ; make -C /home/x/can/lincan-0.3.4/utils SOURCES_DIR=/home/x/can/lincan-0.3.4/utils default ; 
awk: cannot open /lib/modules/2.6.35-23-generic/build/include/linux/autoconf.h (No such file or directory) 
awk: cannot open /lib/modules/2.6.35-23-generic/build/include/linux/autoconf.h (No such file or directory) 
grep: /lib/modules/2.6.35-23-generic/build/include/linux/utsrelease.h: No such file or directory 
make[1]: Betrete Verzeichnis '/home/x/can/lincan-0.3.4/src' 
Makefile:216: /lib/modules/2.6.35-23-generic/build/Rules.make: No such file or directory 
make[1]: *** Keine Regel, um »/lib/modules/2.6.35-23-generic/build/Rules.make« zu erstellen. Schluss. 
make[1]: Verlasse Verzeichnis '/home/x/can/lincan-0.3.4/src' 
make[1]: Betrete Verzeichnis '/home/x/can/lincan-0.3.4/utils' 
cc -I../include -O2 -Wall -c -o rxtx.o rxtx.c 
rxtx.c: In function ‘main’: 
rxtx.c:49: warning: format not a string literal and no format arguments 
rxtx.c:73: warning: format not a string literal and no format arguments 
rxtx.c:51: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result 
rxtx.c:58: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result 
rxtx.c:62: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result 
rxtx.c:67: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result 
rxtx.c:75: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result 
rxtx.c:81: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result 
cc rxtx.o -o rxtx 
cc -I../include -O2 -Wall -c -o sendburst.o sendburst.c 
cc sendburst.o -o sendburst 
cc -I../include -O2 -Wall -c -o readburst.o readburst.c 
cc readburst.o -o readburst 
cc -I../include -O2 -Wall -c -o send.o send.c 
send.c: In function ‘main’: 
send.c:25: warning: format not a string literal and no format arguments 
send.c:27: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result 
send.c:33: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result 
send.c:35: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result 
send.c:40: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result 
cc send.o -o send 
cc -I../include -O2 -Wall can-proxy.c -o can-proxy 
make[1]: Verlasse Verzeichnis '/home/x/can/lincan-0.3.4/utils' 

それから私は "make install" を入力します:

make -C /home/x/can/lincan-0.3.4/src SOURCES_DIR=/home/x/can/lincan-0.3.4/src install ; make -C /home/x/can/lincan-0.3.4/utils SOURCES_DIR=/home/x/can/lincan-0.3.4/utils install ; 
awk: cannot open /lib/modules/2.6.35-23-generic/build/include/linux/autoconf.h (No such file or directory) 
awk: cannot open /lib/modules/2.6.35-23-generic/build/include/linux/autoconf.h (No such file or directory) 
grep: /lib/modules/2.6.35-23-generic/build/include/linux/utsrelease.h: No such file or directory 
make[1]: Betrete Verzeichnis '/home/x/can/lincan-0.3.4/src' 
Makefile:216: /lib/modules/2.6.35-23-generic/build/Rules.make: No such file or directory 
make[1]: *** Keine Regel, um »/lib/modules/2.6.35-23-generic/build/Rules.make« zu erstellen. Schluss. 
make[1]: Verlasse Verzeichnis '/home/x/can/lincan-0.3.4/src' 
make[1]: Betrete Verzeichnis '/home/x/can/lincan-0.3.4/utils' 
echo Nothing to install 
Nothing to install 
make[1]: Verlasse Verzeichnis '/home/x/can/lincan-0.3.4/utils' 

そして、それは何も起こっていないし、この出力を "作る" excecuted。カーネルモジュールが見つかりません。何が間違っていたのですか? autoconf.hと他のファイルがないのはなぜですか?私に何かヒントはありますか?ありがとう!


ここで、不足しているファイル(autoconf.hとutsrelease.h)のハードリンクを作成しました。それらは/usr/src/linux-headers-2.6.35.23-generic/include/generated/にあります。

これでさらにコンパイルされました。これは、最初に表示されるエラーです:

In file included from /home/x/can/lincan-0.3.4/src/../include/main.h:38, 
       from /home/x/can/lincan-0.3.4/src/proc.c:37: 
/home/x/can/lincan-0.3.4/src/../include/./can_queue.h: In function ‘canque_edge_decref’: 
/home/x/can/lincan-0.3.4/src/../include/./can_queue.h:652: error: invalid initializer 
/home/x/can/lincan-0.3.4/src/../include/./can_queue.h:652: error: invalid initializer 
/home/x/can/lincan-0.3.4/src/../include/./can_queue.h:652: error: incompatible types when assigning to type ‘int’ from type ‘atomic_t’ 
make[3]: *** [/home/x/can/lincan-0.3.4/src/proc.o] Fehler 1 
make[2]: *** [_module_/home/x/can/lincan-0.3.4/src] Fehler 2 
make[2]: Verlasse Verzeichnis '/usr/src/linux-headers-2.6.35-23-generic' 
make[1]: *** [make_this_module] Fehler 2 
+0

あなたはubuntuサイトでもっと運が良いかもしれませんか? – R0MANARMY

答えて

1

は、今私は不足しているファイル(をautoconf.hとutsrelease.h)のためのハードリンクを作成しました。あなたが実行しているカーネルをビルドしたときに作成されたとしてビルド環境を含むパッケージをインストールする必要が

。ソースは一般的に無意味です(外部モジュールをビルドしようとすると、とにかく8139too.cで何をしたいのですか)、カーネルヘッダを保存してください。 Debianやその子孫のどこにビルド環境があるのか​​は言えませんが、openSUSEには、例えば、utsrelease.hautoconf.hを含む "kernel-default-devel"パッケージがあります。ファイルが必要です。したがって、これを含む既存のdebパッケージを探してください。

+0

Ubuntuでは、linux-headers- * package:https://packages.ubuntu.com/search?suite=all&searchon=names&keywords=linux-headerまたは 'sudo apt-get install linux-headers-generic'をインストールします – osgx

-1

カーネルビルドの前提条件をインストールしてください。here.これは、カーネルモジュールのビルド/コンパイルに必要なツールをインストールします。

+0

これはですubuntuは、linux-header- *パケットでカーネルモジュールビルドに必要なすべてのファイルを持っています:https://packages.ubuntu.com/search?suite=all&searchon=names&keywords=linux-header; https://kernelnewbies.org/KernelBuildからリンクされたKernelBuildは、新しいカーネルを構築するためのものです。 – osgx

関連する問題