Driver开发常见问题

来源:互联网 发布:小米2a移动网络设置 编辑:程序博客网 时间:2024/06/10 00:52

在Linux Kernel Driver开发的过程中,我们会设计到多个版本。有的时候再前一个版本这个接口还有,到了下一个版本,这个接口就不见了。以下简单总结以下一些重要的变化

1. 在Ubuntu 12.04的环境下编译最新的linux 3.14代码时出现下面的错误

$ make menuconfigHOSTLD  scripts/kconfig/mconfscripts/kconfig/mconf.o: In function `show_help':mconf.c:(.text+0x8a4): undefined reference to `stdscr'scripts/kconfig/lxdialog/checklist.o: In function `print_arrows':checklist.c:(.text+0x41): undefined reference to `wmove'checklist.c:(.text+0x61): undefined reference to `acs_map'......menubox.c:(.text+0x3a9): undefined reference to `wrefresh'scripts/kconfig/lxdialog/menubox.o: In function `print_buttons':menubox.c:(.text+0x4ef): undefined reference to `wrefresh'collect2: ld returned 1 exit statusmake[1]: *** [scripts/kconfig/mconf] Error 1make: *** [menuconfig] Error 2

     由于缺少必要的package,所以出现了编译问题。

        出现这个问题的处理方法:

      $ sudo apt-get install build-essential libncurses5 libncurses5-dev

2. /bin/sh: scripts/mod/modpost: No such file or directory

     出现这样的错误,说明scripts下没有生成相应的文件,cd到kernel所在目录,执行:make scripts

3. init_MUTEX

     2.6.25及以后的linux内核版本废除了init_MUTEX函数

     新版本使用sema_init函数

4. ioctl 和 unlocked_ioctl

   从2.6.36 以后的内核已经废弃了 file_operations 中的 ioctl 函数指针,取而代之的是 unlocked_ioctl, 用户空间对应的系统调用没有发生变化。



0 0