Modify FreeBSD 13 memstick to enable serial console

FreeBSD installer memstick does not have serial console enabled by default. But for some hardware, it’s not convenient to access the VGA console. This article described how to enable serial console by modifying /memstick/boot/loader.conf on a memstick.

This work on FreeBSD-13.1-RELEASE-amd64-memstick.img

First, find a FreeBSD machine and mount the memstick

mkdir /memstick
mount /dev/da0s2a /memstick

And add the following lines to /memstick/boot/loader.conf

boot_multicons="YES"
boot_serial="YES"
comconsole_speed="115200"
comconsole_port="0x3F8"  # ttyu0 ttyS0
# comconsole_port="0x2F8"  # ttyu1 ttyS1
# comconsole_port="0x3E8"  # ttyu2 ttyS2
# comconsole_port="0x2E8"  # ttyu3 ttyS3
console="comconsole,vidconsole"  # legacy boot
# console="comconsole,efi"  # UEFI ("vidconsole" is not a valid option for UEFI boot)

And then umount /memstick

For detail, check loader.conf


Note: to find out the “port” number on a recent Linux version (e.g. kernel 5.15), try

Linux$ udevadm info -q all -n /dev/ttyS0 | grep DEVPATH
E: DEVPATH=/devices/platform/serial8250/tty/ttyS0
Linux$ cat /sys/devices/platform/serial8250/tty/ttyS0/port
0x3F8

On an older Linux (kernel 2.6), try

Linux$ udevadm info -q all -n /dev/ttyS0 | grep DEVPATH
E: DEVPATH=/devices/pnp0/00:07/tty/ttyS0
Linux$ cat /sys/devices/pnp0/00:07/tty/ttyS0/device/resources
state = active
io 0x3f8-0x3ff
irq 4

Leave a Reply

Your email address will not be published. Required fields are marked *