OK6410A 开发板 (八) 13 linux-5.11 OK6410A start_kernel 打印角度 第一阶段 console

在 u-boot 中, u-boot 对 console 进行了管理,并通过u-boot的环境变量 stdout 进行控制
在 linux-5.11, linux也对  console 进行了管理,并通过 u-boot的bootargs(或dts) 中的 一些字段 进行管理,下面写下bootargs 中的这些字段 // 同的驱动,不同的内核支持不同的 bootargs // 请查找 early_param __setup
	1. console=xxx
	2. earlyprintk=xxx
	3. earlycon=xxx
	4. boot_delay=xxx
	5. no_console_suspend
	
	这些字段 在 linux boot 的 不同阶段 被 解读 

linux console 管理涉及到的 硬件模块 和 软件模块
	硬件 : lcd uart
	软件 : lcd uart console printk earlycon early_printk
linux-5.11 ok6410a 中的 console 实例
  • 相关打印
Kernel command line: root=/dev/nfs rw nfsroot=10.10.11.59:/home/suws/ok6410/system-new/buildroot/output/images/rootfs console=tty0 console=ttySAC0,115200 init=/linuxrc ip=10.10.11.120

Console: colour dummy device 80x30
printk: console [tty0] enabled
// 没有打印 console [ttySAC0] enabled

------------- do_initcalls begin

Console: switching to colour frame buffer device 60x34
fb0: s3cfb frame buffer device
s3c6400-uart.0: ttySAC0 at MMIO 0x7f005000 (irq = 69, base_baud = 0) is a S3C6400/10
printk: console [ttySAC0] enabled
s3c6400-uart.1: ttySAC1 at MMIO 0x7f005400 (irq = 70, base_baud = 0) is a S3C6400/10
s3c6400-uart.2: ttySAC2 at MMIO 0x7f005800 (irq = 71, base_baud = 0) is a S3C6400/10
s3c6400-uart.3: ttySAC3 at MMIO 0x7f005c00 (irq = 72, base_baud = 0) is a S3C6400/10
------------- do_initcalls end
  • 相关函数
start_kernel
	console_init
		con_init
			pr_info("Console: %s %s %dx%d\n", vc->vc_can_do_color ? "colour" : "mono", display_desc, vc->vc_cols, vc->vc_rows);
				Console: colour dummy device 80x30
			register_console(&vt_console_driver);
				printk: console [tty0] enabled
		s3c24xx_serial_console_init
			if (port->mapbase == 0x0) return -ENODEV; 
			// 由于此时 (port->mapbase == 0x0) , 还没到注册 console ,就退出了
			// 所以 console_init 的时候并没有注册 uart 到控制台
				
			// earlycon 
			// param_setup_earlycon->setup_earlycon->register_earlycon->parse_options->port->mapbase = addr;
			
do_initcalls
	module_platform_driver(s3cfb_driver);
		...
			s3cfb_probe
				register_framebuffer
					Console: switching to colour frame buffer device 60x34
				printk(KERN_INFO "fb%d: %s frame buffer device\n", s3cfb_info[index].fb.node, s3cfb_info[index].fb.fix.id);
					

	console_initcall(s3c24xx_serial_console_init);
		...
			register_console(&s3c24xx_serial_console);
				...
					s3c6400-uart.0: ttySAC0 at MMIO 0x7f005000 (irq = 69, base_baud = 0) is a S3C6400/10
					s3c24xx_serial_console_setup
						printk: console [ttySAC0] enabled
	
printk 执行流程
printk
	

参数

console

早期 console
  • 早期 的定义
串口初始化完成,并注册 console 
大概在哪个函数调用??? // TODO
  • 早期console机制分类
1. early_printk 		// 架构相关 arch/arm/kernel/early_printk.c
2. earlycon				// 架构无关 drivers/tty/serial/earlycon.c
  • early_printk
// 只针对 linux5.11 OK6410a
A : linux  配置 CONFIG_EARLY_PRINTK
B : u-boot 配置 earlyprintk=ttySAC0,115200

无AB ,console_init 之后 会打出来,在 console_init 之前死循环,打印不出来
有AB ,在 console_init 之前死循环,打印能出来

加入内核时间:Wed Dec 9 10:02:18 2009 // v2.6.33-rc1 之后才支持 earlycon 
问题 : 在 ok6410A linux-5.11 上 如此配置会卡死,无任何启动信息打印
  • earlycon
// 只针对 linux5.11 OK6410a
A : linux 配置 CONFIG_SERIAL_EARLYCON
B : u-boot 配置 earlycon=s3c6400,mmio32,0x7F005000,115200

加入内核时间 : Fri Apr 18 17:19:55 2014 // v3.15-rc2 之后才支持 earlycon 机制
问题 : 如此配置 启动信息会通过 earlycon 打印出来,但是 打印到 paging_init-> early_fixmap_shutdown earlycon就不再打印了.且会卡死

earlycon  利用了 fixmap
	https://www.cnblogs.com/alantu2018/p/8447570.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值