在编译Tom3q所写s3c6410 android 图形驱动模块(g2d,g3d)时,遇到如下错误
[aliang@Eadith g2d]$ make KDIR=~/source/Android/linux-2.6.36-android/
make --no-print-directory -C /home/aliang/source/Android/linux-2.6.36-android/ SUBDIRS=/home/aliang/source/openfimg/modules/g2d modules
CC [M] /home/aliang/source/openfimg/modules/g2d/s3c_g2d_driver.o
In file included from /home/aliang/source/openfimg/modules/g2d/s3c_g2d_driver.c:46:0:
arch/arm/plat-samsung/include/plat/pm.h:104:39: warning: 'struct sys_device' declared inside parameter list
arch/arm/plat-samsung/include/plat/pm.h:104:39: warning: its scope is only this definition or declaration, which is probably not what you want
arch/arm/plat-samsung/include/plat/pm.h:105:38: warning: 'struct sys_device' declared inside parameter list
/home/aliang/source/openfimg/modules/g2d/s3c_g2d_driver.c: In function 's3c_g2d_open':
/home/aliang/source/openfimg/modules/g2d/s3c_g2d_driver.c:783:2: error: implicit declaration of function 'kmalloc'
/home/aliang/source/openfimg/modules/g2d/s3c_g2d_driver.c:783:6: warning: assignment makes pointer from integer without a cast
/home/aliang/source/openfimg/modules/g2d/s3c_g2d_driver.c: In function 's3c_g2d_release':
/home/aliang/source/openfimg/modules/g2d/s3c_g2d_driver.c:806:2: error: implicit declaration of function 'kfree'
/home/aliang/source/openfimg/modules/g2d/s3c_g2d_driver.c: At top level:
/home/aliang/source/openfimg/modules/g2d/s3c_g2d_driver.c:817:2: error: unknown field 'ioctl' specified in initializer
/home/aliang/source/openfimg/modules/g2d/s3c_g2d_driver.c:817:2: warning: initialization from incompatible pointer type
/home/aliang/source/openfimg/modules/g2d/s3c_g2d_driver.c: In function 's3c_g2d_probe':
/home/aliang/source/openfimg/modules/g2d/s3c_g2d_driver.c:837:7: warning: assignment makes pointer from integer without a cast
make[2]: *** [/home/aliang/source/openfimg/modules/g2d/s3c_g2d_driver.o] 错误 1
make[1]: *** [_module_/home/aliang/source/openfimg/modules/g2d] 错误 2
make: *** [all] 错误 2
红字部分是主要错误,“kmalloc”,“kfree”错误是由于缺少头文件引起的
#include <linux/slab.h>
添加后解决
error: unknown field 'ioctl' specified in initializer
问题是由于2.6.36内核之后 去掉了原来的ioctl,添加两个新的成员,所以会出错
- long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
- long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
所以修改源文件中file_operations内
.ioctl 改为 .compat_ioctl 即可
OK,编译通过,警告咱就忽略了?:mrgreen: