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

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

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

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

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ù)錯(cuò)誤提示,修改Makefile中12、13行代碼如下:

EXTRA_CFLAGS += $(DEBFLAGS)

EXTRA_CFLAGS += -I$(LDDINC)

4、接著make,錯(cuò)誤如下:

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里將他屏蔽,接著編譯,仍有錯(cuò)誤:

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沒(méi)有聲明,我們?cè)谠创a里面搜索,發(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ù)提示,錯(cuò)誤在于task_struct結(jié)構(gòu)體沒(méi)有uid,euid成員變量,查看源碼發(fā)現(xiàn)struct task_struct定義在include/linux/sched.h中,確實(shí)沒(méi)有這兩個(gè)成員,逐個(gè)成員分析發(fā)現(xiàn),這兩個(gè)成員在2.6.35內(nèi)核中放在const struct cred *cred成員中了,所以,我們嘗試將所有出現(xiàn)錯(cuò)誤的地方做如下改動(dòng):

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)載請(qǐng)聯(lián)系該專欄作者,如若文章內(nèi)容侵犯您的權(quán)益,請(qǐng)及時(shí)聯(lián)系本站刪除。
換一批
延伸閱讀

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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