summaryrefslogtreecommitdiff
path: root/tools
Commit message (Collapse)AuthorAgeLines
* tools/env: soften warning about erase block alignmentAndreas Fenkart2016-08-20-1/+1
| | | | | | | | | addon 183923d3e MMC/SATA have no erase blocks, only blocks. Hence the warning about erase block alignment might be confusing in such environment. Signed-off-by: Andreas Fenkart <andreas.fenkart@digitalstrom.com> Reviewed-by: Tom Rini <trini@konsulko.com>
* tools/env: return with error if redundant environments have unequal sizeAndreas Fenkart2016-08-20-3/+2
| | | | | | | | | | | For double buffering to work, the target buffer must always be big enough to hold all data. This can only be ensured if buffers are of equal size, otherwise one must be smaller and we risk data loss when copying from the bigger to the smaller buffer. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Andreas Fenkart <andreas.fenkart@digitalstrom.com> Reviewed-by: Tom Rini <trini@konsulko.com>
* tools/env: ensure environment starts at erase block boundaryAndreas Fenkart2016-08-15-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | 56086921 added support for unaligned environments access. U-boot itself does not support this: - env_nand.c fails when using an unaligned offset. It produces an error in nand_erase_opts{drivers/mtd/nand/nand_util.c} - in env_sf/env_flash the unused space at the end is preserved, but not in the beginning. block alignment is assumed - env_sata/env_mmc aligns offset/length to the block size of the underlying device. data is silently redirected to the beginning of a block There is seems no use case for unaligned environment. If there is some useful data at the beginning of the the block (e.g. end of u-boot) that would be very unsafe. If the redundant environments are hosted by the same erase block then that invalidates the idea of double buffering. It might be that unaligned access was allowed in the past, and that people with legacy u-boot are trapped. But at the time of 56086921 it wasn't supported and due to reasons above I guess it was never introduced. I prefer to remove that (unused) feature in favor of simplicity Signed-off-by: Andreas Fenkart <andreas.fenkart@digitalstrom.com> Acked-by: Stefan Agner <stefan.agner@toradex.com>
* mkimage: Fix argument parsing with signature commentKarl Beldan2016-08-05-1/+1
| | | | | | | | Inform getopt that '-c' requires a parameter. Fixes: a02221f29deb ("mkimage: Convert to use getopt()") Signed-off-by: Karl Beldan <kbeldan@baylibre.com> Reviewed-by: Tom Rini <trini@konsulko.com>
* tools: moveconfig: support CONFIG_SYS_EXTRA_OPTIONS cleaningMasahiro Yamada2016-08-05-0/+74
| | | | | | | | | | | | | | | | We mostly move config options from board header files to Kconfig, but sometimes config defines come from CONFIG_SYS_EXTRA_OPTIONS. Historically, CONFIG_SYS_EXTRA_OPTIONS originates in boards.cfg, which was used as a central database of configuration prior to the Kconfig conversion. Now, we want to migrate to primary entries in Kconfig rather than option list in CONFIG_SYS_EXTRA_OPTIONS, so it should be helpful to have the tool to cleanup CONFIG_SYS_EXTRA_OPTIONS automatically. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Tom Rini <trini@konsulko.com>
* tools: moveconfig: make getting all defconfigs into helper functionMasahiro Yamada2016-08-05-6/+11
| | | | | | | I want to reuse this routine in the next commit. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Tom Rini <trini@konsulko.com>
* tools: moveconfig: fix cleanup of defines across multiple linesMasahiro Yamada2016-08-05-0/+3
| | | | | | | | | | | | Correct the clean-up of such defines that continue across multiple lines, like follows: #define CONFIG_FOO "this continues to the next line " \ "this line should be removed too" \ "this line should be removed as well" Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Tom Rini <trini@konsulko.com>
* tools: moveconfig: show diffs of cleaned headers in colorMasahiro Yamada2016-08-05-10/+16
| | | | | | | Show code diff in color if --color option is given. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Tom Rini <trini@konsulko.com>
* tools: moveconfig: show result of header cleaning in unified diffMasahiro Yamada2016-08-05-5/+25
| | | | | | | | | | | The header cleanup feature of this tool now removes empty ifdef's, successive blank lines as well as moved option defines. So, we want to see a little more context to check which lines were deleted. It is true that we can see it by "git diff", but it would not work in the --dry-run mode. So, here, this commit. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
* tools: moveconfig: trim garbage lines after header cleanupsMasahiro Yamada2016-08-05-4/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The tools/moveconfig.py has a feature to cleanup #define/#undef's of moved config options, but I want this tool to do a better job. For example, when we are moving CONFIG_FOO and its define is surrounded by #ifdef ... #endif, like follows: #ifdef CONFIG_BAR # define CONFIG_FOO #endif The header cleanup will leave empty #ifdef ... #endif: #ifdef CONFIG_BAR #endif Likewise, if a define line between two blank lines <blank line> #define CONFIG_FOO <blank lines. ... is deleted, the result of the clean-up will be successive empty lines, which is a coding-style violation. It is tedious to remove left-over garbage lines manually, so I want the tool to take care of this. The tool's job is still not perfect, so we should check the output of the tool, but I hope our life will be much easier with this patch. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
* tools: moveconfig: do not check clean tree and compilers for -H optionMasahiro Yamada2016-08-05-4/+2
| | | | | | | | The clean tree (make mrproper) and compilers are required when moving config options, but not needed when we only cleanup headers. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Tom Rini <trini@konsulko.com>
* tools: moveconfig: do not cleanup headers in include/generatedMasahiro Yamada2016-08-05-0/+2
| | | | | | | | The files in include/generated are generated during build and removed by "make mrproper", so it has no point to touch them by this tool. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Tom Rini <trini@konsulko.com>
* buildman: Add a quick-start noteSimon Glass2016-07-31-0/+14
| | | | | | | | For those who just want to build a board, it is useful to see a quick hint right at the start of the documentation. Add a few commands showing how to download toolchains and build a board. Signed-off-by: Simon Glass <sjg@chromium.org>
* buildman: Avoid overwriting existing toolchain entriesSimon Glass2016-07-31-2/+1
| | | | | | | | | | | | | | | | | | | The current code for setting up the toolchain config always writes the new paths to an item called 'toolchain'. This means that it will overwrite any existing toolchain item with the same name. In practice, this means that: buildman --fetch-arch all will fetch all toolchains, but only the path of the final one will be added to the config. This normally works out OK, since most toolchains are the same version (e.g. gcc 4.9) and will be found on the same path. But it is not correct and toolchains for archs which don't use the same version will not function as expected. Adjust the code to use a complete glob of the toolchain path. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
* buildman: Drop the toolchain error when downloading toolchainsSimon Glass2016-07-31-7/+10
| | | | | | | | | | | It doesn't make sense to complain about missing toolchains when the --fetch-arch option is being used. The user is presumably aware that there is a toolchain problem and is actively correcting it by running with this option. Refactor the code to avoid printing this confusing message. Signed-off-by: Simon Glass <sjg@chromium.org>
* buildman: Fix a typo in TestSettingsHasPath()Simon Glass2016-07-31-1/+1
| | | | | | | The function comment should say 'buildman'. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
* buildman: Improve the toolchain progress/error outputSimon Glass2016-07-31-12/+21
| | | | | | | | | | Use colour to make it easier to see what is going on. Also print a message before downloading a new toolchain. Mention --fetch-arch in the message that is shown when there are no available toolchains, since this is the quickest way to resolve the problem. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
* buildman: Allow the toolchain error to be suppressedSimon Glass2016-07-31-6/+14
| | | | | | | | | When there are no toolchains a warning is printed. But in some cases this is confusing, such as when the user is fetching new toolchains. Adjust the function to supress the warning in this case. Signed-off-by: Simon Glass <sjg@chromium.org>
* buildman: Fix the 'help' test to use the correct pathSimon Glass2016-07-31-1/+1
| | | | | | | When buildman is run via a symlink, this test fails. Fix it to work the same way as buildman itself. Signed-off-by: Simon Glass <sjg@chromium.org>
* buildman: Automatically create a config file if neededSimon Glass2016-07-31-0/+44
| | | | | | | | | | If there is no ~/.buildman file, buildman currently complains and exists. To make things a little more friendly, create an empty one automatically. This will not allow things to be built, but --fetch-arch can be used to handle that. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
* buildman: Tidy up the README a littleSimon Glass2016-07-31-23/+30
| | | | | | | Tidy up some problems found by a recent review. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
* Merge branch 'master' of git://git.denx.de/u-boot-i2cTom Rini2016-07-26-7/+10
|\
| * tools: env: Fix format warnings in debugMarcin Niestroj2016-07-26-7/+10
| | | | | | | | | | | | | | | | | | | | Format warnings (-Wformat) were shown in printf() calls after defining DEBUG macro. Update format string and explicitly cast variables to suppress all warnings. Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
* | mkimage: rockchip: add suport for rk33 serialKever Yang2016-07-25-1/+1
| | | | | | | | | | | | | | Add support for rockchip rk33 series Soc like rk3368 and rk3399 Signed-off-by: Kever Yang <kever.yang@rock-chips.com> Acked-by: Simon Glass <sjg@chromium.org>
* | mkimage: rockchip: add suport for rk33 serialKever Yang2016-07-25-0/+1
|/ | | | | | | Add support for rockchip rk33 series Soc like rk3368 and rk3399 Signed-off-by: Kever Yang <kever.yang@rock-chips.com> Acked-by: Simon Glass <sjg@chromium.org>
* dtoc: Correct the type widening code in fdt_fallbackSimon Glass2016-07-25-0/+6
| | | | | | | | | | | | | This code does not match the fdt version in fdt.py. When dtoc is unable to use the Python libfdt library, it uses the fallback version, which does not widen arrays correctly. Fix this to avoid a warning 'excess elements in array initialize' in dt-platdata.c which happens on some platforms. Reported-by: Tom Rini <trini@konsulko.com> Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Tom Rini <trini@konsulko.com>
* tools, rsa: Further minor cleanups on top of c236ebd and 2b9ec7mario.six@gdsys.cc2016-07-25-3/+8
| | | | | | | | | | | | | | | [NOTE: I took v1 of these patches in, and then v2 came out, this commit is squashing the minor deltas from v1 -> v2 of updates to c236ebd and 2b9ec76 into this commit - trini] - Added an additional NULL check, as suggested by Simon Glass to fit_image_process_sig - Re-formatted the comment blocks Signed-off-by: Mario Six <mario.six@gdsys.cc> Reviewed-by: Simon Glass <sjg@chromium.org> [For merging the chnages from v2 back onto v1] Signed-off-by: Tom Rini <trini@konsulko.com>
* tools: Fix return code of fit_image_process_sig()mario.six@gdsys.cc2016-07-22-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | When signing images, we repeatedly call fit_add_file_data() with successively increasing size values to include the keys in the DTB. Unfortunately, if large keys are used (such as 4096 bit RSA keys), this process fails sometimes, and mkimage needs to be called repeatedly to integrate the keys into the DTB. This is because fit_add_file_data actually returns the wrong error code, and the loop terminates prematurely, instead of trying again with a larger size value. This patch corrects the return value and also removes a error message, which is misleading, since we actually allow the function to fail. A (hopefully helpful) comment is also added to explain the lack of error message. This is probably related to 1152a05 ("tools: Correct error handling in fit_image_process_hash()") and the corresponding error reported here: https://www.mail-archive.com/u-boot@lists.denx.de/msg217417.html Signed-off-by: Mario Six <mario.six@gdsys.cc>
* tools/env: reuse fw_getenv in fw_printenv functionAndreas Fenkart2016-07-22-27/+17
| | | | | | | | | | Try to avoid adhoc iteration of the environment. Reuse fw_getenv to find the variables that should be printed. Only use open-coded iteration when printing all variables. For backwards compatibility, keep emitting a newline when printing with value_only. Signed-off-by: Andreas Fenkart <andreas.fenkart@digitalstrom.com>
* tools/env: move envmatch further up in file to avoid forward declarationsAndreas Fenkart2016-07-22-20/+18
| | | | | | | forward declaration not needed when re-ordered Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Andreas Fenkart <andreas.fenkart@digitalstrom.com>
* tools/env: kernel-doc for fw_printenv, fw_getenv and fw_parse_scriptAndreas Fenkart2016-07-22-2/+115
| | | | | | | | | | | | | | | there are two groups of functions: - application ready tools: fw_setenv/fw_getenv/fw_parse_script these are used, when creating a single binary containing multiple tools (busybox like) - file access like: open/read/write/close above functions are implemented on top of these. applications can use those to modify several variables without creating a temporary batch script file tested with "./scripts/kernel-doc -html -v tools/env/fw_env.h" Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Andreas Fenkart <andreas.fenkart@digitalstrom.com>
* tools/env: allow negative offsetsStefan Agner2016-07-22-9/+35
| | | | | | | | | | A negative value for the offset is treated as a backwards offset for from the end of the device/partition for block devices. This aligns the behavior of the config file with the syntax of CONFIG_ENV_OFFSET where the functionality has been introduced with commit 5c088ee841f9 ("env_mmc: allow negative CONFIG_ENV_OFFSET"). Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
* tools/env: complete environment device config earlyStefan Agner2016-07-22-50/+60
| | | | | | | | | | | | | | | Currently flash_read completes a crucial part of the environment device configuration, the device type (mtd_type). This is rather confusing as flash_io calls flash_read conditionally, and one might think flash_write, which also makes use of mtd_type, gets called before flash_read. But since flash_io is always called with O_RDONLY first, this is not actually the case in reality. However, it is much cleaner to complete and verify the config early in parse_config. This also prepares the code for further extension. Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Reviewed-by: Andreas Fenkart
* Various, unrelated tree-wide typo fixes.Robert P. J. Day2016-07-16-1/+1
| | | | | | | | | | | | | | | | | | | Fix a number of typos, including: * "compatble" -> "compatible" * "eanbeld" -> "enabled" * "envrionment" -> "environment" * "FTD" -> "FDT" (for "flattened device tree") * "ommitted" -> "omitted" * "overriden" -> "overridden" * "partiton" -> "partition" * "propogate" -> "propagate" * "resourse" -> "resource" * "rest in piece" -> "rest in peace" * "suport" -> "support" * "varible" -> "variable" Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
* Merge git://git.denx.de/u-boot-dmTom Rini2016-07-15-0/+883
|\
| * dm: core: Expand platdata for of-platdata devicesSimon Glass2016-07-14-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Devices which use of-platdata have their own platdata. However, in many cases the driver will have its own auto-alloced platdata, for use with the device tree. The ofdata_to_platdata() method converts the device tree settings to platdata. With of-platdata we would not normally allocate the platdata since it is provided by the U_BOOT_DEVICE() declaration. However this is inconvenient since the of-platdata struct is closely tied to the device tree properties. It is unlikely to exactly match the platdata needed by the driver. In fact a useful approach is to declare platdata in the driver like this: struct r3288_mmc_platdata { struct dtd_rockchip_rk3288_dw_mshc of_platdata; /* the 'normal' fields go here */ }; In this case we have dt_platadata available, but the normal fields are not present, since ofdata_to_platdata() is never called. In fact driver model doesn't allocate any space for the 'normal' fields, since it sees that there is already platform data attached to the device. To make this easier, adjust driver model to allocate the full size of the struct (i.e. platdata_auto_alloc_size from the driver) and copy in the of-platdata. This means that when the driver's bind() method is called, the of-platdata will be present, followed by zero bytes for the empty 'normal field' portion. A new DM_FLAG_OF_PLATDATA flag is available that indicates that the platdata came from of-platdata. When the allocation/copy happens, the DM_FLAG_ALLOC_PDATA flag will be set as well. The dtoc tool is updated to output the platdata_size field, since U-Boot has no other way of knowing the size of the of-platdata struct. Signed-off-by: Simon Glass <sjg@chromium.org>
| * dtoc: Ignore the u-boot, dm-pre-reloc propertySimon Glass2016-07-14-0/+1
| | | | | | | | | | | | This property is not useful for of-platdata, so omit it. Signed-off-by: Simon Glass <sjg@chromium.org>
| * Only build the libfdt python module if 'swig' is availableSimon Glass2016-07-14-1/+4
| | | | | | | | | | | | | | When swig is not available, we can still build correctly. So make this optional. Add a comment about how to enable this build. Signed-off-by: Simon Glass <sjg@chromium.org>
| * dm: Add a more efficient libfdt librarySimon Glass2016-07-14-0/+191
| | | | | | | | | | | | | | | | Add a Python version of the libfdt library which contains enough features to support the dtoc tool. This is only a very bare-bones implementation. It requires the 'swig' to build. Signed-off-by: Simon Glass <sjg@chromium.org>
| * dm: Add a tool to generate C code from a device treeSimon Glass2016-07-14-0/+392
| | | | | | | | | | | | | | This tool can produce C struct definitions and C platform data tables. This is used to support the of-platdata feature. Signed-off-by: Simon Glass <sjg@chromium.org>
| * dm: Add a library to provide simple device-tree accessSimon Glass2016-07-14-0/+294
| | | | | | | | | | | | | | This Python library provides a way to access the contents of the device tree. It uses fdtget, so is inefficient for larger device tree files. Signed-off-by: Simon Glass <sjg@chromium.org>
* | mkimage: fix missing break for -p switchTeddy Reed2016-07-14-0/+1
| | | | | | | | | | | | Signed-off-by: Teddy Reed <teddy.reed@gmail.com> Reported-by: Coverity (CID: 150277) Reviewed-by: Tom Rini <trini@konsulko.com>
* | tools: Correct error handling in fit_image_process_hash()Simon Glass2016-07-14-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We should not be returning -1 as an error code. This can mask a situation where we run out of space adding things to the FIT. By returning the correct error in this case (-ENOSPC) it can be handled by the higher-level code. This may fix the error reported by Tom Van Deun here: https://www.mail-archive.com/u-boot@lists.denx.de/msg217417.html although I am not sure as I cannot actually repeat it. Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Tom Van Deun <tom.vandeun@wapice.com> Reviewed-by: Teddy Reed <teddy.reed@gmail.com>
* | tools: Add an error code when fit_handle_file() failsSimon Glass2016-07-14-2/+2
| | | | | | | | | | | | | | | | The error code may provide useful information for debugging. Add it to the error string. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Teddy Reed <teddy.reed@gmail.com>
* | mkimage: Show item lists for all categoriesSimon Glass2016-07-14-3/+9
| | | | | | | | | | | | | | | | | | Update the error-handling code for -A, -C and -O to show a list of valid options when an invalid one is provided. Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Vinoth Eswaran <evinoth1206@gmail.com> Reviewed-by: Tom Rini <trini@konsulko.com>
* | mkimage: Use generic code for showing an 'image type' errorSimon Glass2016-07-14-43/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | The existing error code only displays image types which are claimed by a particular U_BOOT_IMAGE_TYPE() driver. But this does not seem correct. The mkimage tool should support all image types, so it makes sense to allow creation of images of any type with the tool. When an incorrect image type is provided, use generic code to display the error. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
* | mkimage: Allow display of a list of any image header categorySimon Glass2016-07-14-0/+43
| | | | | | | | | | | | | | | | | | Add a generic function which can display a list of items in any category. This will allow displaying of images for the -A, -C, -O and -T flags. At present only -T is supported. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
* | image: Correct auto-fit architecture property nameSimon Glass2016-07-14-1/+2
| | | | | | | | | | | | | | | | | | The fit_write_images() function incorrectly uses the long name for the architecture. This cannot be parsed with the FIT is read. Fix this by using the short name instead. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
* | mkimage: Drop blank line before main()Simon Glass2016-07-14-1/+0
| | | | | | | | | | | | | | This is not needed. Drop it. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
* | mkimage: Drop premature setting of params.fit_image_typeSimon Glass2016-07-14-1/+0
| | | | | | | | | | | | | | | | There is no need to set params.fit_image_type while parsing the arguments. It is set up later anyway. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>