我正在編譯Hello World
模塊。我在我的系統中有一個新的Ubuntu,它沒有任何編譯好的內核。如何根據新的源編譯內核模塊
我的內核是:
2.6.32-34-通用
我給下面的Makefile並得到了錯誤:
obj-m += hello-1.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
# make
make -C /lib/modules/2.6.32-34-generic/build M=/home/james/Desktop/hello modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.32-34-generic'
make[2]: *** No rule to make target `/home/james/Desktop/hello/hello-1.c', needed by `/home/james/Desktop/hello/hello-1.o'. Stop.
make[1]: *** [_module_/home/james/Desktop/hello] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-34-generic'
make: *** [all] Error 2
我/lib/modules/2.6的內容.32-34-generic是
total 3864
lrwxrwxrwx 1 root root 40 2011-11-05 15:55 build -> /usr/src/linux-headers-2.6.32-34-generic
drwxr-xr-x 2 root root 4096 2011-11-05 15:49 initrd
drwxr-xr-x 10 root root 4096 2011-11-05 15:49 kernel
.......................................................
.......................................................
存在文件夾/usr/src/linux-headers-2.6.32-34-generic
。
由於沒有工作,我下載了linux-headers-2.6.32-34-generic source from Ubuntu,並編譯和改變了我的Makefile文件:
obj-m += hello-1.o
all:
make -C /usr/src/linux-2.6.32/ M=$(PWD) modules
clean:
make -C /usr/src/linux-2.6.32/ M=$(PWD) clean
#make
make -C /usr/src/linux-2.6.32/ M=/home/james/Desktop/hello modules
make[1]: Entering directory `/usr/src/linux-2.6.32'
ERROR: Kernel configuration is invalid.
include/linux/autoconf.h or include/config/auto.conf are missing.
Run 'make oldconfig && make prepare' on kernel src to fix it.
WARNING: Symbol version dump /usr/src/linux-2.6.32/Module.symvers
is missing; modules will have no dependencies and modversions.
make[2]: *** No rule to make target `/home/james/Desktop/hello/hello-1.c', needed by `/home/james/Desktop/hello/hello-1.o'. Stop.
make[1]: *** [_module_/home/james/Desktop/hello] Error 2
make[1]: Leaving directory `/usr/src/linux-2.6.32'
make: *** [all] Error 2
有人能幫助我解決this.http://packages.ubuntu.com/lucid-updates/devel /linux-headers-2.6.32-34-generic
我有一些一般的問題要問。
全新安裝後編譯內核的最佳方式是什麼?在我編譯內核並構建了一個模塊之後,它的工作完美無缺。但是我不可能知道在這種情況下該怎麼做這個