linux输出信息调试信息重定向

2019-07-13 06:04发布

  在运行linux的时候有所有的调试信息可以分为三个部分   1、 bootloader输出信息 U-Boot 1.3.2(Nov 19 2016 - 22:02:08)
DRAM: 64 MB
Flash: 512 kB
NAND: 64 MiB
In: serial
Out: serial
Err: serial
Hit any key to stop autoboot: 0
[yqliu2410 #] tftp
Found DM9000 ID:90000a46 at address 10000000 !
DM9000 work in 16 bus width
bd->bi_entaddr: 08:00:3e:26:0a:5b
[eth_init]MAC:8:0:3e:26:a:5b:
TFTP from server 192.168.1.152; ourIP address is 192.168.1.155
Filename 'uImage'.
Load address: 0x30008000
Loading: T T#######################################################done
Bytes transferred = 1617316 (18ada4 hex)
[up-tech2410 #] bootm
## Booting image at 30008000 ...
   Image Name: Linux-2.6.24.4
   Created: 2016-11-19 14:05:29 UTC
   Image Type: ARM Linux Kernel Image(uncompressed)
   Data Size: 1617252 Bytes= 1.5 MB
   Load Address: 30008000
   Entry Point: 30008040
   Verifying Checksum ... OK
Starting kernel ...
2、 linux低级调试信息输出 Uncompressing Linux............................................................. done, booting the kernel. 3、 linux调试信息输出 Linux version 2.6.24.4(root@vm-dev)(gcc version 3.4.6) #100 Sat Nov 19 07:47:35 CST 2016
CPU: ARM920T [41129200] revision 0(ARMv4T), cr=00007177
Machine: SMDK2410
Memory policy: ECC disabled, Data cache writeback
CPU S3C2410A (id 0x32410002)
S3C2410: core 202.800 MHz, memory 101.400 MHz, peripheral 50.700 MHz
S3C24XX Clocks, (c) 2004 Simtec Electronics
CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on
CPU0: D VIVT write-back cache
CPU0: I cache: 16384 bytes, associativity 64, 32byte lines, 8sets
CPU0: D cache: 16384 bytes, associativity 64, 32byte lines, 8sets
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
Kernel command line: root=/dev/mtdblock2 noinitrd console=ttySAC1,115200
irq: clearing subpending status 00000010
PID hash table entries: 256 (order: 8, 1024 bytes)
timer tcon=00500000, tcnt a509, tcfg 00000200,00000000, usec 00001e4c
Console: colour dummy device 80x30
console [ttySAC1] enabled
............................   现在要将所有的调试信息输出到别的串口。以com1为例(com0开始计算) 一、bootloader的输出信息输出到com1 这里以u-boot1.3.2为例:很简单只需要修改一个宏定义就ok Vi inlcude/configs/xxxconfig.h(xxx为你定义的开发板的名字) 更改原有的宏   /*
 * select serial console configuration
 */
//#define CONFIG_SERIAL1 1 /* we use SERIAL 1 on SMDK2410*/
//modify for xxx2410
//by lyj_uptech
#define CONFIG_SERIAL2 1 /* we use SERIAL 2 on SMDK2410*/
二、low_level的调试信息输出到com1 在改之前我们先分析一下在linux启动之前它是如何使用串口的(以linux-2.6.24为例)。 1、 arch/arm/boot/compressed/misc.c文件中有定义   staticvoid putstr(constchar *ptr)
{
        char c;
        while ((c= *ptr++)!= '