Home > Software design >  How to use decode_stacktrace.sh?
How to use decode_stacktrace.sh?

Time:07-06

Q1: enter image description here

  1. Your Win10 should automatically recognize the USB2Serial converter and install the driver. The converter appears in Device Manager, in my case COM6.
  2. Setup Putty, Serial, baud-rate 115200, Databits 8, Stopbits 1, Parity none, Flowcontrol XON/XOFF.
  3. Make sure that serial port is enabled in Linux machine.

$ dmesg | grep tty

[    0.108687] printk: console [tty0] enabled 
[    2.752397] 00:03:ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A 
[   2.773666] 00:04: ttyS1 at I/O 0x2f8 (irq = 3, base_baud = 115200) is a 16550A

It shows that both ttyS0(COM1) and ttyS1(COM2) work fine. In my case I choose ttyS1.

  1. Use getty to manage ttyS1.

sudo /sbin/getty -L 115200 ttyS1 vt102

Then the Putty would prompt login, just input your username and password to get into the command line interface. But still at this stage, the ttyS1 is another pseudo-terminal, but not a console. You need to configure it as a console.

  1. Make sure that you've already compiled in the serail port in your Linux kernel image. make menuconfig : Device driver ‣ Character devices ‣ Serial drivers ‣ 8250/16550 and compatible serial support ‣ Console on 8250/16550 and compatible serial port: choose built-in. If it's alreay that, leave it. Otherwise, change the configuration, rebuilt the kernel, and reboot.
  2. Check the current console.

$cat /sys/devices/virtual/tty/console/active

tty0

It means that current console is tty0. We need to add ttyS1 as a console.

  1. Add console=ttyS1 in Linux kernel boot argument.

$sudo vim /etc/default/grub

Change the line GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" to GRUB_CMDLINE_LINUX_DEFAULT="quiet console=ttyS1,115200 splash" Then

$sudo update-grub

$sudo reboot

  1. Check the current console.

$ cat /sys/devices/virtual/tty/console/active

ttyS1

That's it.

  1. Call getty again.

sudo /sbin/getty -L 115200 ttyS1 vt102

Then Putty would get the login prompt and after you login, it becomes a real console.

  • Related