cros_write_firmware: Extract FDT from image automatically

It is a pain to have to specify the board and FDT when writing an image.
Extract the FDT from the image instead, while still allowing an override
if required.

Using any image build from ToT, this command should flash it over USB:

$ cros_write_firmware /path/to/image.bin -F spi

For x86, this command should write it to em100:

$ cros_write_firmware /path/to/image.bin

Tested on pit and link.

Change-Id: I6fedec0ee6a6f877f72abe963b4b92bff82345eb
Signed-off-by: Simon Glass <>
Reviewed-by: Julius Werner <>
Reviewed-by: Randall Spangler <>
3 files changed