1. 程式人生 > >linux核心外部驅動模組編譯報錯ERROR: "******" [drivers/**.ko] undefined!

linux核心外部驅動模組編譯報錯ERROR: "******" [drivers/**.ko] undefined!

我往linux核心裡新增一個驅動模組,根據《linux裝置驅動》第三版,修改Makefile如下:

   obj-m := GobiNet.o  
   GobiNet-objs :=  GobiUSBNet.o QMIDevice.o QMI.o  
但是出現瞭如下錯誤:
/home/sylvain/Projects/android_gingerbread_realv210_ver_1_0/kernel  
   CHK     include/linux/version.h  
   CHK     include/generated/utsrelease.h  
make[1]: `include/generated/mach-types.h' is up to date.  
   CALL    scripts/checksyscalls.sh  
   CHK     include/generated/compile.h  
   LD      drivers/cell/OptionGobiNet/built-in.o  
   CC [M]  drivers/cell/OptionGobiNet/GobiUSBNet.o  
   CC [M]  drivers/cell/OptionGobiNet/QMIDevice.o  
   CC [M]  drivers/cell/OptionGobiNet/QMI.o  
   LD [M]  drivers/cell/OptionGobiNet/GobiNet.o  
   Kernel: arch/arm/boot/Image is ready  
   SHIPPED arch/arm/boot/compressed/lib1funcs.S  
   AS      arch/arm/boot/compressed/lib1funcs.o  
   LD      arch/arm/boot/compressed/vmlinux  
   OBJCOPY arch/arm/boot/zImage  
   Kernel: arch/arm/boot/zImage is ready       
   Building modules, stage 2.  
   MODPOST 5 modules  
ERROR: "usbnet_suspend" [drivers/cell/OptionGobiNet/GobiNet.ko] undefined!  
ERROR: "usbnet_resume" [drivers/cell/OptionGobiNet/GobiNet.ko] undefined!  
ERROR: "usbnet_disconnect" [drivers/cell/OptionGobiNet/GobiNet.ko] undefined!  
ERROR: "usbnet_probe" [drivers/cell/OptionGobiNet/GobiNet.ko] undefined!  
make[1]: *** [__modpost] Error 1  
make: *** [modules] Error 2   
編譯過程中生成了"GobiNet.mod.c"和"GobiNet.o",但是並沒有生成GobiNet.ko檔案。
經歷一番折騰之後,我發現問題的原因了。

我誤解了錯誤資訊,沒有清楚ko生成過程。編譯模組在連結過程中查詢外部符號表,但並沒有找到,因為該外部符號表並沒有編譯。

根據以上分析,我查看了外部符號在drivers/net/usb/usbnet.c檔案,這就需要配置.config檔案中設定CONFIG_USBNET=y。

希望對大家有所幫助。

英文地址:http://stackoverflow.com/questions/7812418/kernel-driver-external-modules-not-building-completely

相關推薦

linux核心外部驅動模組編譯ERROR: "******" [drivers/**.ko] undefined!

我往linux核心裡新增一個驅動模組,根據《linux裝置驅動》第三版,修改Makefile如下: obj-m := GobiNet.o GobiNet-objs := GobiUSBNet.o QMIDevice.o QMI.o 但是出現瞭如下錯誤:

嵌入式Linux最簡單驅動模組編譯與剖析

# 最簡單的核心模組: #include<linux/module.h> #include<linux/kernel.h> static int my_driver_init(void) { printk("hello\n"); return

VS2013使用scanf、gets及字串函式編譯error C4996: 'scanf': This function or variable may be unsafe. 原因及解決方案

VS2013使用scanf、gets及字串函式編譯報錯error C4996: ‘scanf’: This function or variable may be unsafe. 原因及解決方案 問題原因: C語言的標準函式中,一些讀取或寫入記憶體的函式存在記憶

Android Studio 3.0.1 gradle編譯 Error : unable to resolve dependency for
安裝Python模組numpy[error] Microsoft Visual C++ 14.0 is required

Python初學,現在使用Python3.6 今天在安裝numpy時出現報錯 Microsoft Visual C++ 14.0 is required,查了很多解決方法,都沒有完全成功,好像和vs編輯器有關,需要下載vs2008或者2010等等不知道那個版本的編輯器,但

解決Android studio 編譯 Error:null value in entry: outputDirectory=null

昨天升級了Android studio 到2.3版,升級以後編譯了一大會兒後編輯器報了個錯, Error:null value in entry: outputDirectory=null 然後一直編譯過不去了。 百度,谷歌之後發現並沒有這樣的錯,但

編譯Error:Execution failed for task ':app:processDebugManifest'. > Manifest merger failed with mul

gradle編譯時報錯:出現提示: Error:Execution failed for task ':app:processDebugManifest'. > Manifest merger failed with multiple errors, see logs

關於編譯 error: cannot convert ‘const std::__cxx11::basic_string’ to ‘const char*’ 的處理

所以然 目前C++11標準開始普及,大家都開始預設支援或者使用c++11,例如GCC 5就開始預設啟用C++11特性。但是由於c++11相對於c++03,很多實現的資料結構都發生了改變,所以兩者並不能完全混用。  預設情況下,GCC 5在編譯時會將std::string

【Android開發遇】Android studio 新增jar後編譯Error converting bytecode to dex: Cause: Dex cannot pars

** 添加了一個mysql-connector-java-5.1.38-bin.jar然後編譯就報錯了 ** 錯誤資訊如下: Error:Error converting bytecode to dex: Cause: Dex cannot par

Win32Project編譯error C1853:

引子 vs2013新建win32工程Win32Project1, 修改檔案Win32Project1.cpp名為Win32Project1.c, 編譯,報如下錯誤: 錯誤1error C1853:

vue-項目編譯 Error: No PostCSS Config found in...

gin sta 依然 auto 時報 fig 本地 報錯 all 問題描述: 項目在本地運行不報錯,上傳到 GitHub 之後,再 clone 到本地,執行: npm install 安裝完成之後再執行: npm run dev 這時報錯 Erro

linux核心編譯1- error: expected specifier-qualifier-list before 'u_quad_t'

編譯核心出現 error: expected specifier-qualifier-list before 'u_quad_t' 錯誤。 解決方法: 在核心配置中有如下 File Systems ->    

Linux核心驅動模組編譯

核心模組的構建有兩種主要方式:放在核心原始碼樹中或者放在核心程式碼外。 一、放在核心原始碼樹中 在核心的drivers/資料夾下建立好驅動模組資料夾,並完成驅動檔案之後,需要編輯和修改相應的Kconfig和Makefile檔案,使得該模組可以配置到核心中並進行編譯。 1.

linux開發の如何靜態的將驅動模組編譯核心

在解決這個問題之前,我們先搞明白linux究竟是怎樣管理原始碼中上萬個檔案的。我們看Linux原始碼的目錄,十分科學,基本上看到目錄就可以猜到裡面放的什麼,那怎麼把檔案連線起來,靠的就是Kconfig,它可以告知Makefile那些編譯那些不編譯。第一步:在driver目錄下

linux安裝lua相關編譯

cto efi comment lua ins targe read readline adl 1、報之類的錯誤 /usr/lib/libreadline.so: undefined reference to `PC‘ /usr/lib/libreadline.so:

NDK 編譯arm-linux-androideabi-g++: error: CreateProcess: No such file or directory

Android編譯工程時提示:arm-linux-androideabi-g++: error: CreateProcess: No such file or directory錯誤。 解決方法: 步驟1:  Android.mk 檔案修改, LOCAL_SHORT_C

Linux 編譯 -- undefined reference to 問題解決方法 (具體'pthread_create'和opencv看文章最後兩條)

最近在Linux下程式設計發現一個詭異的現象,就是在連結一個靜態庫的時候總是報錯,類似下面這樣的錯誤: (.text+0x13): undefined reference to `func'     關於undefined reference這樣的問題,大家其實經常會遇到

Linux 編譯 undefined reference to `pthread_create'

在編譯Linux下多執行緒程式的時候出現錯誤資訊, 寫好程式碼,進行編譯時,出現如下錯誤提示資訊:  thread.c:(.text+0xae): undefined reference to `pthread_create' thread.c:(.

linux驅動模組編譯步驟

現在我來說明一下這個Makefile。請記住是大寫的Makefile而不是小寫的makefile; obj-m :這個變數是指定你要聲稱哪些模組模組的格式為 obj-m := <模組名>.omodules-objs :這個變數是說明聲稱模組modules需要的目標檔案 格式要求   <模組

maven多模組打包編譯 無法載入core包

1.偶爾會出現這樣的情況,之前沒有特別的在乎,後來發現不得不解決了,找了許久才發現了 2.解決如下:註釋父級的maven-plugin外掛,只保留view子模組的maven-plugin外掛,這樣就不會報錯了,具體原理還不太明白,有知道的可以給我留言哈~