5

How to access the grub menu using a usb serial converter?

I know it's possible to have grub menu in serial console, putting these lines in grub.conf:

serial --unit=0 --speed=9600 --word=8 --parity=no --stop=1
terminal serial

But with usb serial converter? In linux it is /dev/ttyUSB0 and I can use it to see boot messages.

1
1

Didn't tried it myself, but I've found this information on the coreboot wiki (https://www.coreboot.org/GRUB2#On_a_USB_serial_or_USB_debug_adapter)

To enable serial, first find out the name of your usb serial port trough:

insmod nativedisk # needed not to get the disk disapearing when insmoding the *hci
insmod ehci
insmod ohci
insmod uhci
insmod usb
insmod usbserial_pl2303
insmod usbserial_ftdi
insmod usbserial_usbdebug
terminal_output

The terminal_output command should print it:

grub> terminal_output 
Active output terminals:
serial_usb1 gfxterm 
Available output terminals:
console vga_text serial 
Here we can see "serial_usb1" so we now know that its name is usb1

Then add the following on top of your grub.cfg:

insmod nativedisk
insmod ehci
insmod ohci
insmod uhci
insmod usb
insmod usbserial_pl2303
insmod usbserial_ftdi
insmod usbserial_usbdebug
serial --speed=115200 --word=8 --parity=no --stop=1 usb1
terminal_output --append serial_usb1
terminal_input --append serial_usb1

The following chips/protocols are supported:

usbdebug
ftdi
pl2303

The Wiki is outdated, but the answer seems legit.

1
  • Thanks for answering after almost 8 years. I don't even remember if 8 years ago I solved this problem (but I guess not, otherwise there should be my answer here too). I suspect 8 years ago those grub modules didn't exist. But now, this is the correct answer. Thanks. – Alessandro Pezzato Feb 16 at 13:36
1

I guess serial output works only if there is something at the default address of the serial port. The kernel does not know what USB is in the moment when its output begins. A USB to serial converter does this: It looks like a serial port to the other device but like USB to the system itself. You need it the other way round: It must look like a serial port to the local system, not matter what it looks like to the other device.

3
  • You're right. This is obvious. Linux kernel can use it as a serial device through /dev/ttyUSB0. But grub? – Alessandro Pezzato Jun 18 '13 at 15:04
  • 1
    @AlessandroPezzato Even the kernel cannot simply access it as a serial port. It needs to talk to the USB controller. Thus no output is possible until both USB and the adapter driver are available (usually as a module). – Hauke Laging Jun 18 '13 at 15:10
  • 1
    Right, kernel uses a module, usally ftdi or prolific. I guess something similar exists for grub. – Alessandro Pezzato Jun 18 '13 at 15:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.