# SPDX-License-Identifier: GPL-2.0+ # Copyright (c) 2018 Google, Inc # Written by Simon Glass # # Support for flashrom's FMAP format. This supports a header followed by a # number of 'areas', describing regions of a firmware storage device, # generally SPI flash. import collections import struct import sys from u_boot_pylib import tools # constants imported from lib/fmap.h FMAP_SIGNATURE = b'__FMAP__' FMAP_VER_MAJOR = 1 FMAP_VER_MINOR = 0 FMAP_STRLEN = 32 FMAP_AREA_STATIC = 1 << 0 FMAP_AREA_COMPRESSED = 1 << 1 FMAP_AREA_RO = 1 << 2 FMAP_HEADER_LEN = 56 FMAP_AREA_LEN = 42 FMAP_HEADER_FORMAT = '<8sBBQI%dsH'% (FMAP_STRLEN) FMAP_AREA_FORMAT = '