Re: git: df065f699f1f - main - stand: More sensible defaults when ConOut is missing

From: Mark Millard <marklmi_at_yahoo.com>
Date: Sat, 24 Sep 2022 07:42:39 UTC
On 2022-Sep-24, at 00:16, Mark Millard <marklmi@yahoo.com> wrote:

> John Baldwin <jhb_at_FreeBSD.org> wrote on
> Date: Fri, 23 Sep 2022 21:29:03 UTC :
> 
>> On 8/26/22 9:18 PM, Warner Losh wrote:
>>> The branch main has been updated by imp:
>>> 
>>> URL: https://cgit.FreeBSD.org/src/commit/?id=df065f699f1ff819bb9607c44a6754275ab335ed
>>> 
>>> commit df065f699f1ff819bb9607c44a6754275ab335ed
>>> Author:     Warner Losh <imp@FreeBSD.org>
>>> AuthorDate: 2022-08-26 21:46:33 +0000
>>> Commit:     Warner Losh <imp@FreeBSD.org>
>>> CommitDate: 2022-08-27 04:17:56 +0000
>>> 
>>>     stand: More sensible defaults when ConOut is missing
>>> 
>>>     . . .
>> 
>> One possibly surprising result of this is that I did not get dual console
>> output on my rpi after this.  (Curiously this only affected my arm64 image
>> but not my armv7 image.)  Loader output goes to both, but kernel output is
>> only on the video console (which I don't normally use for my pi). 
> 
> 
> I just tried a RPi4B (USB3 SSD media) based on:
> 
> FreeBSD-14.0-CURRENT-arm64-aarch64-RPI-20220923-00d8a28f19b-258155.img.xz
> 
> and do not see the specific behavior, if I interpret
> correctly.
> 
> The system has (unchanged by me):
> 
> # more /boot/loader.conf
> # Configure USB OTG; see usb_template(4).
> hw.usb.template=3
> umodem_load="YES"
> # Multiple console (serial+efi gop) enabled.
> boot_multicons="YES"
> boot_serial="YES"
> # Disable the beastie menu and color
> beastie_disable="YES"
> loader_color="NO"
> 
> I do use a different RPi* config.txt :
> 
> # more /boot/msdos/config.txt
> [all]
> arm_64bit=1
> dtparam=audio=on,i2c_arm=on,spi=on
> dtoverlay=mmc
> dtoverlay=disable-bt
> device_tree_address=0x4000
> kernel=u-boot.bin
> #
> # Local additions:
> enable_uart=1
> uart_2ndstage=1
> dtdebug=1
> disable_commandline_tags=1
> disable_overscan=1
> #gpu_mem_1024=32
> #
> #program_usb_boot_mode=1
> #program_usb_boot_timeout=1
> 
> # Old RPi3's/RPi2Bv1.2's may ignore [pi4] and the like.
> # That would make the below inappropriate for such contexts.
> [pi4]
> # Locally avoid hdmi_safe's dislay scaling:
> #hdmi_safe=1
> armstub=armstub8-gic.bin
> #
> # Local additions:
> over_voltage=6
> arm_freq=2000
> sdram_freq_min=3200
> force_turbo=1
> #
> #total_mem=1024
> #total_mem=991
> [all]
> 
> [pi3] 
> armstub=armstub8.bin
> dtoverlay=pwm
> audio_pwm_mode=0
> [all]
> 
> 
> Example serial console capture material (incomplete)
> (also, not binary capture so without most escape sequences):
> (note the "console comconsole failed to initialize"?)
> 
> . . .
> U-Boot 2022.04 (Sep 23 2022 - 06:12:54 +0000)
> 
> DRAM:  7.9 GiB
> RPI 4 Model B (0xd03114)
> Core:  198 devices, 13 uclasses, devicetree: board
> MMC:   mmc@7e300000: 3, emmc2@7e340000: 0
> Loading Environment from FAT... In:    serial
> Out:   vidconsole
> Err:   vidconsole
> Net:   eth0: ethernet@7d580000
> PCIe BRCM: link up, 5.0 Gbps x1 (SSC)
> starting USB...
> Bus xhci_pci: Register 5000420 NbrPorts 5
> Starting the controller
> USB XHCI 1.00
> scanning bus xhci_pci for devices... 4 USB Device(s) found
>       scanning usb for storage devices... 1 Storage Device(s) found
> Hit any key to stop autoboot:  2  1  0
> Card did not respond to voltage select! : -110
> MMC Device 1 not found
> no mmc device at slot 1
> MMC Device 2 not found
> no mmc device at slot 2
> 
> Device 0: Vendor: OWC      Rev: 0    Prod: Envoy Pro mini  
>            Type: Hard Disk
>            Capacity: 228936.5 MB = 223.5 GB (468862128 x 512)
> ... is now current device
> Scanning usb 0:1...
> libfdt fdt_check_header(): FDT_ERR_BADMAGIC
> Scanning disk mmc@7e300000.blk...
> Disk mmc@7e300000.blk not ready
> Card did not respond to voltage select! : -110
> Scanning disk emmc2@7e340000.blk...
> Disk emmc2@7e340000.blk not ready
> Scanning disk usb_mass_storage.lun0...
> Found 3 disks
> No EFI system partition
> BootOrder not defined
> EFI boot manager: Cannot load any image
> Found EFI removable media binary efi/boot/bootaa64.efi
> 845900 bytes read in 4 ms (201.7 MiB/s)
> libfdt fdt_check_header(): FDT_ERR_BADMAGIC
> Booting /efi\boot\bootaa64.efi
> console comconsole failed to initialize
> Consoles: EFI console  
>    Reading loader env vars from /efi/freebsd/loader.env
> Setting currdev to disk0p1:
> FreeBSD/arm64 EFI loader, Revision 1.1
> (Fri Sep 23 09:39:26 UTC 2022 root@releng1.nyi.freebsd.org)
> 
>   Command line arguments: loader.efi
>   Image base: 0x39b59000
>   EFI version: 2.90
>   EFI Firmware: Das U-Boot (rev 8226.1024)
>   Console: efi,comconsole (0)
>   Load Path: /efi\boot\bootaa64.efi
>   Load Device: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/UsbClass(0x0,0x0,0x9,0x0,0x3)/UsbClass(0x1e91,0xa2a5,0x0,0x0,0x0)/HD(1,0x01,0,0x800,0x19000)
> Trying ESP: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/UsbClass(0x0,0x0,0x9,0x0,0x3)/UsbClass(0x1e91,0xa2a5,0x0,0x0,0x0)/HD(1,0x01,0,0x800,0x19000)
> Setting currdev to disk0p1:
> Trying: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/UsbClass(0x0,0x0,0x9,0x0,0x3)/UsbClass(0x1e91,0xa2a5,0x0,0x0,0x0)/HD(2,0x01,0,0x19800,0x9e6800)
> Setting currdev to disk0p2:
> Loading /boot/defaults/loader.conf
> Loading /boot/defaults/loader.conf
> Loading /boot/device.hints
> Loading /boot/loader.conf
> Loading /boot/loader.conf.local
> Loading kernel...
> /boot/kernel/kernel text=0x2a8 text=0x83b2d0 text=0x24f694 data=0x1af938 data=0x0+0x354000 0x8+0x134778+0x8+0x15c34f|
> Loading configured modules...
> /boot/kernel/umodem.ko text=0x2040 text=0x1330 data=0x6c8+0x4 0x8+0xed0+0x8+0xb32
> loading required module 'ucom'
> /boot/kernel/ucom.ko text=0x2590 text=0x2e90 data=0x8e0+0x858 0x8+0x1290+0x8+0xbd5
> 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 0x7ef0000.
> EFI framebuffer information:
> addr, size     0x3e2fe000, 0x7e9000
> dimensions     1920 x 1080
> stride         1920
> masks          0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000
> ---<<BOOT>>---
> GDB: debug ports: uart
> GDB: current port: uart
> KDB: debugger backends: ddb gdb
> KDB: current backend: ddb
> WARNING: Cannot find freebsd,dts-version property, cannot check DTB compliance
> Copyright (c) 1992-2022 The FreeBSD Project.
> Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
>        The Regents of the University of California. All rights reserved.
> FreeBSD is a registered trademark of The FreeBSD Foundation.
> FreeBSD 14.0-CURRENT #0 main-n258155-00d8a28f19b: Fri Sep 23 10:25:30 UTC 2022
>    root@releng1.nyi.freebsd.org:/usr/obj/usr/src/arm64.aarch64/sys/GENERIC arm64
> FreeBSD clang version 14.0.5 (https://github.com/llvm/llvm-project.git llvmorg-14.0.5-0-gc12386ae247c)
> WARNING: WITNESS option enabled, expect reduced performance.
> VT(efifb): resolution 1920x1080
> module firmware already present!
> real memory  = 8442077184 (8050 MB)
> avail memory = 8206307328 (7826 MB)
> Starting CPU 1 (1)
> Starting CPU 2 (2)
> Starting CPU 3 (3)
> FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs
> . . .
> Starting file system checks:
> /dev/ufs/rootfs: FILE SYSTEM CLEAN; SKIPPING CHECKS
> /dev/ufs/rootfs: clean, 601142 free (534 frags, 75076 blocks, 0.0% fragmentation)
> Growing root partition to fill device
> random: randomdev_wait_until_seeded unblock wait
> random: unblocking device.
> GEOM_PART: da0s2 was automatically resized.
>  Use `gpart commit da0s2` to save changes or `gpart undo da0s2` to revert them.
> da0s2 resized
> da0s2a resized
> super-block backups (for fsck_ffs -b #) at:
> . . .
> Mounting local filesystems:.
> Building /boot/kernel/linker.hints
> ELF ldconfig path: /lib /usr/lib /usr/lib/compat
> Setting hostname: generic.
> Setting up harvesting: [CALLOUT],[UMA],[FS_ATIME],SWI,INTERRUPT,NET_NG,[NET_ETHER],NET_TUN,MOUSE,KEYBOARD,ATTACH,CACHED
> Feeding entropy: .
> lo0: link state changed to UP
> genet0: link state changed to DOWN
> ue0: link state changed to DOWN
> Starting Network: lo0 genet0 ue0.
> lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
>        options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
>        inet6 ::1 prefixlen 128
>        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
>        inet 127.0.0.1 netmask 0xff000000
>        groups: lo
>        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
> genet0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
>        options=68000b<RXCSUM,TXCSUM,VLAN_MTU,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
>        ether e4:5f:01:0a:28:2b
>        media: Ethernet autoselect (none)
>        status: no carrier
>        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
> ue0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
>        options=68009b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
>        ether a0:ce:c8:d6:37:59
>        media: Ethernet autoselect (none)
>        status: no carrier
>        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
> Starting devd.
> ue0: link state changed to UP
> Starting dhclient.
> DHCPDISCOVER on ue0 to 255.255.255.255 port 67 interval 4
> DHCPOFFER from 192.168.1.1
> DHCPREQUEST on ue0 to 255.255.255.255 port 67
> DHCPACK from 192.168.1.1
> bound to 192.168.1.107 -- renewal in 300 seconds.
> add host 127.0.0.1: gateway lo0 fib 0: route already in table
> add host ::1: gateway lo0 fib 0: route already in table
> add net fe80::: gateway ::1
> add net ff02::: gateway ::1
> add net ::ffff:0.0.0.0: gateway ::1
> add net ::0.0.0.0: gateway ::1
> Updating /var/run/os-release done.
> Updating motd:.
> Creating and/or trimming log files.
> Clearing /tmp (X related).
> Starting syslogd.
> Mounting late filesystems:.
> Starting cron.
> Generating RSA host key.
> 3072 SHA256:+Hfq/KSLSyUVFJ2ztyAfLK9sbiN38NBdb4lq06GcfF8 root@generic (RSA)
> Generating ECDSA host key.
> 256 SHA256:ILVoIZKVGPOTvXcUizFwyre6KsOARmPsrLemN/FjP2s root@generic (ECDSA)
> Generating ED25519 host key.
> 256 SHA256:vg6IQf92DPSHBqOUx8G47dVBm4rv8bkc9uesuxje8I4 root@generic (ED25519)
> Performing sanity check on sshd configuration.
> Starting sshd.
> Configuring vt: blanktime.
> Starting background file system checks in 60 seconds.
> 
> Fri Sep 23 11:20:36 UTC 
> FreeBSD/arm64 (generic) (ttyu0)
> 
> login: 
> 
> 
> The video console had much of the material but,
> for example, had:
> 
> . . .
> random: unblocking device.
> GEOM_PART: da0s2 was automatically resized.
>  Use `gpart commit da0s2` to save changes or `gpart undo da0s2` to revert them.
> lo0: link state changed to UP
> genet0: link state changed to DOWN
> ue0: link state changed to DOWN
> Starting Network: lo0 genet0 ue0.
> . . .
> 
> and so the video console was missing the likes of:
> 
> da0s2 resized
> da0s2a resized
> super-block backups (for fsck_ffs -b #) at:
> . . .
> Mounting local filesystems:.
> Building /boot/kernel/linker.hints
> ELF ldconfig path: /lib /usr/lib /usr/lib/compat
> Setting hostname: generic.
> Setting up harvesting: [CALLOUT],[UMA],[FS_ATIME],SWI,INTERRUPT,NET_NG,[NET_ETHER],NET_TUN,MOUSE,KEYBOARD,ATTACH,CACHED
> Feeding entropy: .
> 
> 
> 
> There might be more required context to your report than has
> been reported.
> 

And there is for my context as well: I forgot to mention that,
as us usual for me, I substituted RPi* firmware:

40787ee5905644f639a2a0f6e00ae12e517a2211 Aug  3 2021 18:14:56

That is more recent than what sysutils/rpi-firmware/ is based
on. (May -> Aug of the same year.)

That is the last version that matches FreeBSD's incorrect
presumptions about dtb content requirements for the limited
contexts I have available to test, mostly older RPI4B's,
8 GiByte and 4 GiByte, and one RPi3B (rarely booted). All
later RPi* firmware versions that I've tested lead to a
crash because FreeBSD expects the dtb to have a strict
"define before reference" requirement for the order in
which it reads in the dtb material. But things can be
referenced before they are defined for that order --and
some are these days (last I checked, it has been a while).

I doubt that the RPi* firmware would be the controlling
difference here but could run a test without the
replacement if needed.

===
Mark Millard
marklmi at yahoo.com