flash.sh: persist serial in cbfs

Librem devices store their serial number as a text file
in cbfs; persist this across flashes.

Signed-off-by: Matt DeVillier <matt.devillier@puri.sm>
This commit is contained in:
Matt DeVillier 2019-07-31 22:53:04 -05:00
parent e8e1032027
commit a27affcc7d
No known key found for this signature in database
GPG Key ID: 2BBB776A35B978FD

View File

@ -43,6 +43,12 @@ flash_rom() {
preserve_rom /tmp/${CONFIG_BOARD}.rom \
|| die "$ROM: Config preservation failed"
fi
# persist serial number from CBFS
if cbfs -r serial_number > /tmp/serial 2>/dev/null; then
echo "Persisting system serial"
cbfs -o /tmp/${CONFIG_BOARD}.rom -d serial_number 2>/dev/null || true
cbfs -o /tmp/${CONFIG_BOARD}.rom -a serial_number -f /tmp/serial
fi
flashrom $FLASHROM_OPTIONS -w /tmp/${CONFIG_BOARD}.rom \
|| die "$ROM: Flash failed"