01 Apr, 2020

1 commit


03 Dec, 2019

2 commits


12 Aug, 2019

1 commit


29 Jul, 2019

1 commit

  • Upcoming patches want to add decompression to use cases that are no
    longer directly related to booting. It makes sense to retain a single
    decompression routine, but it should no longer be in bootm.c (which is
    not compiled for all configurations). This patch moves
    bootm_decomp_image() to image.c and renames it to image_decomp() in
    preparation of those upcoming patches.

    Signed-off-by: Julius Werner
    Reviewed-by: Simon Goldschmidt
    [trini: Fix warning around handle_decomp_error being unused]
    Signed-off-by: Tom Rini

    Julius Werner
     

12 Jul, 2019

1 commit


10 May, 2019

1 commit

  • Due to some mistakes in the source code, it was not possible to really
    turn FIT support off. This commit fixes the problem by means of the
    following changes:

    - Enclose "bootm_host_load_image" and "bootm_host_load_images" between
    checks for CONFIG_FIT_SIGNATURE, in common/bootm.c.

    - Enclose the declaration of "bootm_host_load_images" between checks for
    CONFIG_FIT_SIGNATURE, in common/bootm.h.

    - Condition the compilation and linking of fit_common.o fit_image.o
    image-host.o common/image-fit.o to CONFIG_FIT=y, in tools/Makefile.

    Signed-off-by: Carlos Santos
    [fabio: adapt for 2016.07]
    Signed-off-by: Fabio Estevam
    [Ricardo: fix conditional compilation and linking of the files mentioned above
    for 2016.07]
    Signed-off-by: Ricardo Martincoski
    [Jörg: adapt for 2019.01]
    Signed-off-by: Jörg Krause
    [Retrieved from:
    https://git.buildroot.net/buildroot/tree/package/uboot-tools/0003-Make-FIT-support-really-optional.patch]
    Signed-off-by: Fabrice Fontaine

    Fabrice Fontaine
     

24 Apr, 2019

2 commits

  • According to Android image format [1], kernel image resides at 1 page
    offset from the boot image address. Grab the magic number from there
    and allow U-Boot to handle LZ4-compressed KNL binaries instead of
    hardcoding compression type to IH_COMP_NONE. Other compression types,
    if needed, can be added later.

    Tested on H3ULCB-KF using the image detailed in [2].

    [1] Excerpt from include/android_image.h
    +-----------------+
    | boot header | 1 page
    +-----------------+
    | kernel | n pages
    +-----------------+
    | ramdisk | m pages
    +-----------------+
    | second stage | o pages
    +-----------------+

    [2] => iminfo 4c000000
    ## Checking Image at 4c000000 ...
    Android image found
    kernel size: 85b9d1
    kernel address: 48080000
    ramdisk size: 54ddbc
    ramdisk addrress: 4a180000
    second size: 0
    second address: 48000800
    tags address: 48000100
    page size: 800
    os_version: 1200012a (ver: 0.9.0, level: 2018.10)
    name:
    cmdline: buildvariant=userdebug

    Signed-off-by: Eugeniu Rosca

    Eugeniu Rosca
     
  • The cache flush of the kernel load area needs to be aligned outward to
    the DMA cache alignment. The operations are simpler if we think of this
    as aligning the start down, ALIGN_DOWN(load, ARCH_DMA_MINALIGN), and
    aligning the end up, ALIGN(load_end, ARCH_DMA_MINALIGN), and then find
    the length of the flushed region by subtracting the former from the
    latter.

    Cc: Tom Rini
    Cc: Simon Glass
    Cc: Bryan O'Donoghue
    Signed-off-by: Trent Piepho
    Reviewed-by: Simon Glass

    Trent Piepho
     

13 Feb, 2019

1 commit


02 Feb, 2019

1 commit

  • This fixes the automatic lmb initialization and reservation for boards
    with more than one DRAM bank.

    This fixes the CVE-2018-18439 and -18440 fixes that only allowed to load
    files into the firs DRAM bank from fs and via tftp.

    Found-by: Heinrich Schuchardt
    Signed-off-by: Simon Goldschmidt
    Tested-by: Heinrich Schuchardt
    Reviewed-by: Simon Glass

    Simon Goldschmidt
     

17 Jan, 2019

1 commit


15 Jan, 2019

1 commit

  • Booting an image currently sets the environment variable "fdtaddr"
    by calling into 'cmd/fdt.c'. As a result, linking U-Boot fails if
    CMD_FDT is not enabled.

    Fix this by adding 'if (CONFIG_IS_ENABLED(CMD_FDT))' to the two
    places where 'set_working_fdt_addr()' is called.

    Signed-off-by: Simon Goldschmidt

    Simon Goldschmidt
     

26 Sep, 2018

1 commit

  • When running sandbox with the new pointer sanitization we just recently
    introduced, we're running into a case with FIT images where we end up
    interpreting pointers as addresses.

    What happened is that most callers of set_working_fdt_addr() simply
    convert pointers into addresses without taking into account that they
    might be 2 separate address spaces. Fix the callers up to map their
    pointers into addresses.

    This makes sandbox tests pass for me again.

    Signed-off-by: Alexander Graf

    Alexander Graf
     

19 Jun, 2018

1 commit

  • The ARM64 has 2 MiB alignment requirement for the kernel. When using
    fitImage, this requirement may by violated, the kernel will thus be
    executed from unaligned address and fail to boot. Do what booti does
    and run booti_setup() for kernel_noload images on arm64 to obtain a
    suitable aligned address to which the image shall be relocated.

    Signed-off-by: Marek Vasut
    Cc: Bin Chen
    Cc: Masahiro Yamada
    Cc: Tom Rini

    Marek Vasut
     

03 Jun, 2018

1 commit


09 May, 2018

1 commit

  • In do_bootm_states when doing BOOTM_STATE_LOADOS we use load_end
    uninitialized and Coverity notes this now. This however leads down
    another interesting path. We pass this pointer to bootm_load_os and
    that in turn uses this uninitialized value immediately to calculate the
    flush length, and is wrong. We do not know what load_end will be until
    after bootm_decomp_image is called, so we must only set flush_len after
    that. All of this also makes it clear that the only reason we pass a
    pointer for load_end to bootm_load_os is so that we can call lmb_reserve
    on success. Rather than initialize load_end to 0 in do_bootm_states we
    can just call lmb_reserve ourself.

    Reported-by: Coverity (CID: 175572)
    Cc: Simon Glass
    Signed-off-by: Tom Rini
    Reviewed-by: Simon Glass

    Tom Rini
     

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
     

18 Apr, 2018

1 commit

  • commit b4d956f6bc0f ("bootm: Align cache flush end address correctly")
    aligns the end address of the cache flush operation to a cache-line size to
    ensure lower-layers in the code accept the range provided and flush.

    A similar action should be taken for the begin address of a cache flush
    operation. The load address may not be aligned to a cache-line boundary, so
    ensure the passed address is aligned.

    Signed-off-by: Bryan O'Donoghue
    Reported-by: Breno Matheus Lima
    Suggested-by: Tom Rini
    Cc: Simon Glass
    Tested-by: Breno Lima
    Reviewed-by: Simon Glass

    Bryan O'Donoghue
     

14 Dec, 2017

1 commit

  • This drops the limit that fpga is only loaded from FIT images for Xilinx.
    This is done by moving the 'partial' check from 'common/image.c' to
    'drivers/fpga/xilinx.c' (the only driver supporting partial images yet)
    and supplies a weak default implementation in 'drivers/fpga/fpga.c'.

    Signed-off-by: Simon Goldschmidt
    Tested-by: Michal Simek (On zcu102)
    Signed-off-by: Michal Simek

    Goldschmidt Simon
     

16 Oct, 2017

1 commit


16 Aug, 2017

5 commits


02 Oct, 2016

1 commit

  • This bug appears in b6396403 which makes u-boot unable to pass
    arguments via bootm to a standalone application without this patch.

    Steps to reproduce.

    Compile a u-boot. Use mkimage to package the standalone hello_world.bin
    file.

    e.g. For the MIPS Boston platform

    mkimage -n "hello" -A mips -O u-boot -C none -T standalone \
    -a 0xffffffff80200000 -d hello_world.bin \
    -ep 0xffffffff80200000 hello_out

    Then tftp hello_out and run it using

    boston # dhcp 192.168.154.45:hello_out
    ...
    boston # bootm $loadaddr 123 321

    Without the patch the following output is observed.

    boston # bootm $loadaddr 123 321
    Image Name: hello
    Image Type: MIPS U-Boot Standalone Program (uncompressed)
    Data Size: 1240 Bytes = 1.2 KiB
    Load Address: 80200000
    Entry Point: 80200000
    Verifying Checksum ... OK
    Loading Standalone Program ... OK
    Example expects ABI version 8
    Actual U-Boot ABI version 8
    Hello World
    argc = 0
    argv[0] = "0xffffffff88000000"

    With the patch, you see the following.

    boston # bootm $loadaddr 123 321
    Image Name: hello
    Image Type: MIPS U-Boot Standalone Program (uncompressed)
    Data Size: 1240 Bytes = 1.2 KiB
    Load Address: 80200000
    Entry Point: 80200000
    Verifying Checksum ... OK
    Loading Standalone Program ... OK
    Example expects ABI version 8
    Actual U-Boot ABI version 8
    Hello World
    argc = 3
    argv[0] = "0xffffffff88000000"
    argv[1] = "123"
    argv[2] = "321"
    argv[3] = ""

    Without the patch, the go command at the entry point seems to work.

    boston # go 0xffffffff80200000 123 321
    Example expects ABI version 8
    Actual U-Boot ABI version 8
    Hello World
    argc = 3
    argv[0] = "0xffffffff80200000"
    argv[1] = "123"
    argv[2] = "321"
    argv[3] = ""
    Hit any key to exit ...

    Signed-off-by: Zubair Lutfullah Kakakhel
    Reviewed-by: Simon Glass

    Zubair Lutfullah Kakakhel
     

20 Aug, 2016

1 commit

  • The bootz and booti commands rely on common functionality that is found
    in common/bootm.c and common/bootm_os.c. They do not however rely on
    the rest of cmd/bootm.c to be implemented so split them into their own
    files. Have various Makefiles include the required infrastructure for
    CONFIG_CMD_BOOT[IZ] as well as CONFIG_CMD_BOOTM. Move the declaration
    of 'images' over to common/bootm.c.

    Cc: Masahiro Yamada
    Signed-off-by: Tom Rini

    Tom Rini
     

15 Jul, 2016

1 commit

  • The function fixup_silent_linux() is called in status BOOTM_STATE_LOADOS
    to silence Linux if variable 'silent' is set.
    Currently only the 'bootm' command state machine contains
    BOOTM_STATE_LOADOS, but others like 'booti' or 'bootz' commands do not.
    This means silent Linux does not work with these commands.

    This patch moves the fixup_silent_linux() call out of the
    BOOTM_STATE_LOADOS state and into BOOTM_STATE_OS_PREP, to silence Linux
    independently of the used command (booti, bootm or bootz).

    Signed-off-by: Hector Palacios

    Hector Palacios
     

13 Jun, 2016

1 commit

  • Flushing part of the cache should be done on cache boundaries. Trying to
    flush part of a cache line is not supported and the request may be ignored
    or print warnings.

    Adjust the bootm code to align the end address to prevent this problem.

    Signed-off-by: Simon Glass
    Reviewed-by: Heiko Schocher
    Tested-on: smartweb, corvus, taurus, axm
    Tested-by: Heiko Schocher
    Reviewed-by: Joe Hershberger
    Reviewed-by: Andreas Bießmann

    Simon Glass
     

24 May, 2016

1 commit


15 Mar, 2016

2 commits

  • Add an option to enable libfdt in SPL. This can be useful when decoding
    FIT files in SPL.

    We need to make sure this option is not enabled in SPL by this change.
    Also this option needs to be enabled in host builds. Si add a new
    IMAGE_USE_LIBFDT #define which can be used in files that are built on the
    host but must also build for U-Boot and SPL.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • There are already two FIT options in Kconfig but the CONFIG options are
    still in the header files. We need to do a proper move to fix this.

    Move these options to Kconfig and tidy up board configuration:

    CONFIG_FIT
    CONFIG_OF_BOARD_SETUP
    CONFIG_OF_SYSTEM_SETUP
    CONFIG_FIT_SIGNATURE
    CONFIG_FIT_BEST_MATCH
    CONFIG_FIT_VERBOSE
    CONFIG_OF_STDOUT_VIA_ALIAS
    CONFIG_RSA

    Unfortunately the first one is a little complicated. We need to make sure
    this option is not enabled in SPL by this change. Also this option is
    enabled automatically in the host builds by defining CONFIG_FIT in the
    image.h file. To solve this, add a new IMAGE_USE_FIT #define which can
    be used in files that are built on the host but must also build for U-Boot
    and SPL.

    Note: Masahiro's moveconfig.py script is amazing.

    Signed-off-by: Simon Glass
    [trini: Add microblaze change, various configs/ re-applies]
    Signed-off-by: Tom Rini

    Simon Glass
     

26 Feb, 2016

1 commit

  • A recent change broke the 'bootm' command on sandbox. The root cause is
    using a pointer as an address. Conversion from pointer to address needs to
    use map_to_sysmem() so that sandbox can do the right thing. The problem was
    pre-existing but uncovered by a recent commit.

    Fix this. Also move fit_get_end() to the C file to avoid needing to include
    mapmem.h (and thus asm/io.h) everywhere.

    Fixes: 1fec3c5d (common/image.c: Make boot_get_ramdisk() perform a check for Android images)

    Signed-off-by: Simon Glass

    Simon Glass
     

25 Jan, 2016

1 commit

  • Variable _load_end_ points to end address of uncompressed buffer
    (*not* uncomress_buffer_end / sizeof(ulong)), so multipling uncompressed
    size with sizeof(ulong) is grossly incorrect in flush_cache().
    It might lead to access of address beyond valid memory range and hang the CPU.

    Tested on MIPS architecture by using compressed(gzip, lzma)
    and uncompressed uImage.

    Signed-off-by: Purna Chandra Mandal
    Reviewed-by: Simon Glass
    Reviewed-by: Daniel Schwierzeck

    Purna Chandra Mandal
     

12 Oct, 2015

1 commit

  • This patch adds support for LZ4-compressed FIT image contents. This
    algorithm has a slightly worse compression ration than LZO while being
    nearly twice as fast to decompress. When loading images from a fast
    storage medium this usually results in a boot time win.

    Sandbox-tested only since I don't have a U-Boot development system set
    up right now. The code was imported unchanged from coreboot where it's
    proven to work, though. I'm mostly interested in getting this recognized
    by mkImage for use in a downstream project.

    Signed-off-by: Julius Werner
    Acked-by: Simon Glass

    Julius Werner
     

30 Sep, 2015

1 commit

  • CONFIG_NETCONSOLE causes common/bootm.c to call eth_unregister()
    for network device shutdown. However, with CONFIG_DM_ETH this
    function is no longer defined.

    This is a workaround to avoid the call in that case, and solely
    rely on eth_halt(). In case this is insufficient, a proper way
    to unregister / remove network devices needs to be implemented.

    Signed-off-by: Bernhard Nortmann
    Reviewed-by: Simon Glass
    Acked-by: Joe Hershberger

    Bernhard Nortmann
     

28 May, 2015

2 commits

  • bootm_find_ramdisk_fdt() renamed to bootm_find_images() for readability.

    The function bootm_find_ramdisk_fdt() appears to be a simple wrapper for
    bootm_find_ramdisk(), bootm_find_fdt(), and now bootm_find_loadables().
    I didn't see any other callers entering a bootm_find, so removing
    the wrapper, and condensing these together hopefully makes the code a
    little simpler.

    Signed-off-by: Karl Apsite
    Reviewed-by: Simon Glass

    Karl Apsite
     
  • Added a trimmed down instance of boot_get_() to satisfy the
    minimum requierments of the added feature. The function follows the
    normal patterns set by other boot_get's, which should make it a
    bit easier to combine them all together into one boot_get_image()
    function in a later refactor.

    Documentation for the new function can be found in source:
    include/image.h

    Signed-off-by: Karl Apsite
    Reviewed-by: Simon Glass

    Karl Apsite
     

19 Apr, 2015

1 commit