Page MenuHomeFreeBSD

Mute efi/loader
Needs ReviewPublic

Authored by oskar.holmlund_ohdata.se on Oct 17 2020, 2:34 PM.
Tags
Referenced Files
Unknown Object (File)
Mon, Apr 22, 9:20 AM
Unknown Object (File)
Thu, Apr 18, 1:20 AM
Unknown Object (File)
Wed, Apr 17, 11:23 AM
Unknown Object (File)
Thu, Apr 4, 11:51 PM
Unknown Object (File)
Dec 30 2023, 3:38 AM
Unknown Object (File)
Dec 20 2023, 6:22 AM
Unknown Object (File)
Dec 10 2023, 1:41 PM
Unknown Object (File)
Dec 9 2023, 3:04 AM

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
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).