Page MenuHomeFreeBSD

Add a routine to dump the boot metadata

Authored by mhorne on Oct 5 2020, 8:05 PM.
Referenced Files
Unknown Object (File)
Mon, Nov 6, 2:04 PM
Unknown Object (File)
Sun, Nov 5, 12:55 PM
Unknown Object (File)
Sun, Nov 5, 11:32 AM
Unknown Object (File)
Sun, Nov 5, 5:29 AM
Unknown Object (File)
Nov 3 2023, 5:04 AM
Unknown Object (File)
Nov 2 2023, 4:32 PM
Unknown Object (File)
Oct 31 2023, 9:31 PM
Unknown Object (File)
Oct 5 2023, 1:01 PM



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

Test Plan

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

Diff Detail

rS FreeBSD src repository - subversion
Lint Not Applicable
Tests Not Applicable

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
343 ↗(On Diff #77913)

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

418 ↗(On Diff #77913)

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

Clarify message for unrecognized types. Update copyright header.

418 ↗(On Diff #77913)

The output will appear something like:

	        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.