u-boot-brain/tools/binman/test
Simon Glass 1979063264 binman: Support accessing binman tables at run time
Binman construct images consisting of multiple binary files. These files
sometimes need to know (at run timme) where their peers are located. For
example, SPL may want to know where U-Boot is located in the image, so
that it can jump to U-Boot correctly on boot.

In general the positions where the binaries end up after binman has
finished packing them cannot be known at compile time. One reason for
this is that binman does not know the size of the binaries until
everything is compiled, linked and converted to binaries with objcopy.

To make this work, we add a feature to binman which checks each binary
for symbol names starting with '_binman'. These are then decoded to figure
out which entry and property they refer to. Then binman writes the value
of this symbol into the appropriate binary. With this, the symbol will
have the correct value at run time.

Macros are used to make this easier to use. As an example, this declares
a symbol that will access the 'u-boot-spl' entry to find the 'pos' value
(i.e. the position of SPL in the image):

   binman_sym_declare(unsigned long, u_boot_spl, pos);

This converts to a symbol called '_binman_u_boot_spl_prop_pos' in any
binary that includes it. Binman then updates the value in that binary,
ensuring that it can be accessed at runtime with:

   ulong u_boot_pos = binman_sym(ulong, u_boot_spl, pos);

This assigns the variable u_boot_pos to the position of SPL in the image.

Signed-off-by: Simon Glass <sjg@chromium.org>
2017-12-12 19:53:45 -07:00
..
01_invalid.dts binman: Add basic entry types for U-Boot 2016-12-20 08:09:55 +13:00
02_missing_node.dts binman: Add basic entry types for U-Boot 2016-12-20 08:09:55 +13:00
03_empty.dts binman: Add basic entry types for U-Boot 2016-12-20 08:09:55 +13:00
04_invalid_entry.dts binman: Add basic entry types for U-Boot 2016-12-20 08:09:55 +13:00
05_simple.dts binman: Add basic entry types for U-Boot 2016-12-20 08:09:55 +13:00
06_dual_image.dts binman: Add basic entry types for U-Boot 2016-12-20 08:09:55 +13:00
07_bad_align.dts binman: Add basic entry types for U-Boot 2016-12-20 08:09:55 +13:00
08_pack.dts binman: Add basic entry types for U-Boot 2016-12-20 08:09:55 +13:00
09_pack_extra.dts binman: Add basic entry types for U-Boot 2016-12-20 08:09:55 +13:00
10_pack_align_power2.dts binman: Add basic entry types for U-Boot 2016-12-20 08:09:55 +13:00
11_pack_align_size_power2.dts binman: Add basic entry types for U-Boot 2016-12-20 08:09:55 +13:00
12_pack_inv_align.dts binman: Add basic entry types for U-Boot 2016-12-20 08:09:55 +13:00
13_pack_inv_size_align.dts binman: Add basic entry types for U-Boot 2016-12-20 08:09:55 +13:00
14_pack_overlap.dts binman: Add basic entry types for U-Boot 2016-12-20 08:09:55 +13:00
15_pack_overflow.dts binman: Add basic entry types for U-Boot 2016-12-20 08:09:55 +13:00
16_pack_image_overflow.dts binman: Add basic entry types for U-Boot 2016-12-20 08:09:55 +13:00
17_pack_image_size.dts binman: Add basic entry types for U-Boot 2016-12-20 08:09:55 +13:00
18_pack_image_align.dts binman: Add basic entry types for U-Boot 2016-12-20 08:09:55 +13:00
19_pack_inv_image_align.dts binman: Add basic entry types for U-Boot 2016-12-20 08:09:55 +13:00
20_pack_inv_image_align_power2.dts binman: Add basic entry types for U-Boot 2016-12-20 08:09:55 +13:00
21_image_pad.dts binman: Adjust size of test SPL binary 2017-12-12 19:53:45 -07:00
22_image_name.dts binman: Add basic entry types for U-Boot 2016-12-20 08:09:55 +13:00
23_blob.dts binman: Add basic entry types for U-Boot 2016-12-20 08:09:55 +13:00
24_sorted.dts binman: Adjust size of test SPL binary 2017-12-12 19:53:45 -07:00
25_pack_zero_size.dts binman: Add basic entry types for U-Boot 2016-12-20 08:09:55 +13:00
26_pack_u_boot_dtb.dts binman: Add basic entry types for U-Boot 2016-12-20 08:09:55 +13:00
27_pack_4gb_no_size.dts binman: Add support for building x86 ROMs 2016-12-20 08:09:55 +13:00
28_pack_4gb_outside.dts binman: Adjust size of test SPL binary 2017-12-12 19:53:45 -07:00
29_x86-rom.dts binman: Adjust size of test SPL binary 2017-12-12 19:53:45 -07:00
30_x86-rom-me-no-desc.dts tools: binman: Add missing filenames for various x86 rom tests 2017-04-10 10:02:03 +08:00
31_x86-rom-me.dts tools: binman: Add missing filenames for various x86 rom tests 2017-04-10 10:02:03 +08:00
32_intel-vga.dts tools: binman: Add missing filenames for various x86 rom tests 2017-04-10 10:02:03 +08:00
33_x86-start16.dts binman: Add support for building x86 ROMs 2016-12-20 08:09:55 +13:00
34_x86_ucode.dts binman: Add support for building x86 ROMs 2016-12-20 08:09:55 +13:00
35_x86_single_ucode.dts binman: Add support for building x86 ROMs 2016-12-20 08:09:55 +13:00
36_u_boot_img.dts binman: Add support for u-boot.img as an input binary 2016-12-20 08:09:55 +13:00
37_x86_no_ucode.dts binman: Add support for building x86 ROMs with SPL 2016-12-20 08:09:55 +13:00
38_x86_ucode_missing_node.dts binman: Add support for building x86 ROMs with SPL 2016-12-20 08:09:55 +13:00
39_x86_ucode_missing_node2.dts binman: Add support for building x86 ROMs with SPL 2016-12-20 08:09:55 +13:00
40_x86_ucode_not_in_image.dts binman: Add support for building x86 ROMs with SPL 2016-12-20 08:09:55 +13:00
41_unknown_pos_size.dts binman: Add support for building x86 ROMs with SPL 2016-12-20 08:09:55 +13:00
42_intel-fsp.dts tools: binman: Add missing filenames for various x86 rom tests 2017-04-10 10:02:03 +08:00
43_intel-cmc.dts tools: binman: Add missing filenames for various x86 rom tests 2017-04-10 10:02:03 +08:00
44_x86_optional_ucode.dts binman: Add support for building x86 ROMs with SPL 2016-12-20 08:09:55 +13:00
45_prop_test.dts fdt: dtoc: Add a full set of property tests 2017-06-02 10:16:47 -06:00
46_intel-vbt.dts tools: binman: Add a new entry type for Intel VBT 2017-09-16 14:57:44 +08:00
47_spl_bss_pad.dts binman: Add test for u-boot-spl-bss-pad 2017-11-22 18:05:38 -07:00
48_x86-start16-spl.dts binman: Add a test for x86-start16-spl 2017-11-22 18:05:38 -07:00
49_x86_ucode_spl.dts binman: Add add test for SPL with a microcode pointer 2017-11-22 18:05:38 -07:00
50_intel_mrc.dts binman: Add add test for using an Intel MRC binary 2017-11-22 18:05:38 -07:00
51_u_boot_spl_dtb.dts binman: Add support for including spl/u-boot-spl.dtb 2017-12-12 19:53:45 -07:00
52_u_boot_spl_nodtb.dts binman: Add support for including spl/u-boot-spl-nodtb.bin 2017-12-12 19:53:45 -07:00
53_symbols.dts binman: Support accessing binman tables at run time 2017-12-12 19:53:45 -07:00
bss_data binman: Add test for u-boot-spl-bss-pad 2017-11-22 18:05:38 -07:00
bss_data.c binman: Add a function to read ELF symbols 2017-12-12 19:53:45 -07:00
bss_data.lds binman: Add test for u-boot-spl-bss-pad 2017-11-22 18:05:38 -07:00
descriptor.bin binman: Add support for building x86 ROMs 2016-12-20 08:09:55 +13:00
Makefile binman: Add tests binaries with binman symbols 2017-12-12 19:53:45 -07:00
u_boot_binman_syms binman: Add tests binaries with binman symbols 2017-12-12 19:53:45 -07:00
u_boot_binman_syms_bad binman: Add tests binaries with binman symbols 2017-12-12 19:53:45 -07:00
u_boot_binman_syms_bad.c binman: Add tests binaries with binman symbols 2017-12-12 19:53:45 -07:00
u_boot_binman_syms_bad.lds binman: Add tests binaries with binman symbols 2017-12-12 19:53:45 -07:00
u_boot_binman_syms_size binman: Add tests binaries with binman symbols 2017-12-12 19:53:45 -07:00
u_boot_binman_syms_size.c binman: Add tests binaries with binman symbols 2017-12-12 19:53:45 -07:00
u_boot_binman_syms.c binman: Add tests binaries with binman symbols 2017-12-12 19:53:45 -07:00
u_boot_binman_syms.lds binman: Add tests binaries with binman symbols 2017-12-12 19:53:45 -07:00
u_boot_no_ucode_ptr binman: Add support for building x86 ROMs with SPL 2016-12-20 08:09:55 +13:00
u_boot_no_ucode_ptr.c binman: Add a Makefile for test-program compilation 2017-11-22 18:05:38 -07:00
u_boot_ucode_ptr binman: Add support for building x86 ROMs 2016-12-20 08:09:55 +13:00
u_boot_ucode_ptr.c binman: Add a function to read ELF symbols 2017-12-12 19:53:45 -07:00
u_boot_ucode_ptr.lds binman: Add support for building x86 ROMs 2016-12-20 08:09:55 +13:00