【问题标题】:Linux Kernel Decompressing Linux message not getting printed on UARTLinux内核解压缩Linux消息未在UART上打印
【发布时间】:2016-06-28 07:06:37
【问题描述】:

我正在使用 Minnowboard Max 和带有 u-boot 的定制 Linux 内核开发一个嵌入式项目。

内核命令行参数:

initcall_debug=1 video=HDMI-A-1:1920x1200MR@60D console=ttyS0,115200 console=tty0

我看到 misc.c 文件中定义的 debug_pusr 消息都没有打印到串行端口中。

debug_putstr("\nDecompressing Linux... ");

我也启用了 CONFIG_X86_VERBOSE_BOOTUP =y 在内核菜单配置中。

有没有办法在串口看到这些信息?

【问题讨论】:

  • initcall_debug 参数不进行赋值。你正在加载什么图像文件?您是否为解压器定义了一个串行端口?端口配置设置是什么?
  • 它是带有 gzip 压缩的 bzimage。我应该在哪里为解压器定义串口?
  • 我不确定 x86 U-Boot 和内核使用什么(例如 ARM 使用 Image 或 zImage 文件而不是 vmlinux),但只有自解压内核会执行您提到的代码。其他拱门/机器允许指定调试串行端口。对于 x86,它看起来默认为端口 0x3f8 的 UART;请参阅 arch/x86/boot/early_serial_console.c。检查您的 SoC 和电路板规格;您是否连接到正确的引脚,还是必须破解该模块?
  • "这是 bzimage 和 gzip 压缩" -- makefile 说它是 bzImage。
  • 看起来 x86 在 earlyprintk 方面与 ARM 有很大不同。您显然需要指定命令行参数earlyprintk=/dev/tty... 来获取解压缩消息。在 ARM 上,这是由单独的串行端口配置处理的,并且 earlyprintk 直到 init_kernel() 启动后才会生效。

标签: linux linux-kernel x86 embedded-linux


【解决方案1】:

有没有办法在串口看到这些信息?

显着的信息是处理器架构。
例如,在 ARM 引导中,解压缩器代码使用其自己的串行端口配置,这与 earlyprintk 不同。一些 ARM 机器有配置对话框来指定这个早期的串口;有些人可能会使用机器 ID(请参阅How do I find ARM Linux entry point when it fails to uncompress?)。在 ARM 上 earlyprintk 直到 (init/main.c) init_kernel() 例程启动后才会生效。

对于 x86,所有早期的串行端口配置和 I/O 都整合到 earlyprintk 功能中。使用内核命令行参数定义串口(默认为0x3F8的设备)和波特率(默认为9600)。

1081         earlyprintk=    [X86,SH,BLACKFIN,ARM,M68k]
1082                         earlyprintk=vga
1083                         earlyprintk=efi
1084                         earlyprintk=xen
1085                         earlyprintk=serial[,ttySn[,baudrate]]
1086                         earlyprintk=serial[,0x...[,baudrate]]
1087                         earlyprintk=ttySn[,baudrate]
1088                         earlyprintk=dbgp[debugController#]
1089                         earlyprintk=pciserial,bus:device.function[,baudrate]
1090 
1091                         earlyprintk is useful when the kernel crashes before
1092                         the normal console is initialized. It is not enabled by
1093                         default because it has some cosmetic problems.
1094 
1095                         Append ",keep" to not disable it when the real console
1096                         takes over.
1097 
1098                         Only one of vga, efi, serial, or usb debug port can
1099                         be used at a time.
1100 
1101                         Currently only ttyS0 and ttyS1 may be specified by
1102                         name.  Other I/O ports may be explicitly specified
1103                         on some architectures (x86 and arm at least) by
1104                         replacing ttySn with an I/O port address, like this:
1105                                 earlyprintk=serial,0x1008,115200
1106                         You can find the port for a given device in
1107                         /proc/tty/driver/serial:
1108                                 2: uart:ST16650V2 port:00001008 irq:18 ...
1109 
1110                         Interaction with the standard serial driver is not
1111                         very good.
1112 
1113                         The VGA and EFI output is eventually overwritten by
1114                         the real console.
1115 
1116                         The xen output can only be used by Xen PV guests.

【讨论】:

  • 不幸的是,如果没有 COM1/COM2(传统 ttyS0 /ttyS1)端口,这不适用于 x86。例如,在英特尔爱迪生上。我的本地树中有一些 hack,稍后有时间会提供支持。
  • 顺便说一句earlyprintk 是一个遗留的东西,我们需要支持earlycon。
  • @AndyShevchenko -- "如果没有 COM1/COM2,这在 x86 上不起作用..." -- 您可以在参数参数中指定任何串行端口. “earlyprintk is a legacy stuff” -- 我仍然在 Linux 内核(当前)版本 4.6 的 x86 引导代码中看到 #if CONFIG_EARLY_PRINTK,所以它没有被弃用。
  • 不,您只能指定这两个:lxr.free-electrons.com/source/arch/x86/boot/…。是的,由于那里缺乏对earlycon 的支持。
猜你喜欢
  • 2015-06-02
  • 1970-01-01
  • 2015-12-12
  • 1970-01-01
  • 2013-06-15
  • 1970-01-01
  • 2011-06-26
  • 2012-03-23
相关资源
最近更新 更多