scripts: Add script for patching config into RTK base firmware

Add a script "rtk_fw_config" that displays configuration values in human
readable form.

Optionally, the script can patch in an entirely new configuration and
generate a new firmware image, updated with a valid CRC.

Example output:
Current config for 'rts545x.bin':
Project name        : GOOG0100
Version             : 1.83.1
USB VID:PID         : 18D1:5065
Port config         : DUAL_PORT
CRC32               : 0x1e26594c

Modified config for `rtk_out.bin`
Project name        : GOOG0H00
Version             : 1.83.1
USB VID:PID         : 18D1:5075
Port config         : PORTA_ONLY
CRC32               : 0x661de336

BUG=none
TEST=python3 rtk_chgconf.py rts545x.bin \
    --config_file rts545xp_GOOG0H00.config.bin \
    --output_file rtk_out.bin
TEST=verify new firmware binary boots on Realtek PDC

Change-Id: Ib98053524a92b8293ad5c50bbdb6b8fbc279b7c5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/pdc/+/6825112
Commit-Queue: Tristan Honscheid <honscheid@google.com>
Auto-Submit: Keith Short <keithshort@chromium.org>
Tested-by: Keith Short <keithshort@chromium.org>
Reviewed-by: Tristan Honscheid <honscheid@google.com>
3 files changed