请问:最近刚买的mini2440单板,helloModule 加载和卸载无打印的问题。
1,首先按用户手册编译,此时会编译所有模块,耗时很长,最后还报错,如下:
[root@localhost linux-2.6.32.2]#
[root@localhost linux-2.6.32.2]# make modules -j2 > lf_log.txt
drivers/scsi/advansys.c:72:2: warning: #warning this driver is still not properly converted to the DMA API
drivers/scsi/advansys.c: In function 'advansys_get_sense_buffer_dma':
drivers/scsi/advansys.c:8352: error: implicit declaration of function 'dma_cache_sync'
make[2]: *** [drivers/scsi/advansys.o] 错误 1
make[1]: *** [drivers/scsi] 错误 2
make: *** [drivers] 错误 2
make: *** 正在等待未完成的任务....
[root@localhost linux-2.6.32.2]#
You have new mail in /var/spool/mail/root
[root@localhost linux-2.6.32.2]#
[root@localhost linux-2.6.32.2]#
2,然后直接单独模块:拷贝helloModule的源码、自己写了单独Makefile,编译后可成功加载,但无打印(确认了内核打印级别配置没问题)
[root@localhost hello]#
[root@localhost hello]# pwd ------- 在源码目录的driver新建hello文件夹,把mini2440自带的helloModul源码拷贝过来
/lf/linux-2.6.32.2/drivers/hello
[root@localhost hello]#
[root@localhost hello]#
[root@localhost hello]# ls
hello.c hello.ko hello.mod.c hello.mod.o hello.o Makefile modules.order Module.symvers
[root@localhost hello]#
hello.c--------------
#include <linux/kernel.h>
#include <linux/module.h>
static int __init mini2440_hello_module_init(void)
{
printk(KERN_ALERT "Hello, Mini2440 module is installed !\n");
return 0;
}
static void __exit mini2440_hello_module_cleanup(void)
{
printk(KERN_INFO "Good-bye, Mini2440 module was removed!\n");
}
module_init(mini2440_hello_module_init);
module_exit(mini2440_hello_module_cleanup);
MODULE_LICENSE("GPL");
~
~
Makefile--------------源码目录的driver/hello下新建一个Makefile文件
obj-m += hello.o
all:
#echo $(CURDIR) #注意行首是tab
make -C /lf/linux-2.6.32.2 M=$(CURDIR) modules
clean:
make -C /lf/linux-2.6.32.2 M=$(CURDIR) clean
~
~
附:环境信息=========================================================
mini2440 + 3.5"LCD 套餐
主机编译环境如下:
[root@localhost char]# uname -a
Linux localhost.localdomain 2.6.25-14.fc9.i686 #1 SMP Thu May 1 06:28:41 EDT 2008 i686 i686 i386 GNU/Linux
[root@localhost char]# arm-linux-gcc -v
Using built-in specs.
Target: arm-none-linux-gnueabi
Configured with: /opt/FriendlyARM/mini2440/build-toolschain/working/src/gcc-4.4.3/configure --build=i386-build_redhat-linux-gnu --host=i386-build_redhat-
linux-gnu --target=arm-none-linux-gnueabi --prefix=/opt/FriendlyARM/toolschain/4.4.3 --with-sysroot=/opt/FriendlyARM/toolschain/4.4.3/arm-none-linux-
gnueabi//sys-root --enable-languages=c,c++ --disable-multilib --with-arch=armv4t --with-cpu=arm920t --with-tune=arm920t --with-float=soft --with-
pkgversion=ctng-1.6.1 --disable-sjlj-exceptions --enable-__cxa_atexit --with-gmp=/opt/FriendlyARM/toolschain/4.4.3 --with-
mpfr=/opt/FriendlyARM/toolschain/4.4.3 --with-ppl=/opt/FriendlyARM/toolschain/4.4.3 --with-cloog=/opt/FriendlyARM/toolschain/4.4.3 --with-
mpc=/opt/FriendlyARM/toolschain/4.4.3 --with-local-prefix=/opt/FriendlyARM/toolschain/4.4.3/arm-none-linux-gnueabi//sys-root --disable-nls --enable-
threads=posix --enable-symvers=gnu --enable-c99 --enable-long-long --enable-target-optspace
Thread model: posix
gcc version 4.4.3 (ctng-1.6.1)
[root@localhost char]#
单板内核和内存如下:
[root@FriendlyARM /]# uname -a
Linux FriendlyARM 2.6.32.2-FriendlyARM #3 Thu Dec 31 14:56:56 CST 2015 armv4tl unknown
[root@FriendlyARM /]#
[root@FriendlyARM /]#
[root@FriendlyARM /]# free
total used free shared buffers
Mem: 60192 29924 30268 0 1932
Swap: 0 0 0
Total: 60192 29924 30268
[root@FriendlyARM /]#
[root@FriendlyARM /]#
[root@FriendlyARM /]#