summaryrefslogtreecommitdiff
path: root/tools
AgeCommit message (Collapse)Author
2017-05-10rockchip: mkimage: clarify header0 initialisationPhilipp Tomsich
This change set adds documentation to the header0 initialisation and improves readability for the calculations of various offsets/lengths. As the U-Boot SPL stage doesn't use any payload beyond what is covered by init_size, we no longer add RK_MAX_BOOT_SIZE to init_boot_size. Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Acked-by: Simon Glass <sjg@chromium.org>
2017-05-10rockchip: mkimage: rksd: pad SD/MMC images to a full blocksizePhilipp Tomsich
Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Acked-by: Simon Glass <sjg@chromium.org>
2017-05-10rockchip: mkimage: Update comments for header sizePhilipp Tomsich
The calculation of the variable header size in rkcommon_vrec_header had been update twice in the earlier series (introducing boot0-style images to deal with the alignment of the first instruction in 64bit binaries). Unfortunately, I didn't update the comment twice (so it remained out-of-date). This change brings the comment back in-sync with what the code is doing. Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Acked-by: Simon Glass <sjg@chromium.org>
2017-05-10rockchip: mkimage: rewrite padding calculation for SD/MMC and SPI imagesPhilipp Tomsich
In (first) breaking and (then) fixing the rkspi tool, I realised that the calculation of the required padding (for the header-size and the 2K-in-every-4K SPI layout) was not as self-explainatory as it could have been. This change rewrites the code (using new, common functions in rkcommon.c) and adds verbose in-line comments to ensure that we won't fall into the same pit in the future... Tested on the RK3399 (with has a boot0-style payload) with SD/MMC and SPI. Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Acked-by: Simon Glass <sjg@chromium.org>
2017-05-10rockchip: mkimage: rkspi: include the header sector in the SPI size calculationPhilipp Tomsich
Our earlier change broke the generation of SPI images, by excluding the 2K used for header0 from the size-calculation. This commit makes sure that these are included before calculating the required total size (including the padding from the 2K-from-every-4K conversion). Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Acked-by: Simon Glass <sjg@chromium.org>
2017-05-10mkimage: rockchip: add support for rk3328Kever Yang
Add support for rk3328 package header in mkimage tool. Signed-off-by: Kever Yang <kever.yang@rock-chips.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-05-08tools: moveconfig: cleanup README entiresChris Packham
The Kconfig description replaces the description in the README file so as options are migrated they can be removed from the README. Signed-off-by: Chris Packham <judge.packham@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-05-08tools: moveconfig: cleanup whitelist entriesChris Packham
After moving to KConfig and removing from all headers options should be removed from config_whitelist.txt so the build starts complaining if someone adds them back. Acked-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Chris Packham <judge.packham@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-05-08tools: moveconfig: extract helper function for user confirmationChris Packham
Avoid repetitive code dealing with asking the user for confirmation. Signed-off-by: Chris Packham <judge.packham@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-05-05tools: sunxi: avoid read after end of stringxypron.glpk@gmx.de
The evaluation of option -c is incorrect: According to the C99 standard endptr in the first strtol is always set as &endptr is not NULL. So the first part of the or condition is always true. If all digits in optarg are valid endptr will point to the closing \0 and the second strtol will read beyond the end of the string optarg points to. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
2017-05-05relocate-rela: add missing va_end()xypron.glpk@gmx.de
va_start must always be matched by va_end. The problem was indicated by cppcheck. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2017-04-27rockchip: mkimage: remove (left-over) assignment w/o effect [coverity]Philipp Tomsich
An assignment (of a value to itself) was left over (after removing and addition from the line) from moving the common padding code into rkcommon_vrec_header. This change removes this to avoid a spurious warning in static code analysis (i.e. Coverity). Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Reported-by: Coverity (CID: 161418) Reviewed-by: Tom Rini <trini@konsulko.com>
2017-04-18tools/env: avoid memory leak in fw_setenvxypron.glpk@gmx.de
If realloc fails we should release the old buffer. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-04-18buildman: Allow 'gnueabihf' toolchains for ARMTom Rini
Many toolchains for ARM use the 'gnueabihf' suffix rather than just 'gnueabi', so allow these to be used, but with a lower priority than 'gnueabi' ones. Cc: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-04-18tools: moveconfig: remove GCC prefix of obsolete architectureMasahiro Yamada
Recently, U-Boot removed support for these architectures. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-04-14buildman: Translate more strings to latin-1Tom Rini
When writing out some of our results we may now have UTF-8 characters in there as well. Translate these to latin-1 and ignore any errors (as this is for diagnostic and given the githash anything else can be reconstructed by the user. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com>
2017-04-13Merge git://git.denx.de/u-boot-dmTom Rini
Here with some DM changes as well as the long-standing AT91 DM/DT conversion patches which I have picked up via dm.
2017-04-13buildman: Handle commit subjects containing unicodeSimon Glass
One of these has crept in in this commit: 40a808f1 ARCv2: SLC: Make sure busy bit is set properly on SLC flushing Adjust buildman to handle it. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-04-13tools: allow to override pythonStefano Babic
Not force to use python from PATH. Issue was noted when building with Yocto, because python from the distro is always taken instead of python-native built during Yocto process. Signed-off-by: Stefano Babic <sbabic@denx.de> CC: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-04-13fdtgrep: Cope with the /aliases node being lastSimon Glass
With skeleton.dtsi being dropped it is more likely that the /aliases node will be last in the device tree. Update fdtgrep to handle this. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2017-04-13dtoc: Decode val if it's a byte stringGeorge McCollister
With Python 3.5.2 encode will throw an exception if val is a byte array. Decode it to a string first. This assumes it's utf-8, if it's not valid utf-8 it will throw an exception. Signed-off-by: George McCollister <george.mccollister@gmail.com> Acked-by: Simon Glass <sjg@chromium.org>
2017-04-13patman: Convert byte arrays to stringsGeorge McCollister
os.read() returns a byte array in Python 3.5.2 and needs to be converted into a string. Check if the returned value is an instance of bytes and if it is decode it as a utf-8 string. If it is not a utf-8 encoded string the decoding may fail with an exception. Prior to this fix the comparisions check data == "" would fail when data was b'' and would cause an infinite memory leaking loop. joins would also fail with an exception below but due to the infinite loop it never made it that far. Signed-off-by: George McCollister <george.mccollister@gmail.com> Acked-by: Simon Glass <sjg@chromium.org>
2017-04-12env: fix memory leak in fw_env routinesStefano Babic
fw_env_open allocates buffers to store the environment, but these buffers are never freed. This becomes quite nasty using the fw_ tools as library, because each access to the environment (even just reading a variable) generates a memory leak equal to the size of the environment. Fix this renaming fw_env_close() as fw_env_flush(), because the function really flushes the environment from RAM to storage, and add a fw_env_close function to free the allocated resources. Signed-off-by: Stefano Babic <sbabic@denx.de>
2017-04-12env: add a version number to check APIStefano Babic
Changes in the environment library are difficult to tracked by programs using the library. Add simply an API version number that must be increased each time when the API is changed. This can be detected and a program can work with different versions of the library. Signed-off-by: Stefano Babic <sbabic@denx.de>
2017-04-12env: split fw_env.h in public and private partsStefano Babic
Move U-Boot private data into a separate file. This lets export fw_env.h to be used by external programs that want to change the environment using the library built in tools/env. Signed-off-by: Stefano Babic <sbabic@denx.de>
2017-04-12Rename aes.h to uboot_aes.hStefano Babic
aes.h is a too generic name if this file can be exported and used by a program. Rename it to avoid any conflicts with other files (for example, from openSSL). Signed-off-by: Stefano Babic <sbabic@denx.de>
2017-04-10tools: binman: Add missing filenames for various x86 rom testsBin Meng
With recent changes, some x86-specific rom tests of binman fail to run. Fix it by adding missing filenames in corresponding entries. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-04-10binman: Remove hard-coded file name for x86 flash-descriptor & intel-meStefan Roese
Now that we have added file names from Kconfig in x86 u-boot.dtsi, update binman to avoid using hard-coded names. Signed-off-by: Stefan Roese <sr@denx.de> Cc: Bin Meng <bmeng.cn@gmail.com> Cc: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2017-04-07tools: sunxi: Add spl image builderMaxime Ripard
This program generates raw SPL images that can be flashed on the NAND with the ECC and randomizer properly set up. This has been copied (and tweaked to find the right headers) from the sunxi-tools (https://github.com/linux-sunxi/sunxi-tools) upstream repository, commit 1c3a6ca5. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Jagan Teki <jagan@openedev.com>
2017-04-05rockchip: mkimage: update rkimage to support pre-padded payloadsPhilipp Tomsich
To simplify the creation of AArch64 SPL images for the RK3399, we use the ENABLE_ARM_SOC_BOOT0_HOOK option and prepend 4 bytes of padding at the start of the text section. This makes it easy for mkimage to rewrite this word with the 'RK33' boot magic. This change brings logic to calculate the header size and allocate the header back in sync. For the RK3399 we now limit the header to before the payload (i.e. the 'header0' and the padding up to the actual image) and overwrite the first word (inserted by the boot0-hook for this purpose) with the 'RK33' magic in-place. X-AffectedPlatforms: RK3399-Q7 Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Tested-by: Klaus Goger <klaus.goger@theobroma-systems.com>
2017-04-05rockchip: mkimage: pad the header to 8-bytes (using a 'nop') for RK3399Philipp Tomsich
The RK3399 boot code (running as AArch64) poses a bit of a challenge for SPL image generation: * The BootROM will start execution right after the 4-byte header (at the odd instruction word loaded into SRAM at 0xff8c2004, with the 'RK33' boot magic residing at 0xff8c2000). * The default padding (during ELF generation) for AArch64 is 0x0, which is an illegal instruction and the .text section needs to be naturally aligned (someone might locate a 64bit constant relative to the section start and unaligned loads trigger a fault for all privileged modes of an ARMv8)... so we can't simply define the CONFIG_SPL_TEXT_BASE option to the odd address (0xff8c2004). * Finally, we don't want to change the values used for padding of the SPL .text section for all ARMv8 targets to the instruction word encoding 'nop', as this would affect all padding in this section and might hide errors that would otherwise quickly trigger an illegal insn exception. To deal with this situation, we modify the rkimage generation to - understand the fact that the RK3399 needs to pad the header to an 8 byte boundary using an AArch64 'nop' - the necessary logic to adjust the header_size (which controls the location where the payload is copied into the image) and to insert this padding (AArch64 insn words are always little-endian) into the image following the 4-byte header magic. X-AffectedPlatforms: RK3399-Q7 Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Tested-by: Klaus Goger <klaus.goger@theobroma-systems.com>
2017-04-05rockchip: mkimage: simplify start/size calculation for rc4_encodePhilipp Tomsich
The RC4 encoding works on full blocks, but the calculation of the starting offset and size are needlessly complicated by using a reference value known to be offset into a block by the size of the header and then correcting for the (hard-coded) size of the header (i.e. 4 bytes). We change this over to use the RK_SPL_HDR_START directly (which is known to be on a block boundary). X-AffectedPlatforms: RK3399-Q7 Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Tested-by: Klaus Goger <klaus.goger@theobroma-systems.com>
2017-03-28tools: plbimage support generate rcw fileyuan linyu
some system will not generate pbl format u-boot, but require rcw. Signed-off-by: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn> Reviewed-by: Alison Wang <alison.wang@nxp.com> Reviewed-by: York Sun <york.sun@nxp.com>
2017-03-22dtoc: make ScanTree recurse into subnodesPhilipp Tomsich
Previously, dtoc could only process the top-level nodes which led to device nodes in hierarchical trees to be ignored. E.g. the mmc0 node in the following example would be ignored, as only the soc node was processed: / { soc { mmc0 { /* ... */ }; }; }; This introduces a recursive helper method ScanNode, which is used by ScanTree to recursively parse the entire tree hierarchy. Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-03-20Pass empty CFLAGS on invocation of libfdt/setup.pyMax Filippov
When building u-boot tools in cross-build environment CFLAGS environment variable set up for target is taken into an account when building code for host. Make it empty on invocation of python. This fixes the following build errors when cross-compiling for xtensa: cc1: error: unrecognized command line option "-mlongcalls" cc1: error: unrecognized command line option "-mauto-litpools" Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2017-03-19Merge branch 'master' of git://www.denx.de/git/u-boot-imxTom Rini
Signed-off-by: Tom Rini <trini@konsulko.com> Conflicts: configs/bk4r1_defconfig configs/colibri_vf_defconfig configs/pcm052_defconfig include/configs/colibri_vf.h include/configs/pcm052.h
2017-03-19tools: imximage: add set bit commandPeng Fan
Add set bit command support. Usage: SET_BIT 4 [address] [bitmask] Signed-off-by: Peng Fan <peng.fan@nxp.com> Cc: Stefano Babic <sbabic@denx.de> Reviewed-by: Stefano Babic <sbabic@denx.de>
2017-03-16rockchip: mkimage: Add support rk3188 serialHeiko Stübner
Add the entry for the rk3188 requiring rc4-encryption of the SPL. Signed-off-by: Heiko Stuebner <heiko@sntech.de> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2017-03-16rockchip: mkimage: Allow encoding of loader code in spl imagesHeiko Stübner
Rockchip SoCs allow the spl code to be rc4-encoded, not only the image header, but only newer SoCs allow this encoding to be disabled. The rk3188 is not part of those and requires its boot code to be rc4-encoded with the regular key. So add the ability to do this encoding via a setting on a per-soc basis when building spl images. Signed-off-by: Heiko Stuebner <heiko@sntech.de> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Kever Yang <kever.yang@rock-chips.com> Tested-by: Kever Yang <kever.yang@rock-chips.com>
2017-03-16dm: allow limiting pre-reloc markings to spl or tplHeiko Stübner
Right now the u-boot,dm-pre-reloc flag will make each marked node always appear in both spl and tpl. But systems needing an additional tpl might have special constraints for each, like the spl needing to be very tiny. So introduce two additional flags to mark nodes for only spl or tpl environments and introduce a function dm_fdt_pre_reloc to automate the necessary checks in code instances checking for pre-relocation flags. The behaviour of the original flag stays untouched and still marks a node for both spl and tpl. Signed-off-by: Heiko Stuebner <heiko@sntech.de> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Kever Yang <kever.yang@rock-chips.com>
2017-03-15tools: fix cross-compiling tools when HOSTCC is overriddenMasahiro Yamada
Richard reported U-Boot tools issues in OpenEmbedded/Yocto project. OE needs to be able to change the default compiler. If we pass in HOSTCC through the make command, it overwrites all HOSTCC instances, including ones in tools/Makefile and tools/env/Makefile, which breaks "make cross_tools" and "make env", respectively. Add "override" directives to avoid overriding HOSTCC instances that really need to point to the cross-compiler. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reported-by: Richard Purdie <richard.purdie@linuxfoundation.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-03-15tools: omapimage: Fix 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 generates a gp header only with size of the image as size field. Fix it Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
2017-03-12tools: binman: change shebang from python into python2Jörg Krause
This tool does not work with Python 3. Change the shebang to make sure the script is run by a Python 2 interpreter. Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
2017-03-10kconfiglib.py: Kludge in 'imply' supportTom Rini
Currently upstream does not yet understand the imply keyword. For what we use kconfiglib.py for today, this is OK. We only need to be able to evaluate in order to make boards.cfg and none of those choices will depend on how imply evaluates out. Signed-off-by: Tom Rini <trini@konsulko.com>
2017-03-09tools: Remove CONFIG_SYS_TEXT_BASE in MakefilePatrick Delaunay
This define is not used in tools sources and can be removed to avoid unnecessary link between tools and defconfig Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-02-17tools: kwboot: don't adjust destaddr when patching the imageChris Packham
Commit 94084eea3bd3 ("tools: kwbimage: Fix dest addr") changed kwbimage to do this adjustment. So now the adjustment in kwboot is not needed (and would prevent UART booting for images generated by the new kwbimage). Remove the destaddr adjustment in kwboot. Signed-off-by: Chris Packham <judge.packham@gmail.com> Signed-off-by: Stefan Roese <sr@denx.de>
2017-02-17tools: kwbimage: Fix unchecked return value and fd leakMario Six
The return value of fstat was not checked in kwbimage, and in the case of an error, the already open file was not closed. Fix both errors. Reported-by: Coverity (CID: 155971) Reported-by: Coverity (CID: 155969) Signed-off-by: Mario Six <mario.six@gdsys.cc> Signed-off-by: Stefan Roese <sr@denx.de>
2017-02-09Merge branch 'master' of git://git.denx.de/u-boot-netTom Rini
2017-02-08Merge git://git.denx.de/u-boot-dmTom Rini
2017-02-08cmd: rework "license" commandMasahiro Yamada
The previous commit ("add a new command to show .config contents") improves the basic infrastructure of "embed a compressed file into the U-Boot image, and print it by a command". The same pattern for the "license" command. This commit reworks the command to improve the following: [1] Improve log style Kbuild style log GZIP cmd/license_data.gz CHK cmd/license_data_gz.h UPD cmd/license_data_gz.h CHK cmd/license_data_size.h UPD cmd/license_data_size.h instead of the bare Make log: cat ./Licenses/gpl-2.0.txt | gzip -9 -c | \ tools/bin2header license_gzip > ./include/license.h [2] Collect related code into the "cmd" directory Prior to this commit, the license.h was created by tools/Makefile, placed under the "include" directory, included from cmd/license.c, and deleted by the top-level Makefile. It is not a good idea to scatter related code. [3] Drop the fixed-malloc size LICENSE_MAX Just allocate the minimum required size of buffer because we know the size of the original gpl-2.0.txt. [4] Fix more issues Terminate the buffer with zero to prevent puts() from over-running. Add "static" to do_license. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Simon Glass <sjg@chromium.org>