summaryrefslogtreecommitdiff
path: root/tools
AgeCommit message (Collapse)Author
2018-01-22tools: provide a tool to convert a binary file to an includeHeinrich Schuchardt
For testing EFI disk management we need an in-memory image of a disk. The tool file2include converts a file to a C include. The file is separated into strings of 8 bytes. Only the non-zero strings are written to the include. The output format has been designed to maintain readability. #define EFI_ST_DISK_IMG { 0x00010000, { \ {0x000001b8, "\x94\x37\x69\xfc\x00\x00\x00\x00"}, /* .7i..... */ \ {0x000001c0, "\x02\x00\x83\x02\x02\x00\x01\x00"}, /* ........ */ \ {0x000001c8, "\x00\x00\x7f\x00\x00\x00\x00\x00"}, /* ........ */ \ {0x000001f8, "\x00\x00\x00\x00\x00\x00\x55\xaa"}, /* ......U. */ \ ... {0x00006000, "\x48\x65\x6c\x6c\x6f\x20\x77\x6f"}, /* Hello wo */ \ {0x00006008, "\x72\x6c\x64\x21\x0a\x00\x00\x00"}, /* rld!.... */ \ {0, NULL} } } As the disk image needed for testing contains mostly zeroes a high compression ratio can be attained. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-21patman: Unquote output from get_maintainer.plStefan Brüns
get_maintainer.pl quotes names which it considers unsafe, i.e. anything containing [^a-zA-Z0-9_ \-]. This confuses patman, it will duplicate addresses which are also in Series-to/cc. Strip the quotes. Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-01-19tools: omapimage: Fix mismatch of image size in headerLokesh Vutla
The size field in GP header that is expected by ROM is size of the image + size of the header. But omapimage tool is updating size as image size + 2 * header size. Remove this extra header size bytes. Reported-by: Denys Dmytriyenko <denys@ti.com> Debugged-by: Madan Srinivas <madans@ti.com> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
2018-01-16tools: Update python "help" tests to cope with "more" odditiesTom Rini
In some cases when "more" is told to page a given file it will prepend the output with: :::::::::::::: /PATH/TO/THE/FILE :::::::::::::: And when this happens the output will not match the expected length. Further, if we use a different pager we will instead fail the coverage tests as we will not have 100% coverage. Update the help test to remove the string in question. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com>
2018-01-15dtoc: Allow DTC environment variable to provide path to dtcSimon Glass
The system device-tree compiler may not be new enough to run the tests we use in U-Boot (e.g. with binman). Allow use of a DTC environment variable to point to the correct dtc. If not defined, the dtc on the default PATH is used. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-01-15tools: fix incorrect usage of DT node unit addressAndre Przywara
The DT spec demands a unit-address in a node name to match the "reg" property in that node. Newer dtc versions will throw warnings if this is not the case. Correct the generated unit names when U-Boot's mkimage creates a FIT image. Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2018-01-15fix incorrect usage of DT node unit address in commentsAndre Przywara
The DT spec demands a unit-address in a node name to match the "reg" property in that node. Newer dtc versions will throw warnings if this is not the case. Fix all occurences in the tree where node names were mentioned in comments, to not give bad examples to the reader. Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2018-01-12riscv: tools: Prelink u-bootRick Chen
Add prelink-riscv to arrange .rela.dyn and .rela.got in compile time. So that u-boot can be directly executed without fixup. Signed-off-by: Chih-Mao Chen <cmchen@andestech.com> Signed-off-by: Rick Chen <rick@andestech.com> Signed-off-by: Rick Chen <rickchen36@gmail.com> Signed-off-by: Greentime Hu <green.hu@gmail.com>
2018-01-09tools: Add Marvell recovery image download scriptKonstantin Porotchkin
Introduce the recovery image download script for usage with Marvell Armada SoC families (excepting 37xx family). Since Marvell BootROM uses a sliding window in UART buffer for detecting escape sequence during the boot, it's easier to interrupt the normal boot flow by sending a long stream of chained escape sequences to the serial port instead of periodically sending a single escape sequence as it is done by kwboot utility. Additional benefit of using this script is the ability to adjust the escape sequence stream length withoiut need for compilation. Signed-off-by: Konstantin Porotchkin <kostap@marvell.com> Cc: Stefan Roese <sr@denx.de> Cc: Igal Liberman <igall@marvell.com> Signed-off-by: Stefan Roese <sr@denx.de>
2017-12-18Merge tag 'xilinx-for-v2018.01-rc2-v2' of ↵Tom Rini
git://www.denx.de/git/u-boot-microblaze Xilinx changes for v2018.01-rc2-v2 fpga: - Enable loading bitstream via fit image for !xilinx platforms zynq: - Fix SPL SD boot mode zynqmp: - Not not reset in panic - Do not use simple allocator because of fat changes - Various dt chagnes - modeboot variable setup - Fix fpga loading on automotive devices - Fix coverity issues test: - Fix env test for !hush case - Stephen's patch
2017-12-18tools: zynqmpimage: Check return values from file functionsMichal Simek
Check all return values from file functions. In case of negative return exit immediately. Also change fsize return value which can't be negative. Reported-by: Coverity (CID: 23276, 23304, 169357) Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2017-12-12binman: Add documentation for the symbol featureSimon Glass
Add this feature to the README. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Lukasz Majewski <lukma@denx.de>
2017-12-12binman: Support accessing binman tables at run timeSimon Glass
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-12binman: Support enabling debug in testsSimon Glass
The elf module can provide some debugging information to assist with figuring out what is going wrong. This is also useful in tests. Update the -D option so that it is passed through to tests as well. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-12-12binman: Adjust size of test SPL binarySimon Glass
This is only 3 bytes long which is not enough to hold two symbol values, needed to test the binman symbols feature. Increase it to 15 bytes. Using very small regions is useful since we can easily compare them in tests and errors are fairly easy to diagnose. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-12-12binman: Add tests binaries with binman symbolsSimon Glass
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>
2017-12-12binman: Drop a stale comment about the 'board' featureSimon Glass
This feature is now supported. Drop the incorrect comment. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-12-12binman: Add support for including spl/u-boot-spl-nodtb.binSimon Glass
This file contains SPL image without a device tree. Add support for including this in images. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-12-12binman: Add support for including spl/u-boot-spl.dtbSimon Glass
This file contains the SPL device tree. Add support for including this by itself in images. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-12-12binman: Add a function to read ELF symbolsSimon Glass
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>
2017-12-05tools: omapimage: fix corner-case in byteswap pathPhilipp Tomsich
Since commit 2614a208471e ("common: command: tempory buffer should have size of command line buf"), there have been consistent Travis CI failures on my builds (interestingly not for Tom, even though building the same commit id) due to a SEGV in building the byteswapped omapimage: arm: pcm051_rev3 make[2]: *** [MLO.byteswap] Error 139 ^^^ error code for a SEGV Turns out that the word-based byte-swapping loop in omapimage.c is to blame. With the loop condition while (swapped <= (sbuf->st_size / sizeof(uint32_t))) there had been one-too-many iterations for all file sizes divisible by the sizeof(uint32_t). I.e. we had 1 iteration for 0 bytes (and also 1 through 3 bytes) and 2 iterations at 4 bytes... clearly overshooting on 0 and 4 bytes. This commit fixes the calculation of an up-rounded word-count and makes sure to keep the zero-based loop-counter below the number of words to be processed. References: 2614a20 ("common: command: tempory buffer should have size of command line buf") Fixes: 79b9ebb ("omapimage: Add support for byteswapped SPI images") Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Reviewed-by: Martin Elshuber <martin.elshuber@theobroma-systems.com>
2017-12-04libfdt: migrate fdt_wip.c to a wrapper of scripts/dtc/libfdt/fdt_wip.cMasahiro Yamada
Now, lib/libfdt/fdt_wip.c is the same as scripts/dtc/libfdt/fdt_wip.c Change the former to a wrapper of the latter. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-11-29tools: env: Add support for direct read/write UBI volumesS. Lockwood-Childs
Up to now we were able to read/write environment data from/to UBI volumes only indirectly by gluebi driver. This driver creates NAND MTD on top of UBI volumes, which is quite a workaroung for this use case. Add support for direct read/write UBI volumes in order to not use obsolete gluebi driver. Forward-ported from this patch: http://patchwork.ozlabs.org/patch/619305/ Original patch: Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com> Forward port: Signed-off-by: S. Lockwood-Childs <sjl@vctlabs.com>
2017-11-29tools: zynqmpimage: adjust ug1085 reference to v1.4 of the documentJean-Francois Dagenais
The chapter in which the table explaining the image format changed chapter as the document evolved. This should help people track the info down faster. Signed-off-by: Jean-Francois Dagenais <jeff.dagenais@gmail.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
2017-11-28tools: mkimage: Extend mkimage to also include pmufwMichal Simek
The patch is adding external pmufw "Platform Management Unit firmware" to boot.bin image. Boot.bin is a Xilinx format which bootrom is capable to read and boot the system. pmufw is copied to the header data section follows by u-boot-spl.bin. pmufw is consumed by PMU unit (Microblaze) and SPL runs on a53-0. This is generated command line when PMUFW_INIT_FILE is setup. ./tools/mkimage -T zynqmpimage -R ./"" -n ./"board/xilinx/zynqmp/pmufw.bin" -d spl/u-boot-spl.bin spl/boot.bin Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-11-23Merge git://git.denx.de/u-boot-dmTom Rini
2017-11-22binman: Return non-zero exit code on test failureSimon Glass
Return exit code 1 when test fail so that callers can detect this. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-11-22binman: Add add test for using an Intel MRC binarySimon Glass
MRC (Memory Reference Code) is a binary blob used to set up the SDRAM controller on some Intel boards. Add a test for this feature. With this test coverage on binman is back up to 100%. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-11-22binman: Add add test for SPL with a microcode pointerSimon Glass
Add a test for this feature. It allows SPL to hold a pointer to the microcode block. This is used for 64-bit U-Boot on x86. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-11-22binman: Add a test for x86-start16-splSimon Glass
This allows us to put the 16-bit x86 start-up code in SPL. Add a test for it. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-11-22binman: Add test for u-boot-spl-bss-padSimon Glass
Add a test that we can pad the BSS with zero bytes. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-11-22binman: Check for files missing from test coverageSimon Glass
Files that are never imported are not shown in the test-coverage report. Detect these and show an error. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-11-22binman: Increase test coverage back to 100%Simon Glass
Make a minor tweak to fix test coverage. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-11-22binman: Add a main program to the testsSimon Glass
Add a main program so that the tests can be executed directly, without going through the main binman program. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-11-22binman: Add tests for importlib availabilitySimon Glass
Add a test that the 'entry' module works with or without importlib. The tests are numbered so that they are executed in the correct order. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-11-22binman: Set up 'entry' to permit full test coverageSimon Glass
There is a little check at the top of entry.py which decides if importlib is available. At present this has no test coverage. To add this we will need to import the module twice, once with importlib and once without. In preparation for allowing a test to control the importing of this module, remove all global imports of the 'entry' module. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-11-22binman: Append to PYTHONPATH when running test coverageSimon Glass
Rather that overwrite this, append to it, in case the caller has already set up the path correctly. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-11-22dtoc: Fix up testsSimon Glass
The tool has changed slightly since it was originally written. Update the tests to suit. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-11-22buildman: Fix up testsSimon Glass
The tests were broken by two separate commits which adjusted the output when boards are listed. Fix this by adding back a PowerPC board and putting the name of each board in the test. Fixes: b9f7d881 (powerpc, 5xx: remove some "5xx" remains) Fixes: 8d7523c5 (buildman: Allow showing the list of boards with -n) Signed-off-by: Simon Glass <sjg@chromium.org>
2017-11-22buildman: Allow skipping of tests which use the networkSimon Glass
Accessing the network slows down the test and limits the environment in which it can be run. Add an option to disable network tests. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-11-22patman: Fix up tests to pass with newest checkpatchSimon Glass
The checkpatch tool was updated but the patman tests were not. Fix this. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-11-22binman: Disable the no-unit_address_vs_reg warningsSimon Glass
These warnings are not useful for binman tests. Disable them. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-11-22binman: Rename tests to ftestSimon Glass
At present these tests use the same filename as patman. This adds confusion when running all tests, since error messages look very similar. In fact binman tries to run the wrong tests at present. Rename the tests. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-11-22binman: Add a Makefile for test-program compilationSimon Glass
These test programs are includedd as binary files in U-Boot to avoid having to build them (and associated toolchain differences). Instructions on building are in the files themselves, but it seems better to provide a Makefile which can be manually run when desired. Add a Makefile, separate from the normal build system, to handle this. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-11-22binman: Add docs explaining how to enable binman for a boardSimon Glass
The process is not obvious. Add a little section to explain how to move a board to use binman. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-11-22binman: Add better Makefile debuggingSimon Glass
There is a debugging option in the Makefile to allow people to figure out which u-boot.dtsi files are used in the build. But is it not easy to use since it only shows files it finds, not those it is looking for. Update it and update the mention of it to the docs. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-11-21rockchip: mkimage: remove unused code-paths (spl_boot0 is now implied)Philipp Tomsich
With all targets converted to generate prepadded images, this removes the spl_boot0 field from our config structure and removes the unused code-path (for images that are not prepadded): i.e. spl_boot0 is now implied as 'true' and the code is specialised by removing the other case. Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
2017-11-21rockchip: mkimage: use spl_boot0 for all Rockchip SoCsKever Yang
Enable the spl_boot0 in SPL and use the pre-padding TAG memory, the mkimage do not need to pad it but only need to replace the value with correct TAG value. Signed-off-by: Kever Yang <kever.yang@rock-chips.com> [Updated:] Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
2017-11-21env: Remove CONFIG_ENV_AES supportTom Rini
This support has been deprecated since v2017.09 due to security issues. We now remove this support. Signed-off-by: Tom Rini <trini@konsulko.com>
2017-11-17tools: use files from scripts/dtc/libfdt where possibleMasahiro Yamada
Prior to this commit, tools/Makefile pulls all libfdt files from lib/libfdt. lib/libfdt/ and scripts/dtc/libfdt have the same copies for the followings 6 files: fdt.c fdt_addresses.c fdt_empty_tree.c fdt_overlay.c fdt_strerr.c fdt_sw.c This commit changes them to #include ones from scripts/dtc/libfdt. Unfortunately, U-Boot locally modified the following 3 files: fdt_ro.c fdt_wip.c fdt_rw.c I did not touch them in order to avoid unpredictable impact. The fdt_region.c is U-Boot own file. This is also borrowed from lib/libfdt/. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>