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 BSS padding for spl/u-boot-spl.bin. This padding 6# can be added after the SPL binary to ensure that anything concatenated 7# to it will appear to SPL to be at the end of BSS rather than the start. 8# 9 10import command 11import elf 12from entry import Entry 13from blob import Entry_blob 14import tools 15 16class Entry_u_boot_spl_bss_pad(Entry_blob): 17 def __init__(self, section, etype, node): 18 Entry_blob.__init__(self, section, etype, node) 19 20 def ObtainContents(self): 21 fname = tools.GetInputFilename('spl/u-boot-spl') 22 bss_size = elf.GetSymbolAddress(fname, '__bss_size') 23 if not bss_size: 24 self.Raise('Expected __bss_size symbol in spl/u-boot-spl') 25 self.SetContents(chr(0) * bss_size) 26 return True 27