binman: Move to absolute imports
[oweals/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 import elf
9 from binman.entry import Entry
10 from binman.etype.blob import Entry_blob
11
12 class Entry_u_boot_spl(Entry_blob):
13     """U-Boot SPL binary
14
15     Properties / Entry arguments:
16         - filename: Filename of u-boot-spl.bin (default 'spl/u-boot-spl.bin')
17
18     This is the U-Boot SPL (Secondary Program Loader) binary. This is a small
19     binary which loads before U-Boot proper, typically into on-chip SRAM. It is
20     responsible for locating, loading and jumping to U-Boot. Note that SPL is
21     not relocatable so must be loaded to the correct address in SRAM, or written
22     to run from the correct address if direct flash execution is possible (e.g.
23     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 'spl/u-boot-spl' must also be available for this to work, since
32     binman uses that to look up symbols to write into the SPL binary.
33     """
34     def __init__(self, section, etype, node):
35         Entry_blob.__init__(self, section, etype, node)
36         self.elf_fname = 'spl/u-boot-spl'
37
38     def GetDefaultFilename(self):
39         return 'spl/u-boot-spl.bin'
40
41     def WriteSymbols(self, section):
42         elf.LookupAndWriteSymbols(self.elf_fname, self, section.GetImage())