Re: Raspberry Pi 4B is now booting single user mode on FreeBSD 14.0 aarch64. Does it work for you?

From: Fred Finster <fred_at_thegalacticzoo.com>
Date: Mon, 23 Jan 2023 14:53:52 UTC
On 1/21/23 17:12, Mark Millard wrote:
> On Jan 20, 2023, at 06:22, Fred Finster<fred@thegalacticzoo.com>  wrote:
>
>> was just trying to boot into single user mode from this documentation below:
>> https://people.freebsd.org/~rodrigc/doc/handbook/makeworld.html
>> Once in single-user mode, run these commands if the system is formatted with UFS:
>>
>> |#|  *|mount -u /|*
>> |#|  *|mount -a -t ufs|*
>> |#|  *|swapon -a|*
>>
>> example I created this blog post:https://ghostbsd-arm64.blogspot.com/2023/01/time-make-j4-buildworld.html
>> I could boot into multi-user mode but not into Single User Mode on this Raspberry Pi 4B.
>> What do you suggest and how to trouble shoot?  I turned on verbose mode and saw that it hung after starting /sbin/init
>> but do not know why  this aarch64 ARM64 BCM2711 cpu hangs on FreeBSD 14.0 going into "single user mode".
>>
>> This Version:
>>
>> root@Fred_RasPi4B:~ # uname -Kmnopr
>> FreeBSD Fred_RasPi4B 14.0-CURRENT arm64 aarch64 1400077
>> root@Fred_RasPi4B:~ # uname -a
>> FreeBSD Fred_RasPi4B 14.0-CURRENT FreeBSD 14.0-CURRENT #6 main-n259952-7e2600ea7be2-dirty: Sun Jan 15 18:14:05 PST 2023root@Fred_RasPi4B:/usr/obj/usr/src/arm64.aarch64/sys/GENERIC-VCHIQ  arm64
> . . .
>
> I've never tried GENERIC-VCHIQ.
>
> Have you tried testing a standard build on some
> media, such as trying a dd of an uncompressed:
>
> http://ftp3.freebsd.org/pub/FreeBSD/snapshots/ISO-IMAGES/14.0/FreeBSD-14.0-CURRENT-arm64-aarch64-RPI-20230120-43703bc489ec-260163.img.xz
>
> and seeing if the problem replicates for that in
> your context? If it replicates, then at least you
> know it is not something more specific to your
> context and other folks would be able to test
> similarly with a sufficiently analogous context.
>
> But, if it does not replicate when you try such a
> test, then folks likely would have to try to
> reproduce your context to have a sufficiently
> analogous context to test.
>
> ===
> Mark Millard
> marklmi at yahoo.com
>
Mark thank you for answering my email question directly!  I realize you, Mark, are busy, with some many details.  Your suggestion of using a Snapshot image is good for debugging.
http://ftp3.freebsd.org/pub/FreeBSD/snapshots/ISO-IMAGES/14.0/FreeBSD-14.0-CURRENT-arm64-aarch64-RPI-20230120-43703bc489ec-260163.img.xz
Is there a shell script file to build this image, just like FreeBSD.org does?   I would like to natively build an image with the VCHIQ patch included from my /usr/src hosted
on the Raspberry Pi 4B /8G dram with a 500GB SSD drive with 92GB FreeBSD partition.


Uart0 Serial Console pin 14 TXD, Pin 15 RXD works in Single User Mode on the Raspberry Pi 4B with 8G dram executing FreeBSD 14.0 GENERIC-VCHIQ.
The serial console and video console both issue messages, upto this point,
The Video Console stops just after a verbose debug message '/sbin/init' , yet the serial console continues working and receives commands and issues results.

root@:/usr/src # uname -a
FreeBSD  14.0-CURRENT FreeBSD 14.0-CURRENT #6 main-n259952-7e2600ea7be2-dirty: Sun Jan 15 18:14:05 PST 2023root@Fred_RasPi4B:/usr/obj/usr/src/arm64.aarch64/sys/GENERIC-VCHIQ  arm64
root@:/usr/src # uname -Kmnopr
FreeBSD  14.0-CURRENT arm64 aarch64 1400077


I have the Black Magic Probehttp://black-magic.org  set up and using the 3.3V TTL serial port  device at /dev/ttyU1.
You have to load kernel modules  kldload ucom, umodem, usb_template, and set hw.usb.template to 3.  sysctl hw.usb.template=3 .
*#kldload ucom umodem usb_template*
#*sudo sysctl hw.usb.template=3*
hw.usb.template: -1 -> 3
*sudo vi /boot/loader.conf*
#add 4 lines for next boot to include modules
umodem_load="YES"
usb_template_load="YES"
ucom_load="YES"
hw.usb.template=3
Use cu Connect Unix command to open the USB serial port to the Raspberry 
Pi 4B Uart0
# *cu -s 115200 -l /dev/ttyU1*
Connected

OPEN URL for more details:https://ghostbsd-arm64.blogspot.com/2023/01/hookup-gdb-to-black-magic-probe-v23.html


URLS to My Efforts with FreeBSD 14.0 Current on the Raspberry Pi 4B and documentation:
https://ghostbsd-arm64.blogspot.com/
https://ghostbsd-arm64.blogspot.com/2023/01/hookup-gdb-to-black-magic-probe-v23.html    Hooking up USB Serial port to Black Magic Probe
https://ghostbsd-arm64.blogspot.com/2023/01/time-make-j4-buildworld.html                FreeBSD 14.0 make -j4 buildworld
https://ghostbsd-arm64.blogspot.com/2022/09/freebsd-140-compiling-kernel-for.html       FreeBSD 14.0 snapshot install, use bsdinstall to a SSD drive, compiling make -j4 buildkernel -KERNCONF=GENERIC-VCHIQ
https://ghostbsd-arm64.blogspot.com/2021/05/audit-your-boot-files-with-md5deep.html     Audit your boot files with md5deep tool to verify basic system boot files
https://ghostbsd-arm64.blogspot.com/2021/02/download-freebsd-140-current-version.html  FreeBSD 14.0 snapshot install method

Conclusion:

 1. Uart0 Serial Console is working and I can see boot messages via USB
    serial port on Black Magic Probe
 2. I can enter boot into and use single user mode of FreeBSD
 3. Shared my work with others via my Google Blogpost website

    https://ghostbsd-arm64.blogspot.com/

 4.

    Working to get a JTAG debugger working with Black Magic Probe hardware debugger to use GDB software. Not Finished

 5. What do others suggest for a JTAG hardware debugging environment on
    the ARM64 aarch64?  Anything specific for Raspberry Pi 4B? Maybe is
    the RasPi4B hardware system is complete enough to just debug via GDB.
 6.

I realize in my efforts to be complete, I write a book instead of a 
short note.  Sorry, always feel I am forgetting some data or a piece of 
good information

Mark, thanks again for your suggestion to use a current SNAPShot image.  
I appreciate a direct short answer.

To the other person testing uart serial ports look at Raspberry Pi 
documentation.  Set some GPIO pins to Alt-X in the config.txt file in 
the boot directory.

  Look at the pictures and URL Links I share on "Hookup GDB to black 
magic probe."

uart_enable=1  3.3V  3milliamp drive.

https://pinout.xyz/pinout/uart

https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#disable-other-gpio-peripherals 


https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#gpio-and-the-40-pin-header

-- 
Fred  Finster
fred@thegalacticzoo.com
+1 971-718-9144
https://GhostBSD-ARM64.blogspot.com
https://ghostbsd.org