summaryrefslogtreecommitdiff
path: root/tools
AgeCommit message (Collapse)Author
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>
2017-02-08patman: Handle non-ascii characters in namesChris Packham
When gathering addresses for the Cc list patman would encounter a UnicodeDecodeError due to non-ascii characters in the author name. Address this by explicitly using utf-8 when building the Cc list. Signed-off-by: Chris Packham <judge.packham@gmail.com> Acked-by: Simon Glass <sjg@chromium.org>
2017-02-08buildman: Allow showing the list of boards with -nSimon Glass
As well as showing the number of boards, allow showing the actual list of boards that would be built, if -v is provided. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-02-08patman: Format checkpatch messages for IDE throwbackSimon Glass
It is convenient to be able to deal with checkpatch warnings in the same way as build warnings. Tools such as emacs and kate can quickly locate the source file and line automatically. To achieve this, adjust the format to match the C compiler, and output to stderr. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-02-08dtoc: Replace dot with underscore to avoid compiler errorsSimon Glass
If there is a '.' in a compatible string, then dtoc will produce a struct with a name containing a '.'. This won't work, so replace it with '_'. Also add a suitable test to the sandbox device tree to catch this. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-02-07tools: Add tool to add crc8 to a mac addressoliver@schinagl.nl
This patch adds a little tool that takes a generic MAC address and generates a CRC byte for it. The output is the full MAC address without any separators, ready written into an EEPROM. Signed-off-by: Olliver Schinagl <o.schinagl@ultimaker.com> Signed-off-by: Olliver Schinagl <oliver@schinagl.nl> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2017-02-07tools: Allow crc8 to be usedoliver@schinagl.nl
This patch enables crc8 to be used from within the tools directory using u-boot/crc.h. Signed-off-by: Olliver Schinagl <o.schinagl@ultimaker.com> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com> Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
2017-02-07tools: binman: Handle optional microcode case in SPL imageBin Meng
On platforms which do not require microcode in SPL, handle such case like U-Boot proper. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-02-07tools: binman: Call correct init for Entry_u_boot_spl_with_ucode_ptrBin Meng
u_boot_spl_with_ucode_ptr is derived from u_boot_with_ucode_ptr, hence it should call its parent's init. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-02-01Merge branch 'master' of git://www.denx.de/git/u-boot-imxTom Rini
2017-02-01arm: mvebu: Implement secure bootMario Six
The patch implements secure booting for the mvebu architecture. This includes: - The addition of secure headers and all needed signatures and keys in mkimage - Commands capable of writing the board's efuses to both write the needed cryptographic data and enable the secure booting mechanism - The creation of convenience text files containing the necessary commands to write the efuses The KAK and CSK keys are expected to reside in the files kwb_kak.key and kwb_csk.key (OpenSSL 2048 bit private keys) in the top-level directory. Signed-off-by: Reinhard Pfau <reinhard.pfau@gdsys.cc> Signed-off-by: Mario Six <mario.six@gdsys.cc> Reviewed-by: Stefan Roese <sr@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Stefan Roese <sr@denx.de>
2017-02-01tools: kwbimage: Refactor line parsing and fix errorMario Six
The function image_create_config_parse_oneline is pretty complex, and since more parameters will be added to support secure booting, we refactor the function to make it more readable. Also, when a line contained just a keyword without any parameters, strtok_r returned NULL, which was then indiscriminately fed into atoi, causing a segfault. To correct this, we add a NULL check before feeding the extracted token to atoi, and print an error message in case the token is NULL. Signed-off-by: Mario Six <mario.six@gdsys.cc> Reviewed-by: Stefan Roese <sr@denx.de> Signed-off-by: Stefan Roese <sr@denx.de>
2017-02-01tools: kwbimage: Factor out add_binary_header_v1Mario Six
In preparation of adding the creation of secure headers, we factor the add_binary_header_v1 function out of the image_create_v1 function. Signed-off-by: Mario Six <mario.six@gdsys.cc> Reviewed-by: Stefan Roese <sr@denx.de> Signed-off-by: Stefan Roese <sr@denx.de>
2017-02-01tools: kwbimage: Remove unused parameterMario Six
The parameter 'params' of the image_headersz_v1 function is never used by the function. Hence, remove it. Signed-off-by: Mario Six <mario.six@gdsys.cc> Reviewed-by: Stefan Roese <sr@denx.de> Signed-off-by: Stefan Roese <sr@denx.de>
2017-02-01tools: kwbimage: Reduce scope of variablesMario Six
This patch reduces the scope of some variables. Signed-off-by: Mario Six <mario.six@gdsys.cc> Reviewed-by: Stefan Roese <sr@denx.de> Signed-off-by: Stefan Roese <sr@denx.de>