Prepare v2023.10
[platform/kernel/u-boot.git] / tools / binman / etype / u_boot_tpl.py
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
8 from binman.entry import Entry
9 from binman.etype.blob import Entry_blob
10
11 class Entry_u_boot_tpl(Entry_blob):
12     """U-Boot TPL binary
13
14     Properties / Entry arguments:
15         - filename: Filename of u-boot-tpl.bin (default 'tpl/u-boot-tpl.bin')
16
17     This is the U-Boot TPL (Tertiary Program Loader) binary. This is a small
18     binary which loads before SPL, typically into on-chip SRAM. It is
19     responsible for locating, loading and jumping to SPL, the next-stage
20     loader. Note that SPL is not relocatable so must be loaded to the correct
21     address in SRAM, or written to run from the correct address if direct
22     flash execution is possible (e.g. on x86 devices).
23
24     SPL can access binman symbols at runtime. See :ref:`binman_fdt`.
25
26     in the binman README for more information.
27
28     The ELF file 'tpl/u-boot-tpl' must also be available for this to work, since
29     binman uses that to look up symbols to write into the TPL binary.
30
31     Note that this entry is automatically replaced with u-boot-tpl-expanded
32     unless --no-expanded is used or the node has a 'no-expanded' property.
33     """
34     def __init__(self, section, etype, node):
35         super().__init__(section, etype, node, auto_write_symbols=True)
36         self.elf_fname = 'tpl/u-boot-tpl'
37
38     def GetDefaultFilename(self):
39         return 'tpl/u-boot-tpl.bin'