Commit 5cfcf7e0fdb265672dd8ee7d3e881190ed06ff98
1 parent
00ae40b3ae
Exists in
smarc_8mq_lf_v2020.04
and in
20 other branches
binman: Add tests binaries with binman symbols
For testing we need to build some ELF files containing binman symbols. Add these to the Makefile and check in the binaries: u_boot_binman_syms - normal, valid ELF file u_boot_binman_syms_bad - missing the __image_copy_start symbol u_boot_binman_syms_size - has a binman symbol with an invalid size Signed-off-by: Simon Glass <sjg@chromium.org>
Showing 9 changed files with 103 additions and 1 deletions Inline Diff
- tools/binman/test/Makefile
- tools/binman/test/u_boot_binman_syms
- tools/binman/test/u_boot_binman_syms.c
- tools/binman/test/u_boot_binman_syms.lds
- tools/binman/test/u_boot_binman_syms_bad
- tools/binman/test/u_boot_binman_syms_bad.c
- tools/binman/test/u_boot_binman_syms_bad.lds
- tools/binman/test/u_boot_binman_syms_size
- tools/binman/test/u_boot_binman_syms_size.c
tools/binman/test/Makefile
| 1 | # | 1 | # |
| 2 | # Builds test programs | 2 | # Builds test programs |
| 3 | # | 3 | # |
| 4 | # Copyright (C) 2017 Google, Inc | 4 | # Copyright (C) 2017 Google, Inc |
| 5 | # Written by Simon Glass <sjg@chromium.org> | 5 | # Written by Simon Glass <sjg@chromium.org> |
| 6 | # | 6 | # |
| 7 | # SPDX-License-Identifier: GPL-2.0+ | 7 | # SPDX-License-Identifier: GPL-2.0+ |
| 8 | # | 8 | # |
| 9 | 9 | ||
| 10 | CFLAGS := -march=i386 -m32 -nostdlib -I ../../../include | 10 | CFLAGS := -march=i386 -m32 -nostdlib -I ../../../include |
| 11 | 11 | ||
| 12 | LDS_UCODE := -T u_boot_ucode_ptr.lds | 12 | LDS_UCODE := -T u_boot_ucode_ptr.lds |
| 13 | LDS_BINMAN := -T u_boot_binman_syms.lds | ||
| 14 | LDS_BINMAN_BAD := -T u_boot_binman_syms_bad.lds | ||
| 13 | 15 | ||
| 14 | TARGETS = u_boot_ucode_ptr u_boot_no_ucode_ptr bss_data | 16 | TARGETS = u_boot_ucode_ptr u_boot_no_ucode_ptr bss_data \ |
| 17 | u_boot_binman_syms u_boot_binman_syms.bin u_boot_binman_syms_bad \ | ||
| 18 | u_boot_binman_syms_size | ||
| 15 | 19 | ||
| 16 | all: $(TARGETS) | 20 | all: $(TARGETS) |
| 17 | 21 | ||
| 18 | u_boot_no_ucode_ptr: CFLAGS += $(LDS_UCODE) | 22 | u_boot_no_ucode_ptr: CFLAGS += $(LDS_UCODE) |
| 19 | u_boot_no_ucode_ptr: u_boot_no_ucode_ptr.c | 23 | u_boot_no_ucode_ptr: u_boot_no_ucode_ptr.c |
| 20 | 24 | ||
| 21 | u_boot_ucode_ptr: CFLAGS += $(LDS_UCODE) | 25 | u_boot_ucode_ptr: CFLAGS += $(LDS_UCODE) |
| 22 | u_boot_ucode_ptr: u_boot_ucode_ptr.c | 26 | u_boot_ucode_ptr: u_boot_ucode_ptr.c |
| 23 | 27 | ||
| 24 | bss_data: CFLAGS += bss_data.lds | 28 | bss_data: CFLAGS += bss_data.lds |
| 25 | bss_data: bss_data.c | 29 | bss_data: bss_data.c |
| 30 | |||
| 31 | u_boot_binman_syms.bin: u_boot_binman_syms | ||
| 32 | objcopy -O binary $< -R .note.gnu.build-id $@ | ||
| 33 | |||
| 34 | u_boot_binman_syms: CFLAGS += $(LDS_BINMAN) | ||
| 35 | u_boot_binman_syms: u_boot_binman_syms.c | ||
| 36 | |||
| 37 | u_boot_binman_syms_bad: CFLAGS += $(LDS_BINMAN_BAD) | ||
| 38 | u_boot_binman_syms_bad: u_boot_binman_syms_bad.c | ||
| 39 | |||
| 40 | u_boot_binman_syms_size: CFLAGS += $(LDS_BINMAN) | ||
| 41 | u_boot_binman_syms_size: u_boot_binman_syms_size.c | ||
| 26 | 42 | ||
| 27 | clean: | 43 | clean: |
| 28 | rm -f $(TARGETS) | 44 | rm -f $(TARGETS) |
| 29 | 45 | ||
| 30 | help: | 46 | help: |
| 31 | @echo "Makefile for binman test programs" | 47 | @echo "Makefile for binman test programs" |
| 32 | @echo | 48 | @echo |
| 33 | @echo "Intended for use on x86 hosts" | 49 | @echo "Intended for use on x86 hosts" |
| 34 | @echo | 50 | @echo |
| 35 | @echo "Targets:" | 51 | @echo "Targets:" |
| 36 | @echo | 52 | @echo |
| 37 | @echo -e "\thelp - Print help (this is it!)" | 53 | @echo -e "\thelp - Print help (this is it!)" |
| 38 | @echo -e "\tall - Builds test programs (default targget)" | 54 | @echo -e "\tall - Builds test programs (default targget)" |
| 39 | @echo -e "\tclean - Delete output files" | 55 | @echo -e "\tclean - Delete output files" |
| 40 | 56 |
tools/binman/test/u_boot_binman_syms
No preview for this file type
tools/binman/test/u_boot_binman_syms.c
| File was created | 1 | /* | |
| 2 | * Copyright (c) 2017 Google, Inc | ||
| 3 | * | ||
| 4 | * SPDX-License-Identifier: GPL-2.0+ | ||
| 5 | * | ||
| 6 | * Simple program to create some binman symbols. This is used by binman tests. | ||
| 7 | */ | ||
| 8 | |||
| 9 | #define CONFIG_BINMAN | ||
| 10 | #include <binman_sym.h> | ||
| 11 | |||
| 12 | binman_sym_declare(unsigned long, u_boot_spl, pos); | ||
| 13 | binman_sym_declare(unsigned long long, u_boot_spl2, pos); | ||
| 14 | binman_sym_declare(unsigned long, u_boot_any, pos); | ||
| 15 |
tools/binman/test/u_boot_binman_syms.lds
| File was created | 1 | /* | |
| 2 | * Copyright (c) 2016 Google, Inc | ||
| 3 | * | ||
| 4 | * SPDX-License-Identifier: GPL-2.0+ | ||
| 5 | */ | ||
| 6 | |||
| 7 | OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") | ||
| 8 | OUTPUT_ARCH(i386) | ||
| 9 | ENTRY(_start) | ||
| 10 | |||
| 11 | SECTIONS | ||
| 12 | { | ||
| 13 | . = 0x00000000; | ||
| 14 | _start = .; | ||
| 15 | |||
| 16 | . = ALIGN(4); | ||
| 17 | .text : | ||
| 18 | { | ||
| 19 | __image_copy_start = .; | ||
| 20 | *(.text*) | ||
| 21 | } | ||
| 22 | |||
| 23 | . = ALIGN(4); | ||
| 24 | .binman_sym_table : { | ||
| 25 | __binman_sym_start = .; | ||
| 26 | KEEP(*(SORT(.binman_sym*))); | ||
| 27 | __binman_sym_end = .; | ||
| 28 | } | ||
| 29 | |||
| 30 | } | ||
| 31 |
tools/binman/test/u_boot_binman_syms_bad
No preview for this file type
tools/binman/test/u_boot_binman_syms_bad.c
| File was created | 1 | u_boot_binman_syms.c |
tools/binman/test/u_boot_binman_syms_bad.lds
| File was created | 1 | /* | |
| 2 | * Copyright (c) 2016 Google, Inc | ||
| 3 | * | ||
| 4 | * SPDX-License-Identifier: GPL-2.0+ | ||
| 5 | */ | ||
| 6 | |||
| 7 | OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") | ||
| 8 | OUTPUT_ARCH(i386) | ||
| 9 | ENTRY(_start) | ||
| 10 | |||
| 11 | SECTIONS | ||
| 12 | { | ||
| 13 | . = 0x00000000; | ||
| 14 | _start = .; | ||
| 15 | |||
| 16 | . = ALIGN(4); | ||
| 17 | .text : | ||
| 18 | { | ||
| 19 | *(.text*) | ||
| 20 | } | ||
| 21 | |||
| 22 | . = ALIGN(4); | ||
| 23 | .binman_sym_table : { | ||
| 24 | __binman_sym_start = .; | ||
| 25 | KEEP(*(SORT(.binman_sym*))); | ||
| 26 | __binman_sym_end = .; | ||
| 27 | } | ||
| 28 | |||
| 29 | } | ||
| 30 |
tools/binman/test/u_boot_binman_syms_size
No preview for this file type
tools/binman/test/u_boot_binman_syms_size.c
| File was created | 1 | /* | |
| 2 | * Copyright (c) 2017 Google, Inc | ||
| 3 | * | ||
| 4 | * SPDX-License-Identifier: GPL-2.0+ | ||
| 5 | * | ||
| 6 | * Simple program to create some binman symbols. This is used by binman tests. | ||
| 7 | */ | ||
| 8 | |||
| 9 | #define CONFIG_BINMAN | ||
| 10 | #include <binman_sym.h> | ||
| 11 | |||
| 12 | binman_sym_declare(char, u_boot_spl, pos); | ||
| 13 |