1. 程式人生 > >insmod/rmmod hello.ko沒有列印資訊

insmod/rmmod hello.ko沒有列印資訊

使用CentOS 6.9版本,核心為自己從kernel.org上下載的2.6.32版本的原始碼,編譯後安裝的。

編譯hello.c也是用的這個2.6.32的原始碼。

insmod hello.ko
rmmod hello

都沒有任何列印。

於是懷疑到可能是因為CentOS使用的是正式版本,所以列印級別不夠高的話,顯示不出來。

查了一下程式碼:

#define KERN_EMERG      "<0>"   /* system is unusable                   */
#define KERN_ALERT      "<1>"   /* action must be taken immediately     */
#define KERN_CRIT       "<2>"   /* critical conditions                  */
#define KERN_ERR        "<3>"   /* error conditions                     */
#define KERN_WARNING    "<4>"   /* warning conditions                   */
#define KERN_NOTICE     "<5>"   /* normal but significant condition     */
#define KERN_INFO       "<6>"   /* informational                        */
#define KERN_DEBUG      "<7>"   /* debug-level messages                 */
將KERN_ALERT改成KERN_EMERG,再試了一下,就可以打印出來了。
[[email protected] ldd]# insmod hello.ko
[[email protected] ldd]# 
Message from [email protected] at Feb 20 19:59:15 ...
 kernel:Hello world

[[email protected] ldd]# rmmod hello
[[email protected] ldd]# 
Message from [email protected] at Feb 20 19:59:25 ...
 kernel:Goodbye world

[
[email protected]
ldd]#

相關推薦

insmod/rmmod hello.ko沒有列印資訊

使用CentOS 6.9版本,核心為自己從kernel.org上下載的2.6.32版本的原始碼,編譯後安裝的。編譯hello.c也是用的這個2.6.32的原始碼。insmod hello.kormmod hello都沒有任何列印。於是懷疑到可能是因為CentOS使用的是正式版

解決insmod: error inserting 'hello.ko': -1 Invalid module format

實現 功能:在PC的LINUX實現驅動測試,不用在2440上測試 解決insmod: error inserting ‘hello.ko’: -1 Invalid module format 第一次寫Linux驅動,環境搭建了好久,第一次可能是由於GCC的版本問

JAVA 日誌異常沒有列印堆疊資訊問題

在生產環境中異常資訊沒有堆疊資訊的異常2018-06-23 12:10:00.029 [ threadPoolTaskScheduler-10 ] - [ ERROR ] [ com.vanvov.hms.exception.SchedulerErrorHandler : 2

利用python實現批量插入列印資訊的方法

使用列印資訊是除錯程式的必備手段,但是面對下面兩種情況: 1.如果程式程式碼/原始檔較多,而一時之間又無法確定問題範圍,這個時候可能需要在多個檔案插入列印資訊 2.剛剛接手維護大型模組,想要了解執行流程,需要在有可能執行到的地方都加入trace 上述情況,如果手動在每個函式的開頭

Linux 列印資訊輸出到lcd

有時候需要將開機啟動的資訊輸出到LCD上,並且在終端上進行除錯。本文記錄更改的方法。 參考連結 http://blog.csdn.net/chenbang110/article/details/7870072 https://e2e.ti.com/support/embedded/linux/f/3

列印資訊輸出到lcd、自動登入串列埠 ,並自動執行程式

一、列印資訊輸出到lcd   1、傳統方法 在/etc/inittab檔案里加入下面一行 tty1::respawn:/sbin/getty 38400 tty1   2、systemd方法 a、進入lib/systemd/system b、拷貝[email protect

Android.mk 新增列印資訊

# Copyright (C) 2009 The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use thi

Omapl138開發板啟動過程的列印資訊

NAND: 512 MiB MMC: davinci: 0 Bad block table not found for chip 0 Bad block table not found for chip 0 Bad block table written to 0x00001ffe0000,

gdb列印資訊2——列印記憶體的值以及使用$_

測試程式碼 #include <stdio.h> int main (int argc, char *argv[]) { int i = 0; char a[100]; for (i = 0; i < sizeof(a); ++i) { a[i] = i

gdb列印資訊1——列印STL和陣列中的內容

一、列印vector內容測試程式碼 #include<iostream> #include<vector> using namespace std; int main(int argc, char* argv[]) { vector<int&g

商家服務無法上架提示沒有授權資訊解決FAQ

1、地址授權:https://openauth.alipay.com/oauth2/appToAppAuth.htm?app_id=2018032002416255&redirect_uri=https://gateway.blibao.com/ajax/authRedirect.htm 2、二維碼

網易洞見丨洞見APP——Unity列印資訊、點選監聽事件、退出應用

洞見APP——Unity列印資訊 log("lua call 6666") Insight.Debug.Log("Start end") 點選監聽事件、退出應用 require "Commo

linux下python程式後臺執行,並將列印資訊儲存檔案

在跑比較時間比較長的程式,或者是列印資訊比較多的程式時,一般都會後臺執行程式,然後把列印資訊儲存在檔案中,等程式執行結束後再檢查輸出日誌。完成該功能可以用如下命令: nuhup python -u test.py > test.log 2>&1 &

【linux】Valgrind工具集詳解(三):列印資訊說明

一、列印資訊格式 Valgrind列印資訊的格式如下,很容易和程式輸出資訊區分出來 == 程序ID ==Valgrind的列印資訊 二、列印到何處 1、列印到檔案描述符中 主要是設定列印到終端上,預設情況下為2(stderr標準錯誤輸出)。如果要想列印到其他檔

Windows元件沒有Internet資訊服務(IIS)選項解決設定方法

通過控制面板的新增刪除程式,不少人都會遇到Windows元件沒有Internet資訊服務(IIS)選項的情況,當然這針對需要安裝IIS伺服器的人來說。但是我們可以通過一些方法來恢復Windows元件中Internet資訊服務(IIS)選項。 首先,windows xp系

openwrt關閉串列埠列印資訊

mt7620n僅有一個串列埠 由於開發板只有一個UART lite介面,在原生的OpenWrt中作為了核心列印和tty控制檯所用。 而在很多情況下,需要使用串列埠與外部晶片進行通訊,這時就需要從OpenWrt中釋放串列埠。 其實這個任務只有兩個步驟:(我們假定$(TOP

cmake 入門程式設計之列印資訊或者變數

mian.c #include <stdio.h> int main() { printf("hello world\n"); return 0; } CMakeLists.txt project(HELLO) set(SRC_LISTS main.c)

Android JNI列印資訊

1.在Android.mk中加上 LOCAL_LDLIBS    += -llog 2.在.c檔案中 #include "android/log.h" static const char *TAG="serial_port"; #define LOGI(fmt, args.

windows元件嚮導裡沒有internet 資訊服務(iis) 的解決辦法

當使用新增/刪除windows元件時,總是提示"無法載入安裝程式iis2.dll,或是找不到函式 OcEntry.請與你的系統管理員聯絡。特定錯誤程式碼是 0x7e。” 點“確定”後又提示“無法初始化應用程式。” 1.在C:\Windows\inf\目錄下開啟安裝資訊檔案

Makefile 編譯時如何輸出列印資訊

在makefile中列印輸出資訊的方法是:$(warning xxxxx)或者$(error xxxxx) 輸出變數方式為:$(warning  $(XXX)) 例如:$(warinning   $(CLEAR_VAR)) 也可新增提示資訊:$(warinning   -------------------