Welcome! Log In Create A New Profile

Advanced

Restoring Console Log Output

Posted by Christopher 
Christopher
Restoring Console Log Output
August 05, 2018 07:21PM
Bohdi:

Got a question about kernel settings that control console log output to the serial port on a Dockstar during boot.

I started out to regenerate a couple of Dockstars that were gathering dust on the shelf, but decided to update the kernels from System.map-3.2.0-4-kirkwood to your current linux-4.17.2-kirkwood.

My first attempt to update uBoot was >ahem< less than successful, resulting in a box that wouldn't boot from the previous kernel. Fortunately, I had purchased a 3.3 volt serial cable and could watch the boot process.

This post helped me restore that Dockstar and the rest by using tftp to restore the uBoot in flash memory, and has become my standard way to update the boot loader:

https://forum.doozan.com/read.php?3,6965,6965#msg-6965

It was worth the time to set up a tftp server on a laptop running Ubuntu. I did notice that you have to read this line in the manual instructions carefully to get the length of the load correct, and then things were consistent:

....

Marvell>> nand write.e 0x800000 0x0 0x80000
nand write.e 0x800000 0x0 0x80000
^^^^^^^^

This sets the length of the load to 512 KB, same as the file size.

At the moment, I have one Dockstar up to your linux-4.17.2-kirkwood-tld-1-bodhi.tar.bz2 build; but I am holding the rest at the Debian-4.12.1-kirkwood-tld-1-rootfs-bodhi.tar.bz2 rootfs after updates.

I noticed that the rootfs build boots up with verbose console messages. This is helpful to me because I can see issues during the boot and the messages give me someplace to look.

Your 4.17.2 build turns these off. The messages are all captured in the ring buffer and available through the dmesg command, but if the system is unbootable, that creates more problems trying to correct the problem.

For the 4.17.2 build, the console is silent once the kernel starts booting. If the boot is successful, I can use the dmesg command. If the box does not boot, however, I am left with little to go on.

I have chased the printk settings, but these control the depth of logging captured by dmesg, not what is printed on the serial console output. So far, I haven't been able to find the magic switch to turn them back on.

In your experience, what kernel parameter can I set or pass to restore verbose console messages during bootup?

ADVThanksANCE,


Christopher
Re: Restoring Console Log Output
August 05, 2018 10:26PM
Christopher,

> I noticed that the rootfs build boots up with
> verbose console messages. This is helpful to me
> because I can see issues during the boot and the
> messages give me someplace to look.
>
> Your 4.17.2 build turns these off.

That's incorrect. Serial console log should show everything from u-boot banner till Debian prompt. There should be no change just because you upgrade the kernel. So this problem is specific to your box.

> For the 4.17.2 build, the console is silent
> once the kernel starts booting.

This told me your u-boot console were not set to serial. Probably you did have netconsole activated at one point, or something like that.

To restore console to serial, boot up and log into Debian, and

fw_printenv

Look at stdin, stdout, stderr variables. If they are not =serial

then set them
fw_setenv stdin serial
fw_setenv stdout serial
fw_setenv stderr serial

-bodhi
===========================
Forum Wiki
bodhi's corner
Christopher
Re: Restoring Console Log Output
August 06, 2018 04:00PM
Bodhi:

I was hoping you would say that, so I went back and swapped USB drives on the Dockstar in question. I was able to validate that it produces verbose console logging messages on the serial port when booting from the Linux-4.12.1-kirkwood-tld-1 kernel, but does not produce the logging messages when I return to USB stick that I updated to the the Linux-4.17.2-kirkwood-tld-1 kernel. The ramdisk is initramfs-4.12.1-kirkwood-tld-1 in both cases.

Here is the current environment. You will notice that I set set_bootargs to include 'root=/dev/sda1' as I was having issues earlier with the box recognizing LABEL=rootfs and haven't reset it:

=~=~=~=~=~=~=~=~=~=~=~= PuTTY log 2018.08.06 17:45:49 =~=~=~=~=~=~=~=~=~=~=~=
printenv
arcNumber=2998
bootcmd=run bootcmd_uenv; run scan_disk; run set_bootargs; run bootcmd_exec
bootcmd_exec=run load_uimage; if run load_initrd; then if run load_dtb; then bootm $load_uimage_addr $load_initrd_addr $load_dtb_addr; else bootm $load_uimage_addr $load_initrd_addr; fi; else if run load_dtb; then bootm $load_uimage_addr - $load_dtb_addr; else bootm $load_uimage_addr; fi; fi
bootcmd_uenv=run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi
bootdelay=3
bootdev=usb
device=0:1
devices=usb ide mmc
disks=0 1 2 3
dtb_file=/boot/dts/kirkwood-dockstar.dtb
ethact=egiga0
ethaddr=<snipped>
if_netconsole=ping $serverip
ipaddr=<snipped, set but the Dockstar is given a DHCP lease based on its MAC address>
led_error=orange blinking
led_exit=green off
led_init=green blinking
load_dtb=echo loading DTB $dtb_file ...; load $bootdev $device $load_dtb_addr $dtb_file
load_dtb_addr=0x1c00000
load_initrd=echo loading uInitrd ...; load $bootdev $device $load_initrd_addr /boot/uInitrd
load_initrd_addr=0x1100000
load_uimage=echo loading uImage ...; load $bootdev $device $load_uimage_addr /boot/uImage
load_uimage_addr=0x800000
mainlineLinux=yes
mtdids=nand0=orion_nand
mtdparts=mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data)
partition=nand0,2
preboot_nc=run if_netconsole start_netconsole
scan_disk=echo running scan_disk ...; scan_done=0; setenv scan_usb "usb start";  setenv scan_ide "ide reset";  setenv scan_mmc "mmc rescan"; for dev in $devices; do if test $scan_done -eq 0; then echo Scan device $dev; run scan_$dev; for disknum in $disks; do if test $scan_done -eq 0; then echo device $dev $disknum:1; if load $dev $disknum:1 $load_uimage_addr /boot/uImage 1; then scan_done=1; echo Found bootable drive on $dev $disknum; setenv device $disknum:1; setenv bootdev $dev; fi; fi; done; fi; done
serverip=<snipped tftp server>
set_bootargs=setenv bootargs root=/dev/sda1 rootdelay=10 $mtdparts $custom_params
start_netconsole=setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; setenv stdout nc; setenv stderr nc; version;
stderr=serial
stdin=serial
stdout=serial
uenv_addr=0x810000
uenv_import=echo importing envs ...; env import -t $uenv_addr $filesize
uenv_init_devices=setenv init_usb "usb start";  setenv init_ide "ide reset";  setenv init_mmc "mmc rescan"; for devtype in $devices; do run init_$devtype; done;
uenv_load=run uenv_init_devices; setenv uenv_loaded 0; for devtype in $devices;  do for disknum in 0; do run uenv_read_disk; done; done;
uenv_read=echo loading envs from $devtype $disknum ...; if load $devtype $disknum:1 $uenv_addr /boot/uEnv.txt; then setenv uenv_loaded 1; fi
uenv_read_disk=if test $devtype -eq mmc; then if $devtype part; then run uenv_read;  fi; else if $devtype part $disknum; then run uenv_read; fi;  fi
usb_ready_retry=15

Environment size: 2820/131068 bytes
DockStar> 
=~=~=~=~=~=~=~=~=~=~=~= end PuTTY log =~=~=~=~=~=~=~=~=~=~=~=


Here is the console output:

=~=~=~=~=~=~=~=~=~=~=~= PuTTY log of boot session =~=~=~=~=~=~=~=~=~=~=~=

U-Boot 2017.07-tld-1 (Oct 24 2017 - 22:32:36 -0700)
Seagate FreeAgent DockStar

SoC:   Kirkwood 88F6281_A0
DRAM:  128 MiB
WARNING: Caches not enabled
NAND:  256 MiB
In:    serial
Out:   serial
Err:   serial
Net:   egiga0
88E1116 Initialized on egiga0
Hit any key to stop autoboot:  3  2  1  0 
starting USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 3 USB Device(s) found
       scanning usb for storage devices... 
Use USB retry period from the environment: 15 second(s)
1 Storage Device(s) found
Unknown command 'ide' - try 'help'
Unknown command 'mmc' - try 'help'

Partition Map for USB device 0  --   Partition Type: DOS

Part	Start Sector	Num Sectors	UUID		Type
  1	2048      	15656960  	12f0090b-01	83

## Unknown partition table type 0

## Unknown partition table type 0

## Unknown partition table type 0

## Unknown partition table type 0

## Unknown partition table type 0

## Unknown partition table type 0
loading envs from usb 0 ...
12 bytes read in 1921 ms (0 Bytes/s)
Unknown command 'ide' - try 'help'
Unknown command 'mmc' - try 'help'
importing envs ...
running scan_disk ...
Scan device usb
device usb 0:1
1 bytes read in 723 ms (0 Bytes/s)
Found bootable drive on usb 0
loading uImage ...
4115496 bytes read in 1046 ms (3.8 MiB/s)
loading uInitrd ...
7245696 bytes read in 1108 ms (6.2 MiB/s)
loading DTB /boot/dts/kirkwood-dockstar.dtb ...
10058 bytes read in 831 ms (11.7 KiB/s)
## Booting kernel from Legacy Image at 00800000 ...
   Image Name:   Linux-4.17.2-kirkwood-tld-1
   Created:      2018-08-01  15:07:48 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    4115432 Bytes = 3.9 MiB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... OK
## Loading init Ramdisk from Legacy Image at 01100000 ...
   Image Name:   initramfs-4.12.1-kirkwood-tld-1
   Created:      2018-08-01  15:40:49 UTC
   Image Type:   ARM Linux RAMDisk Image (gzip compressed)
   Data Size:    7245632 Bytes = 6.9 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 01c00000
   Booting using the fdt blob at 0x1c00000
   Loading Kernel Image ... OK
   Loading Ramdisk to 07426000, end 07b0ef40 ... OK
   Loading Device Tree to 07420000, end 07425749 ... OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.

*********************   a whole mess of spaces in the capture file that are not seen on the PuTTY session *************************************
Debian GNU/Linux 9 dockstar3 ttyS0

dockstar3 login: root

Password: 
Last login: Mon Aug  6 06:50:13 EDT 2018 on ttyS0
Linux dockstar3 4.17.2-kirkwood-tld-1 #1 PREEMPT Sun Jun 17 23:16:03 PDT 2018 armv5tel

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
root@dockstar3:~# date
Mon Aug  6 17:32:02 EDT 2018
root@dockstar3:~# 

=~=~=~=~=~=~=~=~=~=~=~= end PuTTY log of boot session =~=~=~=~=~=~=~=~=~=~=~=


Does anything look out of place here?

Regards,


Christopher


-------
Moderator edit: please use code tags (i.e. Formatted code button) when posting log.



Edited 1 time(s). Last edit at 08/06/2018 10:28PM by bodhi.
Re: Restoring Console Log Output
August 06, 2018 10:34PM
Christopher,

Your bootargs was messed up. It should have the console parameter in it.

set_bootargs=setenv bootargs console=ttyS0,115200 root=/dev/sda1 rootdelay=10 $mtdparts $custom_params

-bodhi
===========================
Forum Wiki
bodhi's corner
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: