1# Copyright (c) 2016 Google, Inc 2# Written by Simon Glass <sjg@chromium.org> 3# 4# SPDX-License-Identifier: GPL-2.0+ 5# 6# Entry-type module for BSS padding for spl/u-boot-spl.bin. This padding 7# can be added after the SPL binary to ensure that anything concatenated 8# to it will appear to SPL to be at the end of BSS rather than the start. 9# 10 11import command 12import elf 13from entry import Entry 14from blob import Entry_blob 15import tools 16 17class Entry_u_boot_spl_bss_pad(Entry_blob): 18 def __init__(self, image, etype, node): 19 Entry_blob.__init__(self, image, etype, node) 20 21 def ObtainContents(self): 22 fname = tools.GetInputFilename('spl/u-boot-spl') 23 bss_size = elf.GetSymbolAddress(fname, '__bss_size') 24 if not bss_size: 25 self.Raise('Expected __bss_size symbol in spl/u-boot-spl') 26 self.data = chr(0) * bss_size 27 self.contents_size = bss_size 28