linux驅動開發填坑的錯誤及解決方案

2021-09-26 10:58:42 字數 641 閱讀 5293

填坑原始碼**於

1.insmod: error: could not insert module char.ko: operation not permitted

方案:許可權不夠 sudo 或者切換到root下執行

2.fatal error: asm/system.h: no such file or directory

方案:核心版本在3.3之後,直接使用#include 替換掉原來的#include

3.error: initialization from incompatible pointer type [-werror=incompatible-pointer-types]

方案:

cd /usr/src/linux-5.2.8/include/linux

vim fs.h

/file_operations

對照函式定義來修改自己的錯誤定義

其中:unlocked_ioctl就是ioctl的替代者

4.error: function declaration isn』t a prototype [-werror=strict-prototypes]

方案:沒有說明引數是void

改為void chr_exit(void)就可以了

linux驅動之 驅動開發常見錯誤彙總

1.2 錯誤原因 1.3 解決辦法 2 error implicit declaration of function class create 序言 剛開始學驅動,期間會遇到大大小小的坑,這裡作為典型問題記錄彙總,以便後續查詢。root am437x evm first drv insmod fir...

linux字元裝置驅動開發模板及Makefile

include include include include include 字元裝置驅動模板開始 define char dev device name char dev 是應當連線到這個編號範圍的裝置的名字,出現在 proc devices和sysfs中 define char dev nod...

Linux驅動開發入門(一)驅動的概念

缺少驅動的電腦是什麼樣的?試想一下,你有一台缺少usb驅動的電腦。那麼當你電腦上插入乙個u盤的時候,u盤只是和電腦的物理介面連在一起,通了電。因為沒有軟體驅動,沒進行usb通訊,無法讀取到u盤內的資料。就不會和正常一樣提示移動裝置插入,不能在檔案系統中開啟u盤。正如缺少usb驅動的電腦無法操作u盤一...