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 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, image, etype, node): 18 Entry_blob.__init__(self, image, etype, node) 19 20 def ObtainContents(self): 21 fname = tools.GetInputFilename('spl/u-boot-spl') 22 args = [['nm', fname], ['grep', '__bss_size']] 23 out = command.RunPipe(args, capture=True).stdout.splitlines() 24 bss_size = int(out[0].split()[0], 16) 25 self.data = chr(0) * bss_size 26 self.contents_size = bss_size 27