Page MenuHomeFreeBSD

Mute efi/loader
Needs ReviewPublic

Authored by oskar.holmlund_ohdata.se on Oct 17 2020, 2:34 PM.

Details

Summary

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

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

stand/efi/loader/conf.c
76–77

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.

oskar.holmlund_ohdata.se marked an inline comment as done.

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