]> git.sur5r.net Git - u-boot/blob - tools/binman/etype/u_boot_spl_bss_pad.py
binman: Add support for building x86 ROMs with SPL
[u-boot] / tools / binman / etype / u_boot_spl_bss_pad.py
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
11 import command
12 from entry import Entry
13 from blob import Entry_blob
14 import tools
15
16 class 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