ResignSlimBootloader Tool
Introduction
The ResignSlimBootloader.py tool updates the Slim Bootloader signing
artifacts in an existing SlimBootloader.bin image without rebuilding the
full firmware from source, using only tools that already ship in the SBL
tree. It is intended for release, security, and manufacturing workflows that
need to rotate SBL-owned keys, regenerate KEYH, re-sign dependent artifacts,
and preserve the image layout already produced by the build flow.
Note
The default operating model is post-build re-signing. SBL is not expected to be rebuilt as part of this flow, and the existing image signing layout, key configuration, compression algorithm, source-image SVN values, and on-flash HashStore slot count remain unchanged.
To turn the re-signed SlimBootloader.bin into a shipping IFWI, re-run
your platform’s normal stitch flow
(typically Platform/<BoardPkg>/Script/StitchIfwi.py). Boot Guard signing is
outside the scope of this tool.
The tool updates the following image content:
KEYH: rebuilds the key-hash container from the replacement key set.Master key: updates the master-key hash in Stage1A’s
HashStoreTable.Container: re-generates hash and signature data according to the existing signing strategy while preserving each component’s compressed payload bytes.
CFGDATA: re-signs and re-stitchesCFGDATAin the image.
Prerequisites
An input
SlimBootloader.binwith a standard redundant SBL layout that already carries the signing layout and key configuration for this flow. The tool discovers the required flash layout, key usage, and signing inputs directly from the binary.A replacement SBL key directory compatible with the image’s existing signing layout and key configuration. Using
BootloaderCorePkg/Tools/GenerateKeys.pyto prepare that directory is recommended.
Usage
python BootloaderCorePkg/Tools/ResignSlimBootloader.py -i ./SlimBootloader.bin -o ./SlimBootloader_resigned.bin -k ./NewSblKeys --hash-log ./resign_hash.txt -v
Command-line options:
-i, --input-image Path to the input SlimBootloader.bin to be re-signed.
-o, --output-image Path to write the re-signed SlimBootloader.bin.
-k, --key-dir Directory containing the replacement SBL keys
(GenerateKeys.py naming convention).
-w, --work-dir Working directory for intermediates. If supplied, the
directory is kept after the run so you can inspect
intermediate artifacts. If omitted, a temporary
directory is created and auto-deleted.
--hash-log Path to write a BEFORE/AFTER SHA-256 hash log.
-v, --verbose Enable verbose logging.
Existing tools leveraged by this script
Tool |
How this script uses it |
|---|---|
|
Parses the input image layout and locates Stage1A, |
|
Provides |
|
Resolves SBL key IDs and generates the Master public-key hash used for the Stage1A update. |
|
Loads existing containers and re-generates container hash and signature data according to the existing signing strategy. |
|
Re-signs |
|
Recommended for preparing a replacement SBL key directory compatible with the image’s existing signing layout and key configuration. |