contributed by < yan112388
>
設定準備中,make check
後遇到警告:
查閱 Linux 核心模組運作原理 中有提及此敘序
你的編譯器版本與kernel開發套件所用的編譯器版本不一致,建議安裝對應的版本避免後續開發出問題。
目前仍在了解 gcc-12 與 x86_64-linux-gnu-gcc-12 的差異性,進行以下嘗試:
此外,還輸出以下錯誤:
查詢 The Linux Kernel Module Programming Guide,內文提到與 UEFI 安全開機(security boot)有關,最簡單的解決方式為進入 bios 將安全關機功能關閉後,這個錯誤便消失了。
Failing this, an attempt to insert your first “hello world” module would result in the message: “ERROR: could not insert module”. If this message Lockdown: insmod: unsigned module loading is restricted; see man kernel lockdown.7 appears in the dmesg output, the simplest approach involves disabling UEFI SecureBoot from the boot menu of your PC or laptop, allowing the successful insertion of “hello world” module.
查閱 UEFI-Secure Boot 提到
SB works using cryptographic checksums and signatures. Each program that is loaded by the firmware includes a signature and a checksum, and before allowing execution the firmware will verify that the program is trusted by validating the checksum and the signature. When SB is enabled on a system, any attempt to execute an untrusted program will not be allowed. This stops unexpected / unauthorised code from running in the UEFI environment.
更為恰當的方式應該是對模組進行簽名(待研究細節):
〈Linux 核心模組運作原理〉列出的程式碼較舊,歡迎編輯頁面,更新到 Linux v6.1 以上。