1# SPDX-License-Identifier: GPL-2.0+ 2# Copyright (c) 2016 Google, Inc 3# Written by Simon Glass <sjg@chromium.org> 4# 5# Entry-type module for tpl/u-boot-tpl.bin 6# 7 8from binman import elf 9from binman.entry import Entry 10from binman.etype.blob import Entry_blob 11 12class Entry_u_boot_tpl(Entry_blob): 13 """U-Boot TPL binary 14 15 Properties / Entry arguments: 16 - filename: Filename of u-boot-tpl.bin (default 'tpl/u-boot-tpl.bin') 17 18 This is the U-Boot TPL (Tertiary Program Loader) binary. This is a small 19 binary which loads before SPL, typically into on-chip SRAM. It is 20 responsible for locating, loading and jumping to SPL, the next-stage 21 loader. Note that SPL is not relocatable so must be loaded to the correct 22 address in SRAM, or written to run from the correct address if direct 23 flash execution is possible (e.g. on x86 devices). 24 25 SPL can access binman symbols at runtime. See: 26 27 'Access to binman entry offsets at run time (symbols)' 28 29 in the binman README for more information. 30 31 The ELF file 'tpl/u-boot-tpl' must also be available for this to work, since 32 binman uses that to look up symbols to write into the TPL binary. 33 34 Note that this entry is automatically replaced with u-boot-tpl-expanded 35 unless --no-expanded is used or the node has a 'no-expanded' property. 36 """ 37 def __init__(self, section, etype, node): 38 super().__init__(section, etype, node) 39 self.elf_fname = 'tpl/u-boot-tpl' 40 41 def GetDefaultFilename(self): 42 return 'tpl/u-boot-tpl.bin' 43 44 def WriteSymbols(self, section): 45 elf.LookupAndWriteSymbols(self.elf_fname, self, section.GetImage()) 46