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
Unknown Object (File)
Oct 20 2024, 10:53 AM
Unknown Object (File)
Oct 16 2024, 12:25 PM
Unknown Object (File)
Oct 1 2024, 7:16 PM
Unknown Object (File)
Sep 11 2024, 5:13 AM
Unknown Object (File)
Sep 5 2024, 7:59 PM
Unknown Object (File)
Sep 4 2024, 3:26 AM
Unknown Object (File)
Aug 18 2024, 6:22 PM
Unknown Object (File)
Aug 12 2024, 2:24 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.