u_boot_tpl.py 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. import elf
  8. from entry import Entry
  9. from blob import Entry_blob
  10. class Entry_u_boot_tpl(Entry_blob):
  11. """U-Boot TPL binary
  12. Properties / Entry arguments:
  13. - filename: Filename of u-boot-tpl.bin (default 'tpl/u-boot-tpl.bin')
  14. This is the U-Boot TPL (Tertiary Program Loader) binary. This is a small
  15. binary which loads before SPL, typically into on-chip SRAM. It is
  16. responsible for locating, loading and jumping to SPL, the next-stage
  17. loader. Note that SPL is not relocatable so must be loaded to the correct
  18. address in SRAM, or written to run from the correct address if direct
  19. flash execution is possible (e.g. on x86 devices).
  20. SPL can access binman symbols at runtime. See:
  21. 'Access to binman entry offsets at run time (symbols)'
  22. in the binman README for more information.
  23. The ELF file 'tpl/u-boot-tpl' must also be available for this to work, since
  24. binman uses that to look up symbols to write into the TPL binary.
  25. """
  26. def __init__(self, section, etype, node):
  27. Entry_blob.__init__(self, section, etype, node)
  28. self.elf_fname = 'tpl/u-boot-tpl'
  29. def GetDefaultFilename(self):
  30. return 'tpl/u-boot-tpl.bin'
  31. def WriteSymbols(self, section):
  32. elf.LookupAndWriteSymbols(self.elf_fname, self, section.GetImage())