A Klipper .config lives in one file at the repo root, overwritten every time you run make menuconfig for a different board. Once firmware is flashed there’s no record of how it was produced. Anyone running multiple boards runs into this eventually: a board is running firmware that is hard to reproduce, there’s no way to confirm a restored .config matches what’s running. Any tool that wants to rebuild firmware for an existing board has to ask a human first.
Proposal
Have firmware report its own build configuration, in minimal savedefconfig form, through the identify dictionary it already serves over the wire. One new key, kconfig:
"kconfig": {
"defconfig": "CONFIG_MACH_STM32=y\nCONFIG_MACH_STM32F407=y\n"
}
The (compressed) dictionary and the identify command both already exist, so the protocol wouldn’t need to change. It’d take one make rule plus a small handler in buildcommands.py. savedefconfig.py is already part of the vendored kconfiglib, just not wired up.
Since savedefconfig only records what deviates from Kconfig defaults, the payload would track how customized a board’s config is, not the size of the whole tree. A near-default board would cost next to nothing to embed. A board with a lot of non-default options set would cost more, but it’d still be a handful of lines compared to a multi-KB .config dump, compressing alongside data that’s already going into the dictionary.
What this would touch: a make step that regenerates the minimal config on every build, wired so a config change couldn’t leave a stale payload behind, plus exposing it on the host the same way existing build info already works.
This is self-reported metadata, not an attempt at attestation, and does not guarantee that replaying it later reproduces a byte-identical binary, since defaults can shift between revisions.
Happy to open a PR if this sounds interesting.