#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0+ # Copyright 2021 Google LLC # Written by Simon Glass """Support for ARM's Firmware Image Package (FIP) format FIP is a format similar to FMAP[1] but with fewer features and an obscure UUID instead of the region name. It consists of a header and a table of entries, each pointing to a place in the firmware image where something can be found. [1] https://chromium.googlesource.com/chromiumos/third_party/flashmap/+/refs/heads/master/lib/fmap.h If ATF updates, run this program to update the FIT_TYPE_LIST. ARM Trusted Firmware is available at: https://github.com/ARM-software/arm-trusted-firmware.git """ from argparse import ArgumentParser import collections import io import os import re import struct import sys from uuid import UUID OUR_FILE = os.path.realpath(__file__) OUR_PATH = os.path.dirname(OUR_FILE) # Bring in the patman and dtoc libraries (but don't override the first path # in PYTHONPATH) sys.path.insert(2, os.path.join(OUR_PATH, '..')) # pylint: disable=C0413 from u_boot_pylib import command from u_boot_pylib import tools # The TOC header, at the start of the FIP HEADER_FORMAT = '