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