Liberation of the Serial Console in the FreeBSD on the Raspberry Pi

Raspberry Pi has UART interface on GPIO pins 14 and 15.
FreeBSD uses it as serial console.
It outputs system messages and provides terminal mode on it.
This is good for first time setup and for debugging.
But if you plan to use this interface for connection to any special device especially in a standalone project, you need to liberate this interface.

Here is a description how to do this.

Terminal mode

UART interface in the Raspberry Pi in the FreeBSD shown as /dev/ttyu0
First step is remove getty(8) from /dev/ttyu0
To do this we need just to change “on” to “off” for the ttyu0 in the file /etc/ttys:

gettyoff

After that we can use /dev/ttyu0 with different programms to communicate with our devices.

System messages

For liberation UART interface from system messages we need to change Device tree source file.
The device tree source (DTS) is a text file which describes hardware resources of a computer system in a human-readable form.

We need to commented out strings 377 and 378 in the file /usr/src/sys/boot/fdt/dts/arm/rpi.dts:

rpidts

After changing this file we need to compile Device tree blob (DTB) file and to copy it in our boot environment.

To do that we need to run this commands:

# cd /usr/src/sys/tools/fdt
# setenv MACHINE arm
# ./make_dtb.sh /usr/src/sys /usr/src/sys/boot/fdt/dts/arm/rpi.dts rpi.dtb
# cp /boot/msdos/rpi.dtb /boot/msdos/rpidtb.old
# cp rpi.dtb /boot/msdos

dtb

New dtb file less than old one, but it works.

U-Boot messages

Unfortunately that’s not all.
We still have some messages from U-Boot on the UART interface:

uboot

I tried to change files /boot/msdos/config.txt, /boot/msdos/cmdline.txt and /boot/msdos/uenv.txt, but nothing helps.

Advertisements

5 thoughts on “Liberation of the Serial Console in the FreeBSD on the Raspberry Pi

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s