1

I am working on an embedded Project with Minnowboard Max and customized Linux kernel with u-boot.

The Kernel command line parameters:

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

I am seeing that none of the debug_pustr messages defined in the misc.c file is getting printed in the serial port.

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

I have also enabled CONFIG_X86_VERBOSE_BOOTUP =y in the kernel menuconfig.

Is there any way to see these messages in the serial port?

sawdust
  • 16,103
  • 3
  • 40
  • 50
evk1206
  • 433
  • 7
  • 18
  • `initcall_debug` parameter does not take an assignment. What image file are you loading? Have you defined a serial port for the decompressor? What are the port configuration settings? – sawdust Jun 28 '16 at 07:31
  • It's bzimage with gzip compression. Where should I define serial port for the decompressor? – evk1206 Jun 28 '16 at 07:41
  • I'm not sure what an x86 U-Boot & kernel uses (e.g. ARM uses the Image or zImage file rather than vmlinux), but only a self-extracting kernel would execute that code you mention. Other arches/machines allow specification of the debug serial port. For x86 it looks like it defaults to the UART at port 0x3f8; see **arch/x86/boot/early_serial_console.c**. Check your SoC and board specifications; are you connected to the correct pins, or do you have to hack that module? – sawdust Jun 28 '16 at 07:54
  • *"It's bzimage with gzip compression"* -- The makefile says it's bzImage. – sawdust Jun 28 '16 at 07:59
  • Looks like x86 is quite different from ARM regarding earlyprintk. You apparently need to specify the command line parameter `earlyprintk=/dev/tty...` to get the decompression messages. On ARM, this is handled by a separate serial port config, and earlyprintk doesn't take effect until after **init_kernel()** has started. – sawdust Jun 28 '16 at 08:19
  • perfect ! earlyprintk=ttyS0,115200 solves the issue. Many thanks – evk1206 Jun 28 '16 at 08:23

1 Answers1

1

Is there any way to see these messages in the serial port?

Salient information is the processor architecture.
For instance in ARM booting, the decompressor code uses its own serial port configuration which is distinct from earlyprintk. Some ARM machines have config dialog to specify this early serial port; some might use the machine ID (see How do I find ARM Linux entry point when it fails to uncompress?). On ARM earlyprintk is not effective untill after the (init/main.c) init_kernel() routine has started.

For x86 all early serial port configuration & I/O is consolidated into the earlyprintk feature. Use the kernel command line parameter to define the serial port (default is device at 0x3F8) and baud rate (default is 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.
Community
  • 1
  • 1
sawdust
  • 16,103
  • 3
  • 40
  • 50
  • Unfortunately this is not working on x86 in case of absence of COM1/COM2 (legacy ttyS0 /ttyS1) ports. For example, on Intel Edison. I have some hacks in my local tree, will do support later when will have time. – 0andriy Jun 29 '16 at 22:50
  • And by the way `earlyprintk` is a legacy stuff, we need to support `earlycon`. – 0andriy Jun 29 '16 at 22:52
  • @AndyShevchenko -- *"this is not working on x86 in case of absence of COM1/COM2..."* -- You can specify whatever serial port in the parameter argument. *"earlyprintk is a legacy stuff"* -- I still see `#if CONFIG_EARLY_PRINTK` in the x86 boot code of Linux kernel (current) version 4.6, so it's not deprecated. – sawdust Jun 29 '16 at 23:50
  • Nope, you can specify only those two: http://lxr.free-electrons.com/source/arch/x86/boot/early_serial_console.c#L72. Yes, due to lack of support of `earlycon` there. – 0andriy Jun 30 '16 at 08:44