Kernel using wrong serial speed on StarFive and I’m stuck

Hello everyone, once again I am questioning all my life choices that led me to this point…

I am trying to get freeBSD to boot on the star64. Good fun! Fancy new CPU arch!

Except somehow the kernel uses the wrong serial speed, I can’t figure out which one, I have no other way to access the device since the HDMI is also not working, and therefore I also seem to have no way to access whatever message it prints that I assume is a panic since it stops printing things completely after a few unreadable lines.

What I get at 115200 bps: OpenSBI, also the FreeBSD bootloader. If i interrupt boot and check the bootloader config it confirms that it knows about the 115200 bps. If I continue to boot the kernel however, I get garbled nonsense, as if I have the wrong speed set.

So, I tried consulting the handbook. I put the magic 4 lines in the loader.conf, i also put -h -S115200 in the boot.config, both of which resulted in no changes. Everything is fine right until it loads the kernel and then it isn’t. I also assume the handbook hasn’t been updated in several decades because it talks about “dumb terminals” being “a popular choice for workspaces” and in the section I linked to also recommends a kernel configuration option “CONSPEED” that does not actually seem to exist anymore.

I also tried connecting at a few more or less randomly picked common speeds, which obviously results in no longer being able to read the bootloader output, but also somehow in not getting anything after the bootloader at all (I can tell when it’s finished because of the 10 second timer), as in, not even any garbled mess from the kernel, just nothing.

So, what exactly are my options now, other than taking the device to a place with an oscilloscope and trying to find out what speed the kernel is sending at and hoping I can somehow work with that? I’m fairly certain it’s not actually booting, just crashing, so I also can’t put a script to at least make it dump its dmesg anywhere.

Would really appreciate some pointers from people who have debugged (or used, for that matter) a serial connection before because I sure haven’t. Gonna paste the output I get too so you can see what I’m talking about. It’s just fine right up until the moment where the kernel takes over. The unreadable stuff at the end happens within 2-3 seconds, and then it stops twitching entirely.


Code:
�
U-Boot SPL 2021.10 (Jan 19 2023 - 04:09:41 +0800)
DDR version: dc2e84f0.
Trying to boot from SPI

OpenSBI v1.2
   ____                    _____ ____ _____
  / __ \                  / ____|  _ \_   _|
 | |  | |_ __   ___ _ __ | (___ | |_) || |
 | |  | | '_ \ / _ \ '_ \ \___ \|  _ < | |
 | |__| | |_) |  __/ | | |____) | |_) || |_
  \____/| .__/ \___|_| |_|_____/|____/_____|
        | |
        |_|

Platform Name             : StarFive VisionFive V2
Platform Features         : medeleg
Platform HART Count       : 5
Platform IPI Device       : aclint-mswi
Platform Timer Device     : aclint-mtimer @ 4000000Hz
Platform Console Device   : uart8250
Platform HSM Device       : jh7110-hsm
Platform PMU Device       : ---
Platform Reboot Device    : pm-reset
Platform Shutdown Device  : pm-reset
Firmware Base             : 0x40000000
Firmware Size             : 288 KB
Runtime SBI Version       : 1.0

Domain0 Name              : root
Domain0 Boot HART         : 1
Domain0 HARTs             : 0*,1*,2*,3*,4*
Domain0 Region00          : 0x0000000002000000-0x000000000200ffff (I)
Domain0 Region01          : 0x0000000040000000-0x000000004007ffff ()
Domain0 Region02          : 0x0000000000000000-0xffffffffffffffff (R,W,X)
Domain0 Next Address      : 0x0000000040200000
Domain0 Next Arg1         : 0x0000000042200000
Domain0 Next Mode         : S-mode
Domain0 SysReset          : yes

Boot HART ID              : 1
Boot HART Domain          : root
Boot HART Priv Version    : v1.11
Boot HART Base ISA        : rv64imafdcbx
Boot HART ISA Extensions  : none
Boot HART PMP Count       : 8
Boot HART PMP Granularity : 4096
Boot HART PMP Address Bits: 34
Boot HART MHPM Count      : 2
Boot HART MIDELEG         : 0x0000000000000222
Boot HART MEDELEG         : 0x000000000000b109


U-Boot 2021.10 (Jan 19 2023 - 04:09:41 +0800), Build: jenkins-github_visionfive2-6

CPU:   rv64imacu
Model: StarFive VisionFive V2
DRAM:  8 GiB
MMC:   sdio0@16010000: 0, sdio1@16020000: 1
Loading Environment from SPIFlash... SF: Detected gd25lq128 with page size 256 Bytes, erase size 4 KiB, total 16 MiB
*** Warning - bad CRC, using default environment

StarFive EEPROM format v2

--------EEPROM INFO--------
Loading kernel...
/boot/kernel/kernel text=0x5d8de4 text=0x190c54 data=0xf97b0 data=0x2d1c+0x2621cc 0x8+0x20ebea0+0x8+0x1011c9-
Loading configured modules...
/boot/kernel/umodem.ko text=0x2080 text=0x1250 data=0x6f0+0x4 0x8+0x70f8+0x8+0xf20
loading required module 'ucom'
/boot/kernel/ucom.ko text=0x2618 text=0x2c28 data=0x960+0x858 0x8+0xfc60+0x8+0x1878
can't find '/etc/hostid'
can't find '/boot/entropy'

Hit [Enter] to boot immediately, or any other key for command prompt.
Booting [/boot/kernel/kernel]...               
Using DTB provided by EFI at 0x47ef2000.
Kernel entry at 0xf680002e...
Kernel args: (null)
clk u5_dw_i2c_clk_core already disabled
clk u5_dw_i2c_clk_apb already disabled
pmap_bootstrap ffffffc00076c000 f6800000 2d53000
physmap_idx 1
min_pa 40000000
max_pa 140000000
���F��nFnnnnV�^F�F���V�F�~NN�RF�������F�F�������ƾ���ƾ����������W��������W�F�~���Ʀ�����������~�����W���������~�F��F~��FW�����W����~�F���W�W�~F�~�W��~W�~�~��~V~�~F��F���FF~�W����W���W����������~����W���������Ʀ����������Ƽ�����W�������������F�W~�~F��~���~FF����~���������F�����������������������������������������~����W���~������������ƶ��������������Ķ��ƾ���������Ɣ�����������ƾƶƴƶ�����������������������Ɣ������F�^�^ƾ������ƴ��ƴƶ�涾�������ƶ���������Ɩƴ��ƾ��ƾ��������������Ɩ������������Ɔ�����Ɣ�V��ƾ����ƾ�������Ɩ��Ɣ����FƆ�V�~�����Ƅ�����Vj���~��������F~��W�ƴV5F~��ƾ�ƶ��J���^j�������(��V�j��Kƶ�nƆ����������nƺƻ�^������������j�J��Ư��V��ƨ���T�R���~VVF~�F��~����~N��F�~^/f���oWGGWGWGGGGWGGW
 
Are you able to break into U-Boot shell? Then it should be possible to examine device tree. Maybe there is some clue to be found...
Also, where does you U-Boot binary come from? Did you build it yourself? I see no U-Boot for StarFive in 2023.07.02 version tree, used in FreeBSD ports tree recently.
Did you consider asking FreeBSD's riscv mailing list audience? Maybe someone there knows a bit more.
 
Back
Top