diff options
Diffstat (limited to 'tools/binman/test')
-rw-r--r-- | tools/binman/test/261_section_fname.dts | 29 | ||||
-rw-r--r-- | tools/binman/test/262_absent.dts | 20 | ||||
-rw-r--r-- | tools/binman/test/263_tee_os_opt.dts | 22 | ||||
-rw-r--r-- | tools/binman/test/264_tee_os_opt_fit.dts | 33 | ||||
-rw-r--r-- | tools/binman/test/265_tee_os_opt_fit_bad.dts | 40 | ||||
-rw-r--r-- | tools/binman/test/266_blob_ext_opt.dts | 21 | ||||
-rw-r--r-- | tools/binman/test/267_section_inner.dts | 16 | ||||
-rw-r--r-- | tools/binman/test/268_null.dts | 19 | ||||
-rw-r--r-- | tools/binman/test/269_overlap.dts | 21 | ||||
-rw-r--r-- | tools/binman/test/270_overlap_null.dts | 24 | ||||
-rw-r--r-- | tools/binman/test/271_overlap_bad.dts | 21 | ||||
-rw-r--r-- | tools/binman/test/272_overlap_no_size.dts | 19 | ||||
-rw-r--r-- | tools/binman/test/273_blob_symbol.dts | 24 | ||||
-rw-r--r-- | tools/binman/test/274_offset_from_elf.dts | 30 | ||||
-rw-r--r-- | tools/binman/test/Makefile | 9 | ||||
-rw-r--r-- | tools/binman/test/blob_syms.c | 20 | ||||
-rw-r--r-- | tools/binman/test/blob_syms.lds | 30 |
17 files changed, 397 insertions, 1 deletions
diff --git a/tools/binman/test/261_section_fname.dts b/tools/binman/test/261_section_fname.dts new file mode 100644 index 0000000000..790381e730 --- /dev/null +++ b/tools/binman/test/261_section_fname.dts @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + pad-byte = <0x26>; + size = <0x20>; + section@0 { + size = <0x10>; + pad-byte = <0x21>; + pad-before = <2>; + pad-after = <3>; + + section { + filename = "outfile.bin"; + u-boot { + }; + }; + }; + section@1 { + u-boot { + }; + }; + }; +}; diff --git a/tools/binman/test/262_absent.dts b/tools/binman/test/262_absent.dts new file mode 100644 index 0000000000..2ab8766c87 --- /dev/null +++ b/tools/binman/test/262_absent.dts @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot { + }; + + _testing { + set-to-absent; + }; + + u-boot-img { + }; + }; +}; diff --git a/tools/binman/test/263_tee_os_opt.dts b/tools/binman/test/263_tee_os_opt.dts new file mode 100644 index 0000000000..2e4ec24ac2 --- /dev/null +++ b/tools/binman/test/263_tee_os_opt.dts @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot { + }; + tee-os { + /* + * this results in nothing being added since only the + * .bin format is supported by this etype, unless it is + * part of a FIT + */ + }; + u-boot-img { + }; + }; +}; diff --git a/tools/binman/test/264_tee_os_opt_fit.dts b/tools/binman/test/264_tee_os_opt_fit.dts new file mode 100644 index 0000000000..ae44b433ed --- /dev/null +++ b/tools/binman/test/264_tee_os_opt_fit.dts @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + fit { + description = "test-desc"; + #address-cells = <1>; + fit,fdt-list = "of-list"; + + images { + @tee-SEQ { + fit,operation = "split-elf"; + description = "TEE"; + type = "tee"; + arch = "arm64"; + os = "tee"; + compression = "none"; + fit,load; + fit,entry; + fit,data; + + tee-os { + }; + }; + }; + }; + }; +}; diff --git a/tools/binman/test/265_tee_os_opt_fit_bad.dts b/tools/binman/test/265_tee_os_opt_fit_bad.dts new file mode 100644 index 0000000000..7fa363cc19 --- /dev/null +++ b/tools/binman/test/265_tee_os_opt_fit_bad.dts @@ -0,0 +1,40 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + fit { + description = "test-desc"; + #address-cells = <1>; + fit,fdt-list = "of-list"; + + images { + @tee-SEQ { + fit,operation = "split-elf"; + description = "TEE"; + type = "tee"; + arch = "arm64"; + os = "tee"; + compression = "none"; + fit,load; + fit,entry; + fit,data; + + tee-os { + }; + + /* + * mess up the ELF data by adding + * another bit of data at the end + */ + u-boot { + }; + }; + }; + }; + }; +}; diff --git a/tools/binman/test/266_blob_ext_opt.dts b/tools/binman/test/266_blob_ext_opt.dts new file mode 100644 index 0000000000..717153152c --- /dev/null +++ b/tools/binman/test/266_blob_ext_opt.dts @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + ok { + type = "blob-ext"; + filename = "refcode.bin"; + }; + + missing { + type = "blob-ext"; + filename = "missing.bin"; + optional; + }; + }; +}; diff --git a/tools/binman/test/267_section_inner.dts b/tools/binman/test/267_section_inner.dts new file mode 100644 index 0000000000..f6faab3d2f --- /dev/null +++ b/tools/binman/test/267_section_inner.dts @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + section { + size = <0x10>; + u-boot { + }; + }; + }; +}; diff --git a/tools/binman/test/268_null.dts b/tools/binman/test/268_null.dts new file mode 100644 index 0000000000..3824ba8509 --- /dev/null +++ b/tools/binman/test/268_null.dts @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + pad-byte = <0xff>; + u-boot { + }; + null { + size = <4>; + }; + u-boot-img { + }; + }; +}; diff --git a/tools/binman/test/269_overlap.dts b/tools/binman/test/269_overlap.dts new file mode 100644 index 0000000000..f949b8b359 --- /dev/null +++ b/tools/binman/test/269_overlap.dts @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot { + }; + + inset { + type = "fill"; + fill-byte = [61]; + offset = <1>; + size = <2>; + overlap; + }; + }; +}; diff --git a/tools/binman/test/270_overlap_null.dts b/tools/binman/test/270_overlap_null.dts new file mode 100644 index 0000000000..feed9ec892 --- /dev/null +++ b/tools/binman/test/270_overlap_null.dts @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + section { + u-boot { + }; + + null { + offset = <1>; + size = <2>; + overlap; + }; + }; + + fmap { + }; + }; +}; diff --git a/tools/binman/test/271_overlap_bad.dts b/tools/binman/test/271_overlap_bad.dts new file mode 100644 index 0000000000..f281802114 --- /dev/null +++ b/tools/binman/test/271_overlap_bad.dts @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot { + }; + + inset { + type = "fill"; + fill-byte = [61]; + offset = <0x10>; + size = <2>; + overlap; + }; + }; +}; diff --git a/tools/binman/test/272_overlap_no_size.dts b/tools/binman/test/272_overlap_no_size.dts new file mode 100644 index 0000000000..4517536f2e --- /dev/null +++ b/tools/binman/test/272_overlap_no_size.dts @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + u-boot { + }; + + inset { + type = "fill"; + fill-byte = [61]; + overlap; + }; + }; +}; diff --git a/tools/binman/test/273_blob_symbol.dts b/tools/binman/test/273_blob_symbol.dts new file mode 100644 index 0000000000..87b0aba212 --- /dev/null +++ b/tools/binman/test/273_blob_symbol.dts @@ -0,0 +1,24 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + blob { + filename = "blob_syms.bin"; + write-symbols; + elf-filename = "blob_syms"; + elf-base-sym = "__my_start_sym"; + }; + + inset { + type = "null"; + offset = <4>; + size = <8>; + overlap; + }; + }; +}; diff --git a/tools/binman/test/274_offset_from_elf.dts b/tools/binman/test/274_offset_from_elf.dts new file mode 100644 index 0000000000..e3372fc7c3 --- /dev/null +++ b/tools/binman/test/274_offset_from_elf.dts @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: GPL-2.0+ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + blob: blob { + filename = "blob_syms.bin"; + elf-filename = "blob_syms"; + elf-base-sym = "__my_start_sym"; + }; + + inset { + type = "null"; + offset-from-elf = <&blob>, "val3", <0>; + size = <4>; + overlap; + }; + + inset2 { + type = "null"; + offset-from-elf = <&blob>, "val3", <4>; + size = <4>; + overlap; + }; + }; +}; diff --git a/tools/binman/test/Makefile b/tools/binman/test/Makefile index bea8567c9b..cd66a3038b 100644 --- a/tools/binman/test/Makefile +++ b/tools/binman/test/Makefile @@ -30,11 +30,12 @@ LDS_BINMAN_BAD := -T $(SRC)u_boot_binman_syms_bad.lds LDS_BINMAN_X86 := -T $(SRC)u_boot_binman_syms_x86.lds LDS_BINMAN_EMBED := -T $(SRC)u_boot_binman_embed.lds LDS_EFL_SECTIONS := -T $(SRC)elf_sections.lds +LDS_BLOB := -T $(SRC)blob_syms.lds TARGETS = u_boot_ucode_ptr u_boot_no_ucode_ptr bss_data \ u_boot_binman_syms u_boot_binman_syms.bin u_boot_binman_syms_bad \ u_boot_binman_syms_size u_boot_binman_syms_x86 embed_data \ - u_boot_binman_embed u_boot_binman_embed_sm elf_sections + u_boot_binman_embed u_boot_binman_embed_sm elf_sections blob_syms.bin all: $(TARGETS) @@ -71,6 +72,12 @@ u_boot_binman_embed: u_boot_binman_embed.c u_boot_binman_embed_sm: CFLAGS += $(LDS_BINMAN_EMBED) u_boot_binman_embed_sm: u_boot_binman_embed_sm.c +blob_syms.bin: blob_syms + $(OBJCOPY) -O binary $< -R .note.gnu.build-id $@ + +blob_syms: CFLAGS += $(LDS_BLOB) +blob_syms: blob_syms.c + elf_sections: CFLAGS += $(LDS_EFL_SECTIONS) elf_sections: elf_sections.c diff --git a/tools/binman/test/blob_syms.c b/tools/binman/test/blob_syms.c new file mode 100644 index 0000000000..d652c79aa9 --- /dev/null +++ b/tools/binman/test/blob_syms.c @@ -0,0 +1,20 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (c) 2017 Google, Inc + * + * Simple program to create some binman symbols. This is used by binman tests. + */ + +typedef unsigned long ulong; + +#include <linux/kconfig.h> +#include <binman_sym.h> + +DECLARE_BINMAN_MAGIC_SYM; + +unsigned long val1 = 123; +unsigned long val2 = 456; +binman_sym_declare(unsigned long, inset, offset); +unsigned long val3 = 789; +unsigned long val4 = 999; +binman_sym_declare(unsigned long, inset, size); diff --git a/tools/binman/test/blob_syms.lds b/tools/binman/test/blob_syms.lds new file mode 100644 index 0000000000..787e38dd85 --- /dev/null +++ b/tools/binman/test/blob_syms.lds @@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (c) 2016 Google, Inc + */ + +OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") +OUTPUT_ARCH(i386) +ENTRY(_start) + +SECTIONS +{ + . = 0x00000010; + _start = .; + + . = ALIGN(4); + .text : + { + __my_start_sym = .; + *(.text*) + } + + . = ALIGN(4); + .binman_sym_table : { + __binman_sym_start = .; + KEEP(*(SORT(.binman_sym*))); + __binman_sym_end = .; + } + .interp : { *(.interp*) } + +} |