核心ko模組strip使用

2021-07-26 05:53:55 字數 669 閱讀 9313

編譯乙個核心時,習慣性的在install目標下加了命令:

$(strip)  --strip-all --remove-section=.note --remove-section=.comment  test.ko

結果在insmod test.ko時出現錯誤:

test: module has no symbols (stripped?)

..................

上網查了以下,發現核心模組在插入時,insmod會使用模組的一些符號資訊。那是不是核心模組不可以被stip呢?答案是可以strp 但不能strip太多東西,應該使用:

$(strip)  --strip-debug test.ko

另外:核心模組的version magic的問題:

插入模組出現錯誤:

test: version magic '2.6.15 gcc-3.4' should be '2.6.14 gcc-3.4'

核心模組對應的核心版本不對,可以修改核心版本代號試一試:

修改liunx原始碼下的makefile 前面的版本定義,然後重新編譯核心,再編譯核心模組。當然這樣做可能會有***。

檢視乙個模組的version magic資訊:

$modinfo test.ko

file test.ko 也可以用於檢視ko檔案的資訊

Andriod編譯核心模組 ko

在單獨編譯android的核心模組之前,必須要成功配置編譯過整個android系統 至少要編譯成功boot.img 生成正確的out目錄。1.編寫makefile。按照以下格式編寫makefile。1 obj m aaa.o 2 obj m abc.o 3 abc objs aaa.o bbb.o ...

核心模組能否被strip?

編譯乙個核心時,習慣性的在install目標下加了命令 strip strip all remove section note remove section comment test.ko 結果在in od test.ko時出現錯誤 test module has no symbols stripp...

linux 系統 ko模組編譯

今天整理以前筆記,發現曾經裡面有乙個makefile檔案。仔細一看是以前實習做linux核心程式設計時候寫的模組makefile。剛好我電腦也有linux系統,就拿來回顧一下。寫個my.c和乙個makefile檔案,然後make編譯一下,就成功了,生成my.ko 再載入一下insmod my.ko ...