mythril icon indicating copy to clipboard operation
mythril copied to clipboard

scripts: enable the serial console for grub

Open dlrobertson opened this issue 5 years ago • 4 comments

Summary

It would be helpful for debugging if our grub.cfg output to the serial console.

Details

Our grub.cfg should enable output to the serial console as we only have a serial console (our run scrip enabling -no-graphic here).

Adding something like the following to the grub.cfg should work:

serial --unit=0 --word=8 --prity=no --stop=1 --speed=115200
terminal_input serial
terminal_output serial

dlrobertson avatar May 25 '20 01:05 dlrobertson

https://streamable.com/61ur4f

Testing with (note I changed the timeout to 5)

ntegan@swift:~/Documents/mythril$ cat scripts/grub.cfg 
set default="0"
set timeout=5

menuentry 'Mythril' {
   echo 'Loading Mythril'
   sleep 1
   echo 'dlrobertson up in tha hiz-ouse'
   sleep --verbose 4

   multiboot2 /boot/mythril.bin
   module2 /boot/seabios.bin seabios.bin
   module2 /boot/linuxboot_dma.bin linuxboot_dma.bin
   module2 /boot/vmlinuz kernel
   module2 /boot/initramfs initramfs
}

Does this count?

I couldn't get much to happen with the terminal_{input,output} options. Although there was an interesting looking vga_text mode for output

ntegan avatar Jun 02 '20 01:06 ntegan

hmmm this might have been a bad issue on my part... which version of qemu and grub are you using? I was using make qemu -- -serial pty and then using picocom -b 115200 -e z /dev/pts/... to connect to the VM and not getting output when I had a bad multiboot module.

dlrobertson avatar Jun 02 '20 02:06 dlrobertson

Ah! Seems to be yet another Ubuntu 18.04 thing. I don't see any grub output when using my ubuntu 18.04 dev laptop.

dlrobertson avatar Jun 02 '20 02:06 dlrobertson

Oh i think i did test this on a new 20.04 lts install. I can try on my 18.04 like you said and see what happens

This might remain a good issue for looking at grub/kvm/qemu issues across ubuntu releases.

#4.2.0

ntegan@swift:~/Documents/mythril$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04 LTS
Release:        20.04
Codename:       focal
ntegan@swift:~/Documents/mythril$ qemu-system-x86_64 --version
QEMU emulator version 4.2.0 (Debian 1:4.2-3ubuntu6.1)
Copyright (c) 2003-2019 Fabrice Bellard and the QEMU Project developers
ntegan@swift:~/Documents/mythril$ grub-install --version
grub-install (GRUB) 2.04-1ubuntu26
ntegan@swift:~/Documents/mythril$ uname -a
Linux swift 5.4.0-31-generic #35-Ubuntu SMP Thu May 7 20:20:34 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

ntegan avatar Jun 02 '20 21:06 ntegan