03 Apr, 2019

1 commit

  • Parts of the code are using C99 constructs (such as variables declared
    inside loops), but also GNU extensions (such as typeof), so using
    -std=gnu99 is necessary to build with older versions of gcc that don't
    default to building with gnu99.

    It fixes the following build failure:

    ./tools/../lib/crc16.c: In function "crc16_ccitt":
    ./tools/../lib/crc16.c:70:2: error: "for" loop initial declarations are only allowed in C99 mode
    for (int i = 0; i < len; i++)
    ^
    ./tools/../lib/crc16.c:70:2: note: use option -std=c99 or -std=gnu99 to compile your code

    when building the host tools with gcc 4.7.

    Signed-off-by: Thomas Petazzoni
    Reviewed-by: Philipp Tomsich

    Thomas Petazzoni
     

01 Jan, 2019

2 commits


16 Dec, 2018

1 commit

  • The motivation for this is to allow distributions to distribute all
    possible tools in a generic way, avoiding the need of specific tools
    building for each machine.

    Especially on OpenEmbedded / Yocto Project ecosystem, it is very
    common each BSP to end providing their specific tools when they need
    to generate images for some SoC (e.g MX23 / MX28 in meta-freescale
    case).

    Using this, we can package the tools doing:

    $: make tools-only_defconfig
    $: make tools-only

    Signed-off-by: Otavio Salvador
    [trini: Add MAINTAINERS entry for myself, add to .travis.yml, make
    U-Boot itself buildable to not trip up other frameworks]
    Signed-off-by: Tom Rini

    Otavio Salvador
     

09 Dec, 2018

1 commit

  • The CRC16-CCITT checksum function is useful for space-constrained
    applications (such as obtaining a checksum across a 2KBit or 4KBit
    EEPROM) in boot applications. It has not been accessible from boot
    scripts until now (due to not having a dedicated command and not being
    supported by the hash infrstructure) limiting its applicability
    outside of custom commands.

    This adds the CRC16-CCITT (poly 0x1021, init 0x0) algorithm to the
    list of available hashes and adds a new crc16_ccitt_wd_buf() to make
    this possible.

    Signed-off-by: Philipp Tomsich
    [trini: Fix building crc16.o for SPL/TPL]
    Signed-off-by: Tom Rini

    Philipp Tomsich
     

29 Nov, 2018

1 commit


22 Oct, 2018

1 commit

  • i.MX8/8X bootable image type is container type.
    The bootable image, containers a container set which supports two
    container. The 1st container is for SECO firmware, the 2nd container
    needs to include scfw, m4_0/1 image, ACore images per your requirement.

    Signed-off-by: Peng Fan

    Peng Fan
     

11 Jul, 2018

1 commit

  • This adds a new config value FIT_SIGNATURE_MAX_SIZE, which controls the
    max size of a FIT header's totalsize field. The field is checked before
    signature checks are applied to protect from reading past the intended
    FIT regions.

    This field is not part of the vboot signature so it should be sanity
    checked. If the field is corrupted then the structure or string region
    reads may have unintended behavior, such as reading from device memory.
    A default value of 256MB is set and intended to support most max storage
    sizes.

    Suggested-by: Simon Glass
    Signed-off-by: Teddy Reed
    Reviewed-by: Simon Glass

    Teddy Reed
     

11 May, 2018

1 commit

  • The officially described way to generate boot.bin files for ZynqMP is to
    describe the contents of the target binary using a file of the "bif"
    format. This file then links to other files that all get packed into a
    bootable image.

    This patch adds support to read such a .bif file and generate a respective
    ZynqMP boot.bin file that can include the normal image and pmu files, but
    also supports image partitions now. This makes it a handy replacement for
    the proprietary "bootgen" utility that is currently used to generate
    boot.bin files with FSBL.

    Signed-off-by: Alexander Graf
    Signed-off-by: Michal Simek

    Alexander Graf
     

07 May, 2018

1 commit

  • When U-Boot started using SPDX tags we were among the early adopters and
    there weren't a lot of other examples to borrow from. So we picked the
    area of the file that usually had a full license text and replaced it
    with an appropriate SPDX-License-Identifier: entry. Since then, the
    Linux Kernel has adopted SPDX tags and they place it as the very first
    line in a file (except where shebangs are used, then it's second line)
    and with slightly different comment styles than us.

    In part due to community overlap, in part due to better tag visibility
    and in part for other minor reasons, switch over to that style.

    This commit changes all instances where we have a single declared
    license in the tag as both the before and after are identical in tag
    contents. There's also a few places where I found we did not have a tag
    and have introduced one.

    Signed-off-by: Tom Rini

    Tom Rini
     

23 Mar, 2018

1 commit


20 Mar, 2018

1 commit


05 Mar, 2018

1 commit


29 Jan, 2018

2 commits

  • libfdt_env.h is supposed to provide system-dependent defines.

    scripts/dtc/libfdt/libfdt_env.h from upstream DTC is suitable
    for user-space, so we should use this for USE_HOSTCC case.

    For compiling U-Boot, we need to override such system-dependent
    defines, so use imported from Linux.

    selects a proper one. Maybe, we should split header
    inclusion completely, but I do not want too many patches at one.

    I can rip off the include/libfdt_env.h from HOST_EXTRACFLAGS.

    Signed-off-by: Masahiro Yamada
    Reviewed-by: Simon Glass

    Masahiro Yamada
     
  • The only difference between scripts/dtc/libfdt/fdt_rw.c and
    lib/libfdt/fdt_rw.c is fdt_remove_unused_strings().

    It is only used by fdtgrep, so we do not need to compile it for U-Boot
    image. Move it to tools/libfdt/fdw_rw.c so that lib/libfdt/fdt_rw.c
    can be a wrapper of scripts/dtc/libfdt/fdt_rw.c.

    Signed-off-by: Masahiro Yamada
    Reviewed-by: Simon Glass

    Masahiro Yamada
     

23 Jan, 2018

1 commit

  • 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
    Signed-off-by: Alexander Graf

    Heinrich Schuchardt
     

12 Jan, 2018

1 commit

  • 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
    Signed-off-by: Rick Chen
    Signed-off-by: Rick Chen
    Signed-off-by: Greentime Hu

    Rick Chen
     

04 Dec, 2017

1 commit


17 Nov, 2017

2 commits

  • 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

    Masahiro Yamada
     
  • The pylibfdt is used by dtoc (and, indirectly by binman), but there
    is no reason why it must be generated in the tools/ directory.

    Recently, U-Boot switched over to the bundled DTC, and the directory
    structure under scripts/dtc/ now mirrors the upstream DTC project.
    So, scripts/dtc/pylibfdt is the best location.

    I also rewrote the Makefile in a cleaner Kbuild style.

    The scripts from the upstream have been moved as follows:

    lib/libfdt/pylibfdt/setup.py -> scripts/dtc/pylibfdt/setup.py
    lib/libfdt/pylibfdt/libfdt.i -> scripts/dtc/pylibfdt/libfdt.i_shipped

    The .i_shipped is coped to .i during building because the .i must be
    located in the objtree when we build it out of tree.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

16 Oct, 2017

1 commit


24 Sep, 2017

1 commit


04 Sep, 2017

2 commits


20 Aug, 2017

1 commit

  • On some systems `python` is `python3` (for instance, Archlinux). The
    `PYTHON` variable can be used to point to `python2` to have a successful
    build.

    The use of `PYTHON` is currently limited in the Makefile and needs to be
    extended in other places:

    First, pylibfdt is required to be a Python 2 binding (binman imports
    pylibfdt and is only compatible Python 2), so its setup.py needs to be
    called accordingly. An alternative would be to change the libfdt
    setup.py shebang to python2, but the binding is actually portable. Also,
    it would break on system where there is no such thing as `python2`.

    Secondly, the libfdt import checks need to be done against Python 2 as
    well since the Python 2 compiled modules (in this case _libdft.so) can
    not be imported from Python 3.

    Note on the libfdt imports: "@if ! PYTHONPATH=tools $(PYTHON) -c 'import
    libfdt'; then..." is probably simpler than the currently sub-optimal
    pipe.
    Reviewed-by: Jonathan Gray

    Clément Bœsch
     

15 Aug, 2017

1 commit


26 Jul, 2017

1 commit

  • U-Boot has up until now built with -fpic for the MIPS architecture,
    producing position independent code which uses indirection through a
    global offset table, making relocation fairly straightforward as it
    simply involves patching up GOT entries.

    Using -fpic does however have some downsides. The biggest of these is
    that generated code is bloated in various ways. For example, function
    calls are indirected through the GOT & the t9 register:

    8f998064 lw t9,-32668(gp)
    0320f809 jalr t9

    Without -fpic the call is simply:

    0f803f01 jal be00fc04

    This is more compact & faster (due to the lack of the load & the
    dependency the jump has on its result). It is also easier to read &
    debug because the disassembly shows what function is being called,
    rather than just an offset from gp which would then have to be looked up
    in the ELF to discover the target function.

    Another disadvantage of -fpic is that each function begins with a
    sequence to calculate the value of the gp register, for example:

    3c1c0004 lui gp,0x4
    279c3384 addiu gp,gp,13188
    0399e021 addu gp,gp,t9

    Without using -fpic this sequence no longer appears at the start of each
    function, reducing code size considerably.

    This patch switches U-Boot from building with -fpic to building with
    -fno-pic, in order to gain the benefits described above. The cost of
    this is an extra step during the build process to extract relocation
    data from the ELF & write it into a new .rel section in a compact
    format, plus the added complexity of dealing with multiple types of
    relocation rather than the single type that applied to the GOT. The
    benefit is smaller, cleaner, more debuggable code. The relocate_code()
    function is reimplemented in C to handle the new relocation scheme,
    which also makes it easier to read & debug.

    Taking maltael_defconfig as an example the size of u-boot.bin built
    using the Codescape MIPS 2016.05-06 toolchain (gcc 4.9.2, binutils
    2.24.90) shrinks from 254KiB to 224KiB.

    Signed-off-by: Paul Burton
    Cc: Daniel Schwierzeck
    Cc: u-boot@lists.denx.de
    Reviewed-by: Daniel Schwierzeck
    Tested-by: Daniel Schwierzeck

    Paul Burton
     

23 Jul, 2017

1 commit

  • FreeBSD recently switch to it's BSDL dtc. While it support most of the
    features of the GPL one it still lacks the incbin directive.
    Add the possibility to specify which dtc we want to use for compiling dts
    and generating fit image.

    Signed-off-by: Emmanuel Vadot
    Acked-by: Simon Glass

    Emmanuel Vadot
     

03 Jun, 2017

4 commits


14 Apr, 2017

1 commit

  • 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
    CC: Simon Glass
    Reviewed-by: Simon Glass

    Stefano Babic
     

07 Apr, 2017

1 commit

  • 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
    Acked-by: Boris Brezillon
    Reviewed-by: Hans de Goede
    Reviewed-by: Jagan Teki

    Maxime Ripard
     

21 Mar, 2017

1 commit

  • 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
    Reviewed-by: Simon Glass
    Reviewed-by: Tom Rini

    Max Filippov
     

15 Mar, 2017

1 commit

  • 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
    Reported-by: Richard Purdie
    Reviewed-by: Simon Glass

    Masahiro Yamada
     

10 Mar, 2017

1 commit


10 Feb, 2017

1 commit


09 Feb, 2017

1 commit

  • 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
    Reviewed-by: Simon Glass

    Masahiro Yamada
     

08 Feb, 2017

1 commit