• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Installing FreeBSD over serial console

Rajesh

Member

Thanks: 3
Messages: 34

#26
I tried with multiple baud rate (9600, 19200, 38400, 57600 and 115200). But no luck. Here are the changes I have for each speed,

1. Set the speed to X (Eg: 115200) in BIOS for the COM0 serial port. (Other Constant values: Data bits - 8, Stop bits - 1, Parity - 1, Flow Control - None)
Mounted bootable usb and made the following changes
2. boot.config
Code:
-SX -Dh
Eg: -S115200 -Dh
3. boot/loader.conf
Code:
boot_multicons="YES"
boot_serial="YES"
comconsole_speed="X" (Eg: 115200)
comconsole_port=0x3F8
console=comconsole
hw.uart.console="io:0x3F8"
4. boot/device.hints
Code:
hint.uart.0.at="isa"
hint.uart.0.baud="X" (Eg: 115200)
hint.uart.0.flags=0x10
hint.uart.0.port=0x3F8
hint.uart.1.at="isa"
hint.uart.1.baud="X" (Eg: 115200)
hint.uart.1.port=0x2F8
5. etc/ttys
Code:
ttyu0   "/usr/libexec/getty 3wire"   vt100   onifconsole secure
Otherways,
ttyu0   "/usr/libexec/getty 3wire.X"   vt100   onifconsole secure (Eg: 3wire.115200)
ttyu0   "/usr/libexec/getty std.X"   vt100   onifconsole secure (Eg: std.115200)
From Windows, I have the serial settings as below and connected.
Code:
Speed - X (Eg: 115200)
Data bits - 8
Stop bits - 1
Parity - 1
Flow Control - None
One other reason I could see is,
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=193745#c22

Could this reason be the case here? Or is there anything wrong in the above settings or its order?
 

Phishfry

Son of Beastie

Thanks: 874
Messages: 2,657

#27
Set the speed to X (Eg: 115200) in BIOS for the COM0 serial port.
Now this is the first you mentioned COM0.

Me and jef were just talking about COM0 on our Lanner Boxes.
So like I said to him, COM0 in BIOS console redirect = The RJ45 Serial Port.
On these boards there is no db9 serial. So I added one to the motherboard header for COMb.
Then in BIOS I have to enable Serial Redirect for COM1 for Serial redirect to the second serial port.
Now the operating system see's these as COM1 and COM2
To get COM2 serial console working I had to add a setting
(Search dmesg for the port number of your serial port (0x2f8 for COM2 on my motherboard)):
comconsole_port=0x2f8
To the /boot/loader.conf settings for comconsole on serial port 2.
.
Also you need to edit /etc/ttys to configure the second serial port for a console.
ttyu1 "/usr/libexec/getty std.115200" vt100 onifconsole secure
.
So maybe your board had an option for RJ45 console and it was left off, but BIOS still thinks it is there.
So in the bios console redirect screen try and change COM0 to COM1. On many boards you can have serial redirect over both.
COM0 and COM1

That's all i got. Are you absolutly sure there is no serial console jack. A RJ45 connector that looks exactly like a LAN jack.
It is easy to confuse them.
 

Rajesh

Member

Thanks: 3
Messages: 34

#28
Hi Phishfry, Sorry about the delayed response.

Hardware: 2 DB-9 serial ports, 4 USB 3.0 ports, 2 SFP network ports on-board. Apart from this, there is a PCI VGA card with traditional VGA port. No RJ45 kind of port.

BIOS: Serial port redirection settings list two serial ports COM0 and COM1. Both are enabled and each have their own settings for baudrate, flow control etc.,

In comment #26, I have given the setting I had for getting the serial console using COM0 (I have disabled COM1 in BIOS). Likewise and inline with what you have said in comment #27, I made similar changes (in /boot/loader.conf and /etc/ttys) to get serial console using COM1(disabling COM0 in BIOS). But I still couldn't get the boot logs in serial console.

Now the operating system see's these as COM1 and COM2
Since, I am hitting issues during Installation part itself, I couldn't see how the serial ports are seen by the OS.

Other tests and observations:

1. When trying to get the serial console via COM0, I see lot of other logs(may be BIOS logs) before the freebsd loader prompt. Not sure if any other service is using COM0 port for its output (like SirDice mentioned in comment #20). I don't see those logs in VGA output. Any idea what logs it could be?
2. When trying to get the serial console via COM1, I DO NOT see those other logs (what I see with COM0).
3. If I change the Baud rate of any of the serial ports in BIOS, I could see the VGA output getting impacted. Not sure how this could happen?
4. Whatever I see in serial console (BIOS, Beastie menu and loader prompt), I see them even without any setting I mentioned in comment #26.
5. For testing, I experimented with Linux and its Serial port setting. There also, I could see the grub loader menu in serial console, but boot logs are not seen in serial console. But login prompt appears in serial console, once the boot is complete. Wierd.

So, I am confused whether the problem is with FreeBSD (or) BIOS (or) the board configuration. Based on the observations mentioned, if you people have any comments, please share
 

Phishfry

Son of Beastie

Thanks: 874
Messages: 2,657

#29
How about we take another tact. What exact hardware are you using. Either motherboard or server name and model.

Disabling COM1 in the BIOS seems counter-intuitive.
You need the hardware serial on for the software serial console to have somewhere to land.
Software serial console is just a module added into the bios.
 

Rajesh

Member

Thanks: 3
Messages: 34

#30
Hi Phishfry, I am using a new development board which is AMD EPYC processor based, with 128GB of memory and 500GB HDD. Apart from this, as mentioned earlier, this boards has 2 DB-9 serial ports, 4 USB 3.0 ports, 2 SFP network ports on-board and a PCI attached VGA card with traditional VGA port. Please let me know if you need any specific details.

Disabling COM1 in the BIOS seems counter-intuitive.
You need the hardware serial on for the software serial console to have somewhere to land.
Software serial console is just a module added into the bios.
For testing, I disabled one serial port while I was trying to get the serial console on another. But, even with both ports enabled in BIOS, I see the same behavior as mentioned in comment #28
 

Phishfry

Son of Beastie

Thanks: 874
Messages: 2,657

#32
I have been working serial consoles heavy the last month. So everything I wrote seems accurate.
Only 2 things stand out. What is COM0 if you have no RJ45 serial console.
Some boards use COM0 for the Serial over LAN. Never messed with it.

#2 issue VGA card installed. Pull it and see if you get anything without it.
There are certain things that go on during boot from comconsole, vidconsole, like checking for video and keyboard.
Also FreeBSD might detect video card where there is only video on the CPU cores. With no video jacks.
So no video card is really a must for debugging this. Setup SSH to work on it until you figure it out.
You would think a 'develoment box' would have DB9 COM1 serial console.

What is the connection platform you are using to try and connect? FreeBSD and cu ?
 

Phishfry

Son of Beastie

Thanks: 874
Messages: 2,657

#33
The way you said you had slow video come up makes me wonder if it could be a ground problem.
Maybe a flakey connection forced it to a lower speed. Have you tried both null modem and straight through cables?
Most computer serial consoles use null modem cable, but you never know.
 

Rajesh

Member

Thanks: 3
Messages: 34

#34
Hi Phishfry,

Thanks for your inputs.

Please find the pic of my board's I/O. You can see the ports what I have mentioned earlier. Apart from this, there is a VGA card by the side, which is connected to the monitor. I have tried without having a VGA card also. But no luck.

20180614_200529.jpg


You would think a 'develoment box' would have DB9 COM1 serial console.
Any reason, why a development box can't have a DB9 COM1 serial port?

What is the connection platform you are using to try and connect? FreeBSD and cu ?
Are you asking about the connector I am using? If so, I have tried the following

1) A Straight through cable (one end connected to FreeBSD, other end to USB to serial convertor and the USB side is connected to my windows box). This way, I am not getting anything on the putty serial console from windows.

2) I made a 3-wire cross over directly (connected pin2 of usb serial converter to pin 3 of FreeBSD DB9, vice versa and connected ground pin5 of usb serial converter to pin5 of FreeBSD DB9). This way, I am getting the serial console output till loader prompt, but not anything after that.

Let me know if you are looking for something else.

The way you said you had slow video come up makes me wonder if it could be a ground problem.
Maybe a flakey connection forced it to a lower speed. Have you tried both null modem and straight through cables?
Most computer serial consoles use null modem cable, but you never know.
I couldn't get what you mean by ground problem here? As I said above, I have tried with both null modem and straight through cable. But both cases are not fruitful.

I understand, we have discussed and tried whatever is possible. But, just curious to get it working and see the boot logs in serial console.
 

Rajesh

Member

Thanks: 3
Messages: 34

#35
Here are few more updates.

Seems, the uart for the serial port in my board is synopsys designware. And the driver (uart_snps) for that is not enabled by default (GENERIC kernel). So, I had a custom kernel compiled with "device uart_snps" set. But I faced some compilation issues saying "ofw_bus_if.h". So, I managed to compile the kernel masking all "ofw" reference in uart_dev_snps.c

With that kernel, after booting, I see the following
Code:
#kldstat -v | grep uart

simplebus/uart_snps

puc/uart

pci/uart

pccard/uart

isa/uart

acpi/uart
With this kernel, I made the config settings for serial console as mentioned in comment #26. But still, no luck.

Question is, any known issues (or) anything missing with "uart_snps" to have that compilation issue? In general, any idea how to compile and use the uart_snps driver for serial console?

Note: Initially, we faced serial console issue with Linux as well, but after enabling CONFIG_SERIAL_8250_DW (to enable synopsys designware driver), things are working in Linux.
 

Phishfry

Son of Beastie

Thanks: 874
Messages: 2,657

#36
I would have never guessed that.
You are a trooper. I am looking around to see what I can find.
"ofw_bus_if.h".
So you realize OFW is Open Firmware which tells me this is predominantly used in Arm devices.
It now makes me wonder about some of the newfangled 'serial' consoles.
My gigabyte server board has a mini USB jack for OTG Port. These don't work like good old serial comms.
They need a driver. Thank goodness they included a RS232 on my board too.

SERIAL_8250 is interesting. I guess this different than your standard 16550.
 

Phishfry

Son of Beastie

Thanks: 874
Messages: 2,657

#37
OK I see this and something dawned on me.
https://www.freebsd.org/doc/en/articles/serial-uart/index.html

FreeBSD uses hint for UARTS and maybe 8250 uses different port addresses.
COM1 and COM2 are coded in /boot/device.hints

So if you think your COM driver is working good then look at the port address it provides.
Here is the relevant snippet of what FreeBSD expects:
Code:
hint.uart.0.at="isa"
hint.uart.0.port="0x3F8"
hint.uart.0.flags="0x10"
hint.uart.0.irq="4"
hint.uart.1.at="isa"
hint.uart.1.port="0x2F8"
hint.uart.1.irq="3"
I have been messing around with serial comms alot recently.
If you want UARTs on COM3 and COM4 to show up you must add them here manually.
But you can also adjust/change COM1 and COM2 here.
 

Phishfry

Son of Beastie

Thanks: 874
Messages: 2,657

#38
Looking at that driver I doubt if you can just strip out OFW.
ofw_bus_get_node(dev);
Generally my experience is that Arm drivers are not backward compatible.
For instance OneWire drivers will not work on X86 GPIO because of the same issue. OFW and Device Tree.
The driver was written for Arm boards..

This is just a theory on my part. The best thing to do in the case of an obscure driver is ask the author.
Jared is still active and his details are in the source header.
First question for him is "will it work on X86" and if so what mods are needed to make it compile..
Explain your situation clearly and maybe even send him a link to this thread.
 

Rajesh

Member

Thanks: 3
Messages: 34

#39
So you realize OFW is Open Firmware which tells me this is predominantly used in Arm devices.
Yes, I could realize the term as open-firmware. But I have no idea, what that is. Do you have any read references for it? And I am working on amd64 architecture only, not ARM based.

Regarding the device hints, I have already played around using them (as mentioned in comment #26). But no luck. But, I need to see whether the port address is changed in my case. I will check about that as well.

Also, better I send a note to Jared as you mentioned explaining the problem and seeking clarification. I will keep the thread posted. Thanks Phishfry for your answers here.
 
Top