From 53e22bf38c202d5ef3bc092d55095c672994a15b Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 24 Aug 2019 07:22:53 -0600 Subject: binman: Use the Makefile to build ELF test files At present the ELF test files are checked into the U-Boot tree. This is covenient since the files never change and can be used on non-x86 platforms. However it is not good practice to check in binaries and in this case it does not seem essential. Update the binman test-file Makefile to support having source in a different directory. Adjust binman to run it to build bss_data, as a start. We can add other files as needed. Signed-off-by: Simon Glass --- tools/binman/elf_test.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'tools/binman/elf_test.py') diff --git a/tools/binman/elf_test.py b/tools/binman/elf_test.py index cc6e9c5128..736b931fd5 100644 --- a/tools/binman/elf_test.py +++ b/tools/binman/elf_test.py @@ -50,6 +50,29 @@ class FakeSection: return self.sym_value +def BuildElfTestFiles(target_dir): + """Build ELF files used for testing in binman + + This compiles and links the test files into the specified directory. It the + Makefile and source files in the binman test/ directory. + + Args: + target_dir: Directory to put the files into + """ + if not os.path.exists(target_dir): + os.mkdir(target_dir) + testdir = os.path.join(binman_dir, 'test') + + # If binman is involved from the main U-Boot Makefile the -r and -R + # flags are set in MAKEFLAGS. This prevents this Makefile from working + # correctly. So drop any make flags here. + if 'MAKEFLAGS' in os.environ: + del os.environ['MAKEFLAGS'] + tools.Run('make', '-C', target_dir, '-f', + os.path.join(testdir, 'Makefile'), 'SRC=%s/' % testdir, + 'bss_data', 'u_boot_ucode_ptr') + + class TestElf(unittest.TestCase): @classmethod def setUpClass(self): -- cgit v1.2.3