summaryrefslogtreecommitdiff
path: root/tools/binman/etype/u_boot_with_ucode_ptr.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2017-11-13 18:54:54 -0700
committerSimon Glass <sjg@chromium.org>2017-12-12 19:53:45 -0700
commitb50e5611a6b5dff4bc2ae47d332ba0d046e2a782 (patch)
treeec72ed0ab95983e04c4d4697d3af70aac64ff33b /tools/binman/etype/u_boot_with_ucode_ptr.py
parentcf71338ee7a1dc16f13a4f1b89f32c624210df45 (diff)
downloadu-boot-b50e5611a6b5dff4bc2ae47d332ba0d046e2a782.tar.gz
binman: Add a function to read ELF symbols
In some cases we need to read symbols from U-Boot. At present we have a a few cases which does this via 'nm' and 'grep'. It is better to use objdump since that tells us the size of the symbols and also whether it is weak or not. Add a new module which reads ELF information from files. Update existing uses of 'nm' to use this module. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/etype/u_boot_with_ucode_ptr.py')
-rw-r--r--tools/binman/etype/u_boot_with_ucode_ptr.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/tools/binman/etype/u_boot_with_ucode_ptr.py b/tools/binman/etype/u_boot_with_ucode_ptr.py
index 6f01adb970..99b437130d 100644
--- a/tools/binman/etype/u_boot_with_ucode_ptr.py
+++ b/tools/binman/etype/u_boot_with_ucode_ptr.py
@@ -9,6 +9,7 @@
import struct
import command
+import elf
from entry import Entry
from blob import Entry_blob
import fdt_util
@@ -31,11 +32,9 @@ class Entry_u_boot_with_ucode_ptr(Entry_blob):
def ObtainContents(self):
# Figure out where to put the microcode pointer
fname = tools.GetInputFilename(self.elf_fname)
- args = [['nm', fname], ['grep', '-w', '_dt_ucode_base_size']]
- out = (command.RunPipe(args, capture=True, raise_on_error=False).
- stdout.splitlines())
- if len(out) == 1:
- self.target_pos = int(out[0].split()[0], 16)
+ sym = elf.GetSymbolAddress(fname, '_dt_ucode_base_size')
+ if sym:
+ self.target_pos = sym
elif not fdt_util.GetBool(self._node, 'optional-ucode'):
self.Raise('Cannot locate _dt_ucode_base_size symbol in u-boot')