日本黄色一级经典视频|伊人久久精品视频|亚洲黄色色周成人视频九九九|av免费网址黄色小短片|黄色Av无码亚洲成年人|亚洲1区2区3区无码|真人黄片免费观看|无码一级小说欧美日免费三级|日韩中文字幕91在线看|精品久久久无码中文字幕边打电话

當(dāng)前位置:首頁 > 嵌入式 > 嵌入式教程
[導(dǎo)讀]Scull在2.6.35-30內(nèi)核中的編譯解決方案

LDD3作為從事驅(qū)動開發(fā)工作人員的必要參考資料,認(rèn)真研究書中的附帶源碼具有很高的參考價(jià)值,但由于代碼基于2.6.10內(nèi)核,部分內(nèi)核API較老,導(dǎo)致在2.6.35-30等較新內(nèi)核上編譯不能通過,由于工作需要,特花了一段時間進(jìn)行整理,本篇文章對示例源碼中的第一個驅(qū)動程序SCULL進(jìn)行整理,供各位同仁參考:

1、修改Makefile的第24行:

如果是基于PC,則KERNELDIR ?= /lib/modules/$(shell uname -r)/build(我的PC中l(wèi)inux內(nèi)核是2.6.35版本)

如果是基于arm,則改變?yōu)椋?/p>

KERNELDIR ?= ……/……/……/……/linux/linux-2.6.35-30(arm開發(fā)板上所需內(nèi)核的源碼目錄)

2、進(jìn)入scull目錄,執(zhí)行make,有如下錯誤:

make -C /lib/modules/2.6.35-30-generic/build M=/media/orientation/driver/ldd3/examples/scull LDDINC=/media/orientation/driver/ldd3/examples/scull/……/include modules make[1]: Entering directory `/usr/src/linux-headers-2.6.32-28-generic' scripts/Makefile.build:49: *** CFLAGS was changed in "/media/orientation/driver/ldd3/examples/scull/Makefile". Fix it to use EXTRA_CFLAGS. Stop. make[1]: *** [_module_/media/orientation/driver/ldd3/examples/scull] Error 2 make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-28-generic' make: *** [modules] Error 2 3、根據(jù)錯誤提示,修改Makefile中12、13行代碼如下:

EXTRA_CFLAGS += $(DEBFLAGS)

EXTRA_CFLAGS += -I$(LDDINC)

4、接著make,錯誤如下:

make -C /lib/modules/2.6.35-30-generic/build M=/media/orientation/driver/ldd3/examples/scull LDDINC=/media/orientation/driver/ldd3/examples/scull/……/include modules make[1]: Entering directory `/usr/src/linux-headers-2.6.32-28-generic' CC [M] /media/orientation/driver/ldd3/examples/scull/main.o /media/orientation/driver/ldd3/examples/scull/main.c:17:26: error: linux/config.h: No such file or directory make[2]: *** [/media/orientation/driver/ldd3/examples/scull/main.o] Error 1 make[1]: *** [_module_/media/orientation/driver/ldd3/examples/scull] Error 2 make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-28-generic' make: *** [modules] Error 2 root@ubuntu:/media/orientation/driver/ldd3/examples/scull# vim Makefile root@ubuntu:/media/orientation/driver/ldd3/examples/scull# make make -C /lib/modules/2.6.32-28-generic/build M=/media/orientation/driver/ldd3/examples/scull LDDINC=/media/orientation/driver/ldd3/examples/scull/……/include modules make[1]: Entering directory `/usr/src/linux-headers-2.6.32-28-generic' CC [M] /media/orientation/driver/ldd3/examples/scull/main.o /media/orientation/driver/ldd3/examples/scull/main.c:17:26: error: linux/config.h: No such file or directory make[2]: *** [/media/orientation/driver/ldd3/examples/scull/main.o] Error 1 make[1]: *** [_module_/media/orientation/driver/ldd3/examples/scull] Error 2 make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-28-generic 5、根據(jù)提示,查看2.6.35.30源碼發(fā)現(xiàn)linux/config.h文件不存在,直接在main.c里將他屏蔽,接著編譯,仍有錯誤:

make -C /lib/modules/2.6.35-30-generic/build M=/media/orientation/driver/ldd3/examples/scull LDDINC=/media/orientation/driver/ldd3/examples/scull/……/include modules make[1]: Entering directory `/usr/src/linux-headers-2.6.32-28-generic' CC [M] /media/orientation/driver/ldd3/examples/scull/main.o CC [M] /media/orientation/driver/ldd3/examples/scull/pipe.o /media/orientation/driver/ldd3/examples/scull/pipe.c: In function ‘scull_p_read’:/media/orientation/driver/ldd3/examples/scull/pipe.c:131: error: ‘TASK_INTERRUPTIBLE’ undeclared (first use in this function)

/media/orientation/driver/ldd3/examples/scull/pipe.c:131: error: (Each undeclared identifier is reported only once /media/orientation/driver/ldd3/examples/scull/pipe.c:131: error: for each function it appears in.)

/media/orientation/driver/ldd3/examples/scull/pipe.c:131: error: implicit declaration of function ‘signal_pending’/media/orientation/driver/ldd3/examples/scull/pipe.c:131: error: implicit declaration of function ‘schedule’/media/orientation/driver/ldd3/examples/scull/pipe.c: In function ‘scull_getwritespace’:/media/orientation/driver/ldd3/examples/scull/pipe.c:168: error: ‘TASK_INTERRUPTIBLE’ undeclared (first use in this function)

/media/orientation/driver/ldd3/examples/scull/pipe.c: In function ‘scull_p_write’:/media/orientation/driver/ldd3/examples/scull/pipe.c:219: error: ‘TASK_INTERRUPTIBLE’ undeclared (first use in this function)

/media/orientation/driver/ldd3/examples/scull/pipe.c:223: error: ‘SIGIO’ undeclared (first use in this function)

/media/orientation/driver/ldd3/examples/scull/pipe.c:223: error: ‘POLL_IN’ undeclared (first use in this function)

make[2]: *** [/media/orientation/driver/ldd3/examples/scull/pipe.o] Error 1 make[1]: *** [_module_/media/orientation/driver/ldd3/examples/scull] Error 2 make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-28-generic' make: *** [modules] Error 2 6、根據(jù)提示,TASK_INTERRUPTIBLE沒有聲明,我們在源碼里面搜索,發(fā)現(xiàn)該宏定義在<linux/sched.h>中,故在pipe.c中加入該頭文件,接著make:

make -C /lib/modules/2.6.35-30-generic/build M=/media/orientation/driver/ldd3/examples/scull LDDINC=/media/orientation/driver/ldd3/examples/scull/……/include modules make[1]: Entering directory `/usr/src/linux-headers-2.6.35-30-generic' CC [M] /media/orientation/driver/ldd3/examples/scull/pipe.o CC [M] /media/orientation/driver/ldd3/examples/scull/access.o /media/orientation/driver/ldd3/examples/scull/access.c: In function ‘scull_u_open’:/media/orientation/driver/ldd3/examples/scull/access.c:106: error: dereferencing pointer to incomplete type /media/orientation/driver/ldd3/examples/scull/access.c:107: error: dereferencing pointer to incomplete type /media/orientation/driver/ldd3/examples/scull/access.c:114: error: dereferencing pointer to incomplete type /media/orientation/driver/ldd3/examples/scull/access.c: In function ‘scull_w_available’:/media/orientation/driver/ldd3/examples/scull/access.c:165: error: dereferencing pointer to incomplete type /media/orientation/driver/ldd3/examples/scull/access.c:166: error: dereferencing pointer to incomplete type /media/orientation/driver/ldd3/examples/scull/access.c: In function ‘scull_w_open’:/media/orientation/driver/ldd3/examples/scull/access.c:179: error: ‘TASK_INTERRUPTIBLE’ undeclared (first use in this function)

/media/orientation/driver/ldd3/examples/scull/access.c:179: error: (Each undeclared identifier is reported only once /media/orientation/driver/ldd3/examples/scull/access.c:179: error: for each function it appears in.)

/media/orientation/driver/ldd3/examples/scull/access.c:179: error: implicit declaration offunction ‘signal_pending’/media/orientation/driver/ldd3/examples/scull/access.c:179: error: implicit declaration offunction ‘schedule’/media/orientation/driver/ldd3/examples/scull/access.c:184: error: dereferencing pointer to incomplete type /media/orientation/driver/ldd3/examples/scull/access.c: In function ‘scull_w_release’:/media/orientation/driver/ldd3/examples/scull/access.c:205: error: ‘TASK_INTERRUPTIBLE’ undeclared (first use in this function)

/media/orientation/driver/ldd3/examples/scull/access.c: In function ‘scull_c_open’:/media/orientation/driver/ldd3/examples/scull/access.c:277: error: dereferencing pointer to incomplete type /media/orientation/driver/ldd3/examples/scull/access.c:281: error: dereferencing pointer to incomplete type make[2]: *** [/media/orientation/driver/ldd3/examples/scull/access.o] Error 1 make[1]: *** [_module_/media/orientation/driver/ldd3/examples/scull] Error 2 make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-28-generic' make: *** [modules] Error 2 7、根據(jù)提示,同上所述,我們需要在access.c中加入頭文件<sched.h>,接著編譯:

make -C /lib/modules/2.6.35-30-generic/build M=/media/orientation/driver/ldd3/examples/scull LDDINC=/media/orientation/driver/ldd3/examples/scull/……/include modules make[1]: Entering directory `/usr/src/linux-headers-2.6.32-28-generic' CC [M] /media/orientation/driver/ldd3/examples/scull/access.o /media/orientation/driver/ldd3/examples/scull/access.c: In function ‘scull_u_open’:/media/orientation/driver/ldd3/examples/scull/access.c:106: error: ‘struct task_struct’ has no member named ‘uid’/media/orientation/driver/ldd3/examples/scull/access.c:107: error: ‘struct task_struct’ has no member named ‘euid’/media/orientation/driver/ldd3/examples/scull/access.c:114: error: ‘struct task_struct’ has no member named ‘uid’/media/orientation/driver/ldd3/examples/scull/access.c: In function ‘scull_w_available’:/media/orientation/driver/ldd3/examples/scull/access.c:165: error: ‘struct task_struct’ has no member named ‘uid’/media/orientation/driver/ldd3/examples/scull/access.c:166: error: ‘struct task_struct’ has no member named ‘euid’/media/orientation/driver/ldd3/examples/scull/access.c: In function ‘scull_w_open’:/media/orientation/driver/ldd3/examples/scull/access.c:184: error: ‘struct task_struct’ has no member named ‘uid’make[2]: *** [/media/orientation/driver/ldd3/examples/scull/access.o] Error 1 make[1]: *** [_module_/media/orientation/driver/ldd3/examples/scull] Error 2 make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-28-generic' make: *** [modules] Error 2 8、根據(jù)提示,錯誤在于task_struct結(jié)構(gòu)體沒有uid,euid成員變量,查看源碼發(fā)現(xiàn)struct task_struct定義在include/linux/sched.h中,確實(shí)沒有這兩個成員,逐個成員分析發(fā)現(xiàn),這兩個成員在2.6.35內(nèi)核中放在const struct cred *cred成員中了,所以,我們嘗試將所有出現(xiàn)錯誤的地方做如下改動:

current->uid 修改為 current->cred->uid current->euid 修改為 current->cred->euid 9、接著make,發(fā)現(xiàn)成功編譯。

本站聲明: 本文章由作者或相關(guān)機(jī)構(gòu)授權(quán)發(fā)布,目的在于傳遞更多信息,并不代表本站贊同其觀點(diǎn),本站亦不保證或承諾內(nèi)容真實(shí)性等。需要轉(zhuǎn)載請聯(lián)系該專欄作者,如若文章內(nèi)容侵犯您的權(quán)益,請及時聯(lián)系本站刪除。
換一批
延伸閱讀

上海2025年4月21日 /美通社/ -- 當(dāng)前汽車行業(yè)正經(jīng)歷深刻變革:電動化進(jìn)程持續(xù)加速,多種技術(shù)路線并行發(fā)展;智能化技術(shù)融合各類場景,加快落地應(yīng)用;消費(fèi)者個性化需求日益凸顯,舒適性配置成為汽車差異化競爭的關(guān)鍵要素;同...

關(guān)鍵字: 內(nèi)核 汽車產(chǎn)業(yè) 可持續(xù)發(fā)展 智能化技術(shù)

上海2024年8月22日 /美通社/ -- 九曲銀河落碧川,蒼穹遼闊引浮翩。8月20-21日,佳通P10極致中國行活動來到天穹如蓋、遼闊無垠的錫林郭勒,開啟一場草原文化和自然風(fēng)光的深度融合之旅。在佳通駕控P10輪胎提供的...

關(guān)鍵字: P10 輪胎 內(nèi)核 可持續(xù)發(fā)展

北京2024年8月8日 /美通社/ -- 近日,軟通動力T6司庫管理系統(tǒng)、票據(jù)管理系統(tǒng)IDMS、醫(yī)共體一體化管理平臺三款產(chǎn)品獲鯤鵬原生開發(fā)認(rèn)證(Kunpeng NATIVE)。這是軟通動力自年初正式啟動鯤鵬原生開發(fā)以來,...

關(guān)鍵字: PEN 編譯 DEVKIT 操作系統(tǒng)

麗水2024年8月9日 /美通社/ -- 7月27日,藍(lán)科中國應(yīng)邀出席由浙江省總會計(jì)師協(xié)會、麗水市財(cái)政會計(jì)學(xué)會、麗水職業(yè)技術(shù)學(xué)院繼續(xù)教育學(xué)院、浙江省第四期高端會計(jì)人才班、聯(lián)合舉辦的"高端會計(jì)人才'浙麗說'暨會計(jì)...

關(guān)鍵字: 研討會 BSP 內(nèi)核 電器

北京2024年7月19日 /美通社/ -- 近日,長擎安全操作系統(tǒng)24與浪潮信息集中式存儲HF/AS系列產(chǎn)品完成并通過浪潮信息澎湃技術(shù)相互兼容性測試認(rèn)證,長擎安全操作系統(tǒng)24與浪潮信息集中式存儲HF/AS系列產(chǎn)品完全兼容...

關(guān)鍵字: 操作系統(tǒng) 測試 內(nèi)核 數(shù)字化

在這篇文章中,小編將為大家?guī)鞮inux內(nèi)核的相關(guān)報(bào)道。如果你對本文即將要講解的內(nèi)容存在一定興趣,不妨繼續(xù)往下閱讀哦。

關(guān)鍵字: 嵌入式 Linux 內(nèi)核

以下內(nèi)容中,小編將對嵌入式linux內(nèi)核移植實(shí)現(xiàn)方案的相關(guān)內(nèi)容進(jìn)行著重介紹和闡述,希望本文能幫您增進(jìn)對嵌入式的了解,和小編一起來看看吧。

關(guān)鍵字: 嵌入式 Linux 內(nèi)核

KeilμVision4是Keil軟件公司為8051系列微控制器及其兼容產(chǎn)品設(shè)計(jì)的集成式軟件開發(fā)環(huán)境。μVision4集成了C51編譯器和A51匯編器,其界面類似于Microsoft VS,支持C語言和匯編語言程序的編寫...

關(guān)鍵字: 程序 編譯 鏈接

上海2022年11月29日 /美通社/ -- 2022年11月4日至6日,具有國際影響力的金融科技經(jīng)紀(jì)商ATFX參加且贊助了2023年“愛丁堡公爵杯”預(yù)選賽。此次預(yù)選賽是在墨西哥金塔納羅奧州坎昆月亮宮酒店球場(Hotel...

關(guān)鍵字: 內(nèi)核 進(jìn)程 TE SE

據(jù)業(yè)內(nèi)信息報(bào)道,近日半導(dǎo)體封測大廠日月光已從高通公司獲得Oryon芯片的封測大單。

關(guān)鍵字: 高通 內(nèi)核 Oryon 封測 日月光
關(guān)閉