Page MenuHomeFreeBSD

Mute efi/loader
Needs ReviewPublic

Authored by on Oct 17 2020, 2:34 PM.
Referenced Files
Unknown Object (File)
Mar 4 2023, 9:06 PM
Unknown Object (File)
Feb 14 2023, 1:31 AM
Unknown Object (File)
Jan 13 2023, 2:52 AM
Unknown Object (File)
Dec 29 2022, 4:55 AM
Unknown Object (File)
Nov 29 2022, 12:20 AM



Background: ARM based system with u-boot.
I need to use all UARTs on the SOC connected to different types of external controller cards (cant just change the system console to another UART).

To mute the system console I have found that following in /boot/loader.conf
boot_mute="YES" # mute the kernel
hw.fdt.console="null" # mute the rest of the system, actually it fails to find null in the devicetree (sys/dev/uart/uart_bus_fdt.c).
But efi/loader are not muted.

In the efi/loader the /boot/loader.conf content are not available at the top of main(), but u-boot environment variable bootargs will be available in argv. Parse the arguments a little bit earlier and if it contains -m (RB_MUTE) use nullconsole.

On my system efi_main.c:efi_main() will not add the program name (loader.efi) in the first argv vector position, instead it is -m. Later on in main.c:parse_args() the for loop expects the first position to be the program name and starts at the first position and will miss the argument (-m).
As a sideeffect a kernel environment variable "loader.efi=1" will be created on those system that need the program name in the argv vector.
Other solutions can be:

  • I can send additional information from efi_main.c -> main.c if the first position are the program name or not.
  • I can define bootargs as -m -m :)

Other suggestions?

Diff Detail

rS FreeBSD src repository - subversion
Lint Skipped
Tests Skipped

Event Timeline


IMO, as nullconsole and spinconsole are just software devices, there is no reason to exclude them for some platforms. Otherwise you would need to start #ifdef game in loader/main.c as well. marked an inline comment as done.

Remove #ifdefs in conf.c
Add nullconsole.c / spinconsole.c to (arm, arm64 and riscv).