#!/usr/bin/env python3 # Copyright (c) 2014, The Linux Foundation. All rights reserved. # # SPDX-License-Identifier: BSD-3-Clause import struct import sys import os """A utility to generate ipq8064 uber SBL.. The very first blob (aka 'uber SBL') read out of NOR SPI flash by the IPQ8064 maskrom is supposed to be a concatenation of up to three binaries: one to run on the RPM, another one to run on the AP, and the third one - the actual coreboot bootblock. The uber SBL starts with the combined header descriptor of 80 bytes, with the first two 4 byte words set to certain values, and the total size of the payload saved at offsets 28 and 32. To generate the uber SBL this utility expects two or three input file names in the command line, the first file including the described header, and the following one(s) - in QCA MBN format. This allows to create the uber SBL in one or two invocations. The input files are concatenated together aligned at 256 byte boundary offset from the combined header. See Usage() below for more details. The resulting uber SBL file is prepended by the same combined header adjusted to reflect the new total file size. """ DEFAULT_OUTPUT_FILE_NAME = 'sbl-ro.mbn' class NorSbl: """Object representing the uber SBL.""" NOR_SBL1_HEADER = ' 3: Usage(-1) nsbl = NorSbl(argv[0], verbose) for mbnf in argv[1:]: nsbl.Append(mbnf) nsbl.Create(mbn_output) if __name__ == '__main__': main()