Page MenuHomeFreeBSD

Add a routine to dump the boot metadata
ClosedPublic

Authored by mhorne on Oct 5 2020, 8:05 PM.
Tags
None
Referenced Files
F81646701: D26687.diff
Fri, Apr 19, 10:33 AM
Unknown Object (File)
Thu, Apr 18, 2:27 AM
Unknown Object (File)
Thu, Apr 18, 2:27 AM
Unknown Object (File)
Mar 19 2024, 4:15 AM
Unknown Object (File)
Mar 19 2024, 2:57 AM
Unknown Object (File)
Mar 5 2024, 10:49 PM
Unknown Object (File)
Dec 31 2023, 6:59 AM
Unknown Object (File)
Dec 20 2023, 7:41 AM

Details

Summary

The boot metadata (also referred to as modinfo, or preload metadata)
provides information about the size and location of the kernel,
pre-loaded modules, and other metadata (e.g. the EFI framebuffer) to be
consumed during by the kernel during early boot. It is encoded as a
series of type-length-value entries and is usually constructed by
loader(8) and passed to the kernel. It is also faked on some
architectures when booted by other means.

Although much of the module information is available via kldstat(8),
there is no easy way to debug the metadata in its entirety. Add some
routines to parse this data and allow it to be printed to the console
during early boot or output via a sysctl.

Since the output can be lengthly, printing to the console is gated
behind the debug.dump_modinfo_at_boot environment variable as well as
the BOOTVERBOSE flag. The sysctl to print the metadata is named
debug.dump_modinfo.

Test Plan

Sample output of an amd64 kernel with two preloaded modules: P433

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 34036
Build 31222: arc lint + arc unit

Event Timeline

mhorne requested review of this revision.Oct 5 2020, 8:05 PM
mhorne created this revision.
mhorne retitled this revision from Add routines to dump the boot metadata to Add a routine to dump the boot metadata.Oct 5 2020, 8:23 PM
sys/kern/subr_module.c
345

It would be better to output something like "unknown modinfo attribute"

420

it would be better to output something like "unknown modinfo metadata type"

Clarify message for unrecognized types. Update copyright header.

sys/kern/subr_module.c
420

The output will appear something like:

 0xffffffff8299a068:
	        type:   (0x9004) MODINFO_METADATA | unrecognized metadata type
This revision is now accepted and ready to land.Oct 6 2020, 2:16 PM

Fix compilation on 32-bit platforms. Add calls to preload_dump() to more architectures.

This revision now requires review to proceed.Oct 7 2020, 3:47 PM
This revision is now accepted and ready to land.Oct 8 2020, 4:38 AM
This revision was automatically updated to reflect the committed changes.