Open Laikulo opened 10 months ago
It appears that it is not too difficult to extract a dictionary from a bin, since the zlib header is pretty recognizable. Here's an example of doing so with binwalk:
[aaron@warforged]~/vcs/klipper/out% binwalk klipper.bin
DECIMAL HEXADECIMAL DESCRIPTION
--------------------------------------------------------------------------------
28856 0x70B8 Zlib compressed data, best compression
[aaron@warforged]~/vcs/klipper/out% binwalk klipper.bin -e
DECIMAL HEXADECIMAL DESCRIPTION
--------------------------------------------------------------------------------
28856 0x70B8 Zlib compressed data, best compression
[aaron@warforged]~/vcs/klipper/out% cd _klipper.bin.extracted
[aaron@warforged]~/vcs/klipper/out/_klipper.bin.extracted% zstdcat <70B8 | jq .config.MCU
"stm32g0b1xx"
I'm not entirely sure of the feasibility of this, as it relies on being able to reliably extract the MCU type from a klipper/deployer image to be deployed. Information about that should be readily available in the klipper .elf, but getting it out from .bin may be pain. This would probably best be an opportunistic check, that maybe prints an informative message if it can't determine the MCU type of a firmware blob.