Solved Default serial console to login?

How to change the default serial console? I couldn't find any reference.
In my case (BeagleBone Black) the boot messages and login prompt go to /dev/ttyu0. With the peripherals I use that port is not accessible, and I'd like to use /dev/ttyu1 instead.
I don't care much about boot messages, but I need getty to be run on /dev/ttyu1 to login.
 
Update:

The port operates at 9600, I didn't expect that (the default port operates at 115200) and I don't know how to set it to 115200.
Not sure if this is related: PR 176606, since there is no way to set the port device name.

Also, the default line in /etc/ttys doesn't work, I had to change it to explicit "on":
Code:
# ttyu1 "/usr/libexec/getty 3wire" vt100 onifconsole secure
ttyu1 "/usr/libexec/getty 3wire" vt100 on secure

So, how can I make it "console" in this context?
I can login now, but it's very slow, of course.
 
 
Thanks, phoenix , that works, but it's strange, see what I got, /etc/ttys:
Code:
....
ttyu0   "/usr/libexec/getty 3wire"         vt100   onifconsole  secure
ttyu1   "/usr/libexec/getty 3wire.115200"  vt100   on           secure
....
However, ps shows only ttyu0 for getty
Code:
% ps ax
....
866 u0  Is+   0:00.01 /usr/libexec/getty 3wire ttyu0
867 u1  Is    0:00.11 login [pam] (login)
869 u1  S     0:00.10 -tcsh (tcsh)
I wasn't able to make it "console" yet, by the way.
 
How about this version:
ttyu1 "/usr/libexec/getty std.115200" vt100 on secure

Plus you really have to force the second port in loader I found.
echo 'comconsole_port="0x2F8"' >> /boot/loader.conf
 
How about this version:
ttyu1 "/usr/libexec/getty std.115200" vt100 on secure
Will probably work, but it's not going to make it "console". With phoenix 's suggestion it already works fine @155200.
I'm trying to make it default console using device hints according to your linked post, Phishfry .
It doesn't work for some reason, I tried different I/O addresses also, since that device is described as "uart2" in FDT, and appears as ttyS2 in Linux, but still without luck...
 
The port address and device hints were needed to force a console on anything but uart0/com1 from my memory.
What is intresting is UART2 you show. If I remember right to add a UART above UART1 you need to edit /boot/device.hints and add manually UART2 or 3.
Are you sure your console shouldn't be on ttyu2 if linux is using ttyS2? UART2=COM3=ttyu2 right?
 
Although it's 16550 compatible, the addresses are in a different range, and the device name (by kernel) is "uart1":
Code:
% grep -E 'uart[0-9]' /var/run/dmesg.boot
uart0: <TI UART (16550 compatible)> mem 0x44e09000-0x44e0afff irq 11 on simplebus0
uart0: console (115384,n,8,1)
uart1: <TI UART (16550 compatible)> mem 0x48024000-0x48025fff irq 13 on simplebus0
I tried using that address 0x48024000 in device hints, but it doesn't help.
 
That was FreeBSD FDT you were referencing?
I recompiled am335x-boneblack.dtb after enabling uart2.
It's serial@48024000 and dmesg confirms that.
Code:
# ofwdump -a | grep -i serial
    Node 0x45b4: serial@44e09000
    Node 0x46c0: serial@48022000
    Node 0x47ac: serial@48024000
    Node 0x48b8: serial@481a6000
    Node 0x496c: serial@481a8000
    Node 0x4a20: serial@481aa000
...Also, it seems the following parameters work for i386 and am64 only, from loader(8):
Code:
comconsole_speed
           Defines the speed of the serial console (i386 and amd64 only).
           ....
comconsole_port
           Defines the base i/o port used to access console UART (i386 and amd64 only).
           ....
 
Thanks! I just tried hw.uart.console="mm:0x48024000,rs:2", but it hangs, cycling power doesn't help.
I don't have physical access to the BBB, will have to wait till tomorrow to continue.

By the way, without that option the corresponding object doesn't exist:
Code:
% sysctl hw.uart
sysctl: unknown oid 'hw.uart'
Maybe it's not valid for the BBB at all?
 
I disabled uart0 in FDT (i.e. /dev/ttyu1 becomes /dev/ttyu0), still don't see boot messages, but can login then.
I suspect that the kernel takes the serial port's handle from u-boot, and reuses it. Will try to recompile u-boot. I have done it for Linux (and u-boot ouputs to uart2), FreeBSD's version of u-boot still differs although it was announced some time ago that the main-line u-boot should work, in practice it won't able to load FreeBSD loader.
 
Ah, didn't realise this was a BBB. Completely missed that in the OP. You're out of my sphere of knowledge. ARM chipsets do weird and wonderful things that aren't quite standardised. :)
 
You're out of my sphere of knowledge
Your advice helped anyway! Thanks!
The main purpose is achieved, the serial console is usable. I'd like to make that serial port default for the system console, but cannot find any hint how to do that on ARM platform.
 
I was able to switch the defaut console from uart0 to uart2.
Here are the steps performed. This is for BeagleBone Black, but can be easily adjusted for any BeagleBone or another ARM platform:

- Navigate to /usr/ports/sysutils/u-boot-beaglebone.
Code:
make extract
echo CONFIG_CONS_INDEX=3 >> ./work/u-boot-2019.04/configs/am335x_evm_defconfig
- Edit ./work/u-boot-2019.04/arch/arm/dts/am335x-boneblack.dts by adding the following sections for uart2 pins:
Code:
&am33xx_pinmux {
    uart2_pins: uart2_pins {
        pinctrl-single,pins = <
            AM33XX_IOPAD(0x950, PIN_INPUT | MUX_MODE1)
            AM33XX_IOPAD(0x954, PIN_OUTPUT | MUX_MODE1)
        >;
    };
};
&uart2 {
    pinctrl-names = "default";
    pinctrl-0 = <&uart2_pins>;
    status = "okay";
};
In the section "chosen" (at the top of the same file) replace uart0 with uart2:
Code:
chosen {
    stdout-path = &uart2;
    tick-timer = &timer2;
};
- Build u-boot: make
- Copy the files to your BBB image's FAT partition:
Code:
cp ./work/u-boot-2019.04/MLO /path/to/fat/
cp ./work/u-boot-2019.04/u-boot.img /path/to/fat/
cp ./work/u-boot-2019.04/arch/arm/dts/am335x-boneblack.dtb /path/to/fat/dtb
That's it!

The only thing I haven't resolved yet is a slight incompatibility of the FDT provided by u-boot with ones in the FreeBSD source tree.
In particular, I get multiple messages at boot:
Code:
sdhci_ti1-slot0: Controller timeout
sdhci_ti1-slot0: ============== REGISTER DUMP ==============
sdhci_ti1-slot0: Sys addr: 0x00000000 | Version:  0x00003101
sdhci_ti1-slot0: Blk size: 0x00000000 | Blk cnt:  0x00000000
sdhci_ti1-slot0: Argument: 0x00000000 | Trn mode: 0x00000102
sdhci_ti1-slot0: Present:  0x01f70000 | Host ctl: 0x00000000
sdhci_ti1-slot0: Power:    0x00000000 | Blk gap:  0x00000000
sdhci_ti1-slot0: Wake-up:  0x00000000 | Clock:    0x00008007
sdhci_ti1-slot0: Timeout:  0x00000000 | Int stat: 0x00000000
sdhci_ti1-slot0: Int enab: 0x017f00fb | Sig enab: 0x017f00fb
sdhci_ti1-slot0: AC12 err: 0x00000000 | Host ctl2:0x00000000
sdhci_ti1-slot0: Caps:     0x04e10080 | Caps2:    0x00000000
sdhci_ti1-slot0: Max curr: 0x00000000 | ADMA err: 0x00000000
sdhci_ti1-slot0: ADMA addr:0x00000000 | Slot int: 0x00000000
sdhci_ti1-slot0: ===========================================
Everything else looks good.
I created another thread about FDT and u-boot/EFI, also posted on freebsd-arm mailing list.
 
The controller timeout error is a consequence of the latest u-boot port bug, I just submitted a PR 238344.
A simple work-around:
After make extract run this:
Code:
sed -i '' 's/.*\(CONFIG_DM_MMC=\).*/\1n/' work/u-boot-2019.04/configs/am335x_evm_defconfig
 
Back
Top