1# SPDX-License-Identifier: GPL-2.0+ 2# Copyright (c) 2018 Google, Inc 3# Written by Simon Glass <sjg@chromium.org> 4# 5# Entry-type module for U-Boot ELF image 6# 7 8from entry import Entry 9from blob import Entry_blob 10 11import fdt_util 12import tools 13 14class Entry_u_boot_elf(Entry_blob): 15 """U-Boot ELF image 16 17 Properties / Entry arguments: 18 - filename: Filename of u-boot (default 'u-boot') 19 20 This is the U-Boot ELF image. It does not include a device tree but can be 21 relocated to any address for execution. 22 """ 23 def __init__(self, section, etype, node): 24 Entry_blob.__init__(self, section, etype, node) 25 self._strip = fdt_util.GetBool(self._node, 'strip') 26 27 def ReadBlobContents(self): 28 if self._strip: 29 uniq = self.GetUniqueName() 30 out_fname = tools.GetOutputFilename('%s.stripped' % uniq) 31 tools.WriteFile(out_fname, tools.ReadFile(self._pathname)) 32 tools.Run('strip', out_fname) 33 self.SetContents(tools.ReadFile(out_fname)) 34 else: 35 self.SetContents(tools.ReadFile(self._pathname)) 36 return True 37 38 def GetDefaultFilename(self): 39 return 'u-boot' 40