7

現在、シリアルポート1のコンソール出力でLinuxを起動する組み込みシステムを開発しています(ブートローダーからのコンソールブートパラメーターを使用)。ただし、最終的にはこのシリアル ポートを使用する予定です。カーネル コンソール出力の最適なソリューションは何ですか? /dev/null? 何らかの方法で pty に配置して、潜在的にアクセスできるようにすることはできますか?

4

2 に答える 2

3

dmesg を使用して、シェルから printk メッセージ バッファにアクセスできます。カーネル バッファのサイズは有限であり、最も古いエントリを最新のエントリで上書きするため、定期的に dmesg をチェックするか、@bmdhacks が示唆するように netconsole を接続する必要があります。

コンソールがない場合、カーネル クラッシュによって出力された oops 情報を見逃すことになります。TCP が出力をリモートソケットに配信する前にカーネルが死んでリブートを開始した場合、netconsole を使用しても役に立たない場合があります。通常、kernel/panic.c:panic() を変更して、レジスタの内容やその他の状態を NOR フラッシュの領域に保存します。これにより、少なくとも一部の情報を事後分析のデバッグに利用できるようになります。

于 2008-09-30T04:26:58.480 に答える
3

If you just want to read kernel printk messages from the console, and not actually run getty or a shell on it, you can use netconsole. You can supply the following to your bootloader kernel options (or to modprobe netconsole):

netconsole=4444@10.0.0.1/eth1,9353@10.0.0.2/12:34:56:78:9a:bc

where 4444 is the local port, 10.0.0.1 is the local ip, eth1 is the local interface to send the messages out of. 9353 is the remote port, 10.0.0.2 is the remote ip to send the messages to, and the final argument is your remote (eg: your desktop) system's mac address.

Then to view the messages run:

netcat -u -l -p 9353

You can read more about this in Documentation/networking/netconsole.txt

于 2008-09-30T03:59:17.500 に答える