summaryrefslogtreecommitdiff
path: root/tools
Commit message (Collapse)AuthorAgeFilesLines
* tools: remove easylogo and include/video_logo.hWIP/2019-08-26-master-importsHeinrich Schuchardt2019-08-266-621/+0
| | | | | | | | | | include/video_logo.h once was created via the tool easylogo and than used in cpu/mpc8xx/video.c to display Tux. video_logo.h has been replaced by include/linux_logo.h and is not needed anymore. Delete the include and the tool, Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* easylogo: avoid buffer overrunHeinrich Schuchardt2019-08-201-1/+2
| | | | | | | | | | | | | | Building easylogo with `HOST_TOOLS_ALL=y make tools` results in a build warning due to a possible buffer overrun: tools/easylogo/easylogo.c:453:4: note: ‘sprintf’ output between 7 and 262 bytes into a destination of size 256 sprintf (str, "%s, 0x%02x", app, *dataptr++); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Truncate the output to fit into the destination buffer. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* riscv: tools: Add big endian target support to prelink-riscvMarcus Comstedt2019-08-152-33/+63
| | | | | | Signed-off-by: Marcus Comstedt <marcus@mc.pp.se> Cc: Rick Chen <rick@andestech.com> Reviewed-by: Rick Chen <rick@andestech.com>
* riscv: tools: Fix prelink-riscv to work on big endian hostsMarcus Comstedt2019-08-152-24/+23
| | | | | | | | | | All ELF fields whose values are inspected by the code are converted to CPU byteorder first. Values which are copied verbatim (relocation fixups) are not swapped to CPU byteorder and back as it is not needed. Signed-off-by: Marcus Comstedt <marcus@mc.pp.se> Cc: Rick Chen <rick@andestech.com> Reviewed-by: Rick Chen <rick@andestech.com>
* env: Rename environment.h to env_internal.hSimon Glass2019-08-111-1/+1
| | | | | | | | | | | | | | This file contains lots of internal details about the environment. Most code can include env.h instead, calling the functions there as needed. Rename this file and add a comment at the top to indicate its internal nature. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com> [trini: Fixup apalis-tk1.c] Signed-off-by: Tom Rini <trini@konsulko.com>
* env: Rename the redundancy flagsSimon Glass2019-08-111-10/+13
| | | | | | | | Add an ENV prefix to these two flags so that it is clear what they relate to. Also move them to env.h since they are part of the public API. Use an enum rather than a #define to tie them together. Signed-off-by: Simon Glass <sjg@chromium.org>
* env: Rename environment to embedded_environmentSimon Glass2019-08-111-2/+2
| | | | | | | | | The name 'environment' is widely used in U-Boot so is not a very useful name of a variable. Rename it to better indicate its purpose. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
* env: Move env_set() to env.hSimon Glass2019-08-113-0/+3
| | | | | | | Move env_set() over to the new header file. Acked-by: Joe Hershberger <joe.hershberger@ni.com> Signed-off-by: Simon Glass <sjg@chromium.org>
* tools: zynqmp_psu_init_minimize.sh: fix return lines coding styleLuca Ceresoli2019-07-301-0/+3
| | | | | | | | Remove unneeded parenthess around return value. E.g.: return (0); -> return 0; Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
* arm64: zynqmp: add tool to minimize psu_init_gpl.c filesLuca Ceresoli2019-07-301-0/+145
| | | | | | | | | | | This script transforms a pair of psu_init_gpl.c and .h files produced by the Xilinx Vivado tool for ZynqMP into a smaller psu_init_gpl.c file that is almost checkpatch compliant. Based on a script by Michal Simek. Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
* arm64: zynqmp: add tool to convert PMU config object .c to binaryLuca Ceresoli2019-07-301-0/+301
| | | | | | | | | | | | | | | | | | | | The recently-added ZYNQMP_SPL_PM_CFG_OBJ_FILE option allows SPL to load a PMUFW configuration object from a binary blob. However the configuration object is produced by Xilinx proprietary tools as a C source file and no tool exists to easily convert it to a binary blob in an embedded Linux build system for U-Boot to use. Add a simple Python script to do the conversion. It is definitely not a complete C language parser, but it is enough to parse the known patterns generated by Xilinx tools, including: - defines - literal integers, optionally with a 'U' suffix - bitwise OR between them Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
* Merge tag 'dm-pull-29jul19' of ↵WIP/29Jul2019Tom Rini2019-07-2947-364/+1980
|\ | | | | | | | | | | https://gitlab.denx.de/u-boot/custodians/u-boot-dm binman support for replacing files
| * binman: Add command-line support for replacing entriesSimon Glass2019-07-295-4/+327
| | | | | | | | | | | | | | Add a 'replace' command to binman to permit entries to be replaced, either individually or all at once (using a filter). Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Correct the error message for invalid pathSimon Glass2019-07-292-4/+4
| | | | | | | | | | | | | | At present this message references -o for output file. But binman uses -f now. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Split control.WriteEntryToImage() into separate functionsSimon Glass2019-07-291-17/+59
| | | | | | | | | | | | | | | | | | | | | | | | This code has three distinct phases: 1. The image is loaded and the state module is set up 2. The entry is written to the image 3. The image is repacked and written back to the file Split the code out with three separate functions, one for each phase. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Update control.WriteEntry() to support writing the mapSimon Glass2019-07-291-4/+6
| | | | | | | | | | | | | | Add the ability to write a new map file. Also tidy up a few comments and rename a misleading variable. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Move control.WriteEntry further down the fileSimon Glass2019-07-291-41/+40
| | | | | | | | | | | | | | Move this function after the extraction logic so we can keep the writing logic in one place. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Clean up all output directories in testsSimon Glass2019-07-291-9/+42
| | | | | | | | | | | | | | | | | | | | | | | | At present some tests leave behind output directories. This happens because some tests call binman, which sets up an output directory, then call it again, which sets up another output directory and leaves the original one behind. Fix this by using a separate temporary directory when binman is called twice, or by manually removing the output directory. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Add a test function to clean up the output dirSimon Glass2019-07-291-4/+8
| | | | | | | | | | | | | | Put tearDown()'s logic into a new _CleanupOutputDir() function so that it can be called from elsewhere. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Update state when replacing device-tree entriesSimon Glass2019-07-294-0/+38
| | | | | | | | | | | | | | | | Since the state module holds references to all the device trees used by binman, it must be updated when the device trees are updated. Add support for this. Signed-off-by: Simon Glass <sjg@chromium.org>
| * patman: Reset the output directory when it is removedSimon Glass2019-07-291-0/+2
| | | | | | | | | | | | | | At present outdir remains set ever after the output directory has been removed. Fix this to avoid trying to access it when it is not present. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Support replacing data in a cbfsSimon Glass2019-07-297-9/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At present binman cannot replace data within a CBFS since it does not allow rewriting of the files in that CBFS. Implement this by using the new WriteData() method to handle the case. Add a header to compressed data so that the amount of compressed data can be determined without reference to the size of the containing entry. This allows the entry to be larger that the contents, without causing errors in decompression. This is necessary to cope with a compressed device tree being updated in such a way that it shrinks after the entry size is already set (an obscure case). It is not used with CBFS since it has its own metadata for this. Increase the number of passes allowed to resolve the position of entries, to handle this case. Add a test for this new logic. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Update Entry.WriteData() to handle special sectionsSimon Glass2019-07-293-3/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | At present this method assumes that the parent section does not need to recalculate its position or adjust any metadata it may contain. But when the entry changes size this may not be true. Also if the parent section is more than just a container (e.g. it is a CBFS) then the section may need to regenerate its output. Add a new WriteChildData() method to sections and call this from the WriteData() method, to handle this situation. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Update Entry.ReadEntry() to work through classesSimon Glass2019-07-294-17/+46
| | | | | | | | | | | | | | | | | | | | | | At present we simply extract the data directly from entries using the image_pos information. This happens to work on current entry types, but cannot work if the entry type encodes the data in some way. Update the ReadData() method to provide the data by calling a new ReadChildData() method in the parent. This allows the entry_Section class, or possibly any other container class, to return the correct data in all cases. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Add a prefix before CBFS hex offsetsSimon Glass2019-07-292-4/+4
| | | | | | | | | | | | Add a 0x prefix to these errors to avoid confusion. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Add a few more features to the wishlistSimon Glass2019-07-291-0/+2
| | | | | | | | | | | | | | Add mention of a few other desirable features that may be implemented in the future. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Place Intel descriptor at image startSimon Glass2019-07-293-1/+34
| | | | | | | | | | | | | | | | | | The Intel descriptor must always appear at the start of an (x86) image, so it is supposed to position itself there always. However there is no explicit test for this. Add one and fix a bug introduced by the recent change to adjust Entry to read the node in a separate call. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Adjust fmap to ignore CBFS filesSimon Glass2019-07-292-3/+9
| | | | | | | | | | | | | | | | | | | | The FMAP is not intended to show the files inside a CBFS. The FMAP can be used to locate the CBFS itself, but then the CBFS must be read to find out what is in it. Update the FMAP to work this way and add some debugging while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Support shrinking a entry after packingSimon Glass2019-07-295-11/+91
| | | | | | | | | | | | | | | | | | | | | | Sometimes an entry may shrink after it has already been packed. In that case we must repack the items. Of course it is always possible to just leave the entry at its original size and waste space at the end. This is what binman does by default, since there is the possibility of the entry changing size every time binman calculates its contents, thus causing a loop. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Update the _testing entry to support shrinkageSimon Glass2019-07-292-14/+27
| | | | | | | | | | | | | | Sometimes entries shrink after packing. As a start towards supporting this, update the _testing entry to handle the test case. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Allow updating entries that change sizeSimon Glass2019-07-297-26/+113
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | So far we don't allow entries to change size when repacking. But this is not very useful since it is common for entries to change size after an updated binary is built, etc. Add support for this, respecting the original offset/size/alignment constraints of the image layout. For this to work the original image must have been created with the 'allow-repack' property. This does not support entry types with sub-entries such as files and CBFS, but it does support sections. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Add more tests for image header positionSimon Glass2019-07-298-2/+127
| | | | | | | | | | | | | | | | | | | | | | The positioning does not currently work correctly if at the end of an image with no fixed size. Also if the header is in the middle of an image it can cause a gap in the image since the header position is normally at the image end, so entries after it are placed after the end of the image. Fix these problems and add more tests to cover these cases. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Move Image.BuildImage() into a single functionSimon Glass2019-07-291-6/+4
| | | | | | | | | | | | | | Now that an Image is an Entry_section, there is no need for the separate BuildSection() function. Drop it and add a bit of logging. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Write the original input fdtmap to a fileSimon Glass2019-07-292-2/+9
| | | | | | | | | | | | | | | | When reading an image in, write its fdtmap to a file in the output directory. This is useful for debugging. Update the 'ls' command to set up the output directory; otherwise it will fail. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Update documentation for image creationSimon Glass2019-07-291-5/+18
| | | | | | | | | | | | | | There are a few more steps in the process now. Update the documentation to reflect this. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Add info to allow safely repacking an image laterSimon Glass2019-07-298-14/+165
| | | | | | | | | | | | | | | | | | | | | | At present it is not possible to discover the contraints to repacking an image (e.g. maximum section size) since this information is not preserved from the original image description. Add new 'orig-offset' and 'orig-size' properties to hold this. Add them to the main device tree in the image. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Support updating entries in an existing imageSimon Glass2019-07-298-25/+277
| | | | | | | | | | | | | | | | | | | | | | While it is useful and efficient to build images in a single pass from a unified description, it is sometimes desirable to update the image later. Add support for replace an existing file with one of the same size. This avoids needing to repack the file. Support for more advanced updates will come in future patches. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Tidy up _SetupDtb() to use its own temporary fileSimon Glass2019-07-293-7/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At present EnsureCompiled() uses an file from the 'output' directory (in the tools module) when compiling the device tree. This is fine in most cases, allowing useful inspection of the output files from binman. However in functional tests, _SetupDtb() creates an output directory and immediately removes it afterwards. This serves no benefit and just confuses things, since the 'official' output directory is supposed to be created and destroyed in control.Binman(). Add a new parameter for the optional temporary directory to use, and use a separate temporary directory in _SetupDtb(). Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Allow the fdtmap to remain unchangedSimon Glass2019-07-291-25/+30
| | | | | | | | | | | | | | | | When updating an existing image where the size of all entries remains the same, we should not need to regenerate the fdtmap. Update the entry to return the same fdtmap as was read from the image. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Add a constant for common entry propertiesSimon Glass2019-07-291-7/+8
| | | | | | | | | | | | | | We use this same combination of properties several times in tests. Add a constant for it to avoid typos, etc. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Add a function to obtain the image for an EntrySimon Glass2019-07-294-5/+23
| | | | | | | | | | | | | | | | | | | | At present we have an 'image' property in the entry for this purpose, but this is not necessary and seems error-prone in the presence of inheritance. Add a function instead. The Entry_section class overrides this with a special version, since top-level sections are in fact images, since Image inherits Entry_section. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Adjust Entry to read the node in a separate callSimon Glass2019-07-298-24/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At present the Entry constructor sets up the object and then immediately reads its device-tree node to obtain its properties. This breaks a convention that constructors should not do any processing. A consequence is that we must pass all arguments to the constructor and cannot have the node-reading proceed in a different way unless we pass flags to that constructor. We already have a 'test' flag in a few cases, and now need to control whether the 'orig_offset' and 'orig_size' properties are set or not. Adjust the code to require a separate call to ReadNode() after construction. The Image class remains as it was. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Add an image name into the fdtmapSimon Glass2019-07-292-1/+3
| | | | | | | | | | | | | | | | | | | | | | Since binman supports multiple images it is useful to know which one created the image that has been read. Then it is possible to look up that name in the 'master' device tree (containing the description of all images). Add a property for this. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Store the entry in output_fdt_filesSimon Glass2019-07-291-15/+34
| | | | | | | | | | | | | | | | | | | | In some cases we want to access the Entry object for a particular device tree. This allows us to read its contents or update it. Add this information to output_fdt_files and provide a function to read it. Also rename output_fdt_files since its name is no-longer descriptive. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Allow state functions to fail to return dataSimon Glass2019-07-291-2/+7
| | | | | | | | | | | | | | | | | | | | At present these state functions raise an exception if they cannot find what is requested. But in some cases the information is optional (e.g. an fdtmap in a coming patch) so it is better to return gracefully. Update these two functions to return None when the data cannot be found. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Support loading entry data from a fileSimon Glass2019-07-292-0/+10
| | | | | | | | | | | | | | | | When modifying an image it is convenient to load the data from the file into each entry so that it can be reprocessed. Add a new LoadData() method to handle this. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Store image fdtmap when loading from a fileSimon Glass2019-07-291-1/+10
| | | | | | | | | | | | | | | | This data provides all the information about the position and size of each entry. Store it for later use when loading an image. It can be reused as is if the image is modified without changing offsets/sizes. Signed-off-by: Simon Glass <sjg@chromium.org>
| * dtoc: Update Fdt.GetNode() to handle the root nodeSimon Glass2019-07-292-0/+7
| | | | | | | | | | | | | | This function currently fails if the root node is requested. Requesting the root node is sometimes useful, so fix the bug. Signed-off-by: Simon Glass <sjg@chromium.org>
| * dtoc: Update Fdt.FromData() to allow a nameSimon Glass2019-07-291-1/+7
| | | | | | | | | | | | | | | | | | It is confusing when something goes wrong with a device tree which was created from data rather than a file, since there is no identifying filename. Add an option to provide this. Use the filename as the name, where available Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Show a helpful error when a DT property is missingSimon Glass2019-07-292-3/+41
| | | | | | | | | | | | | | At present a Python exception is raised which does not show the node information. Add a more helpful exception in this case. Signed-off-by: Simon Glass <sjg@chromium.org>