linux输出信息重定向.doc

上传人:新** 文档编号:559771033 上传时间:2022-11-24 格式:DOC 页数:5 大小:28.01KB
返回 下载 相关 举报
linux输出信息重定向.doc_第1页
第1页 / 共5页
linux输出信息重定向.doc_第2页
第2页 / 共5页
linux输出信息重定向.doc_第3页
第3页 / 共5页
linux输出信息重定向.doc_第4页
第4页 / 共5页
linux输出信息重定向.doc_第5页
第5页 / 共5页
亲,该文档总共5页,全部预览完了,如果喜欢就下载吧!
资源描述

《linux输出信息重定向.doc》由会员分享,可在线阅读,更多相关《linux输出信息重定向.doc(5页珍藏版)》请在金锄头文库上搜索。

1、重定向linux输出信息(linux2.6)在运行linux的时候有所有的调试信息可以分为三个部分1、 bootloader输出信息U-Boot (Nov 19 2016 - 22:02:08)DRAM: 64 MBFlash: 512 kBNAND: 64 MiBIn: serialOut: serialErr: serialHit any key to stop autoboot: 0 yqliu2410 # tftpFound DM9000 ID:46 at address 10000000 !DM9000 work in 16 bus widthbd-bi_entaddr: 08:00

2、:3e:26:5beth_initMAC:8:0:3e:26:a:5b:TFTP from server 192.168.1.152; our IP address is 192.168.1.155Filename uImage.Load address: 0x30008000Loading: T T T T # #doneBytes transferred = 1617316 (18ada4 hex)up-tech2410 # bootm# Booting image at 30008000 . Image Name: Linux-.4 Created: 2016-11-19 14:05:2

3、9 UTC Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 1617252 Bytes = 1.5 MB Load Address: 30008000 Entry Point: 30008040 Verifying Checksum . OKStarting kernel .2、 linux低级调试信息输出Uncompressing Linux. done, booting the kernel.3、 linux调试信息输出Linux version .4 (rootvm-dev) (gcc version 3.4.6)

4、 #100 Sat Nov 19 07:47:35 CST 2016CPU: ARM920T 41129200 revision 0 (ARMv4T), cr=00007177Machine: SMDK2410Memory policy: ECC disabled, Data cache writebackCPU S (id 0x32410002)S2410: core 202.800 MHz, memory 101.400 MHz, peripheral 50.700 MHzS24XX Clocks, (c) 2004 Simtec ElectronicsCLOCK: Slow mode (

5、1.500 MHz), fast, MPLL on, UPLL onCPU0: D VIVT write-back cacheCPU0: I cache: 16384 bytes, associativity 64, 32 byte lines, 8 setsCPU0: D cache: 16384 bytes, associativity 64, 32 byte lines, 8 setsBuilt 1 zonelists in Zone order, mobility grouping on. Total pages: 16256Kernel command line: root=/dev

6、/mtdblock2 noinitrd console=ttySAC1,115200irq: clearing subpending status 00000010PID hash table entries: 256 (order: 8, 1024 bytes)timer tcon=00500000, tcnt a509, tcfg 00000200,00000000, usec 00001eConsole: colour dummy device 80x30console ttySAC1 enabledDentry cache hash table entries: 8192 (order

7、: 3, 32768 bytes)Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)Memory: 64MB = 64MB totalMemory: 61488KB available (2936K code, 305K data, 132K init)Mount-cache hash table entries: 512CPU: Testing write buffer coherency: ok.现在要将所有的调试信息输出到别的串口。以com1为例(从com0开始计算)!一、将bootloader的输出信息输出到com1

8、这里以u-boot为例:很简单只需要修改一个宏定义就okVi 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 */更改完之后就可以看到u-boot的调试信息输出到com1,这一步

9、很简单。二、将low_level 的调试信息输出到com1在改之前我们先分析一下在linux启动之前它是如何使用串口的。1、 在arch/arm/boot/compressed/misc.c文件中有定义static void putstr(const char *ptr) char c; while (c = *ptr+) != 0) if (c = n) putc(r); putc(c); flush();2、 arch/arm/boot/compressed/misc.中的函数decompress_kernel就是使用的putstr来打印的如下输出信息:Uncompressing Linu

10、x. done, booting the kernel.3、 追根溯源,putstr函数最终调用的是putc(请注意这里的putc不是在misc.c函数中定义的icedcc_putc,因为没有CONFIG_CPU_V6宏定义),真正的底层操作在文件include/asm-arm/plat-s3c/uncompress.h4、 解析该文件/* we can deal with the case the UARTs are being run* in FIFO mode, so that we dont hold up our execution* waiting for tx to happen

11、.*/static void putc(int ch) if (uart_rd(S2410_UFCON) & S2410_UFCON_FIFOMODE) int level; while (1) level = uart_rd(S2410_UFSTAT); level &= fifo_mask; if (level fifo_max) break; else /* not using fifos */ while (uart_rd(S2410_UTRSTAT) & S2410_UTRSTAT_TXE) != S2410_UTRSTAT_TXE) barrier(); /* write byte

12、 to transmission register */ uart_wr(S2410_UTXH, ch);该函数中调用的两个函数,uart_rd uart_wr在同一个文件中定义#define uart_base S24XX_PA_UART + (0x4000*CONFIG_S_LOWLEVEL_UART_PORT)static _inline_ voiduart_wr(unsigned int reg, unsigned int val) volatile unsigned int *ptr; ptr = (volatile unsigned int *)(reg + uart_base); *ptr = val;static _inline_ unsigned intuart_rd(unsigned int reg) volatile unsigned int *ptr; ptr = (volatile unsigned int *)(reg + uart_base); return *ptr;从宏定义uart_base中就可以清楚的看到,当CONFIG_S3C_LOWLEVEL_UART_PORT为0时,uart_base的值为0x50000000,也就是uart0的控制寄存

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 生活休闲 > 社会民生

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号