在Linux Kernel Driver開發的過程中,我們會設計到多個版本。有的時候再前一個版本這個接口還有,到了下一個版本,這個接口就不見了。以下簡單總結以下一些重要的變化
1. 在Ubuntu 12.04的環境下編譯最新的linux 3.14代碼時出現下面的錯誤
$ make menuconfig
HOSTLD scripts/kconfig/mconf
scripts/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 status
make[1]: *** [scripts/kconfig/mconf] Error 1
make: *** [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, 用戶空間對應的系統調用沒有發生變化。