06 May, 2020

1 commit

  • mtdparts quit when invalid mtd devices found. Add thes patches to skip
    the invalid devices, so NAND partitions can be alway found to burn boot
    images.

    For instance,

    On i.MX6DL Sabreauto, nand config u-boot didn't enable the weim nor, so
    parsing 8000000.nor leads to error:

    Device nor0 not found!

    With the patches, we can skip this invalid device and still get nand
    boot partition table:

    Device nor0 not found!
    current device is invalid, skip it and check the next one

    device nand0 , # parts = 5
    0: nandboot 0x04000000 0x00000000 0
    1: nandkernel 0x01000000 0x04000000 0
    2: nanddtb 0x01000000 0x05000000 0
    3: nandtee 0x01000000 0x06000000 0
    4: nandrootfs 0xf9000000 0x07000000 0

    active partition: nand0,0 - (nandboot) 0x04000000 @ 0x00000000

    Signed-off-by: Han Xu
    (cherry picked from commit e674896123983e152ef3cc9d1304b775e5086a5e)

    Han Xu
     

08 Nov, 2019

1 commit

  • That option is currently not used by any defconfig and could not be set
    anymore since it became mandatory to used Kconfig when introducing new
    options with U-Boot v2016.11 or commit eed921d92348 ("Kconfig: Add a
    whitelist of ad-hoc CONFIG options") and commit 371244cb19f9 ("Makefile:
    Give a build error if ad-hoc CONFIG options are added").

    It was also not considered when fixing build warnings in
    commit 39ac34473f3c ("cmd_mtdparts: use 64 bits for flash size,
    partition size & offset") and could probably not be compiled anyway
    after commit dfe64e2c8973 ("mtd: resync with Linux-3.7.1"), which
    renamed some members of struct mtd_info … so it was probably broken
    since then, which was U-Boot v2013.07-rc1.

    However it still seems to work, see example output below:

    U-Boot 2019.10-00035-g06a9b259ca-dirty (Oct 30 2019 - 14:03:44 +0100)

    CPU: SAMA5D27 1G bits DDR2 SDRAM
    Crystal frequency: 24 MHz
    CPU clock : 492 MHz
    Master clock : 164 MHz
    Model: ***
    DRAM: 128 MiB
    NAND: 256 MiB
    Loading Environment from NAND... OK
    In: serial@f8020000
    Out: serial@f8020000
    Err: serial@f8020000
    Net: eth0: ethernet@f8008000
    Hit keys 'tt' to stop autoboot (3 seconds).
    U-Boot> mtdparts

    device nand0 , # parts = 8
    #: name size net size offset mask_flags
    0: bootstrap 0x00040000 0x00040000 0x00000000 1
    1: uboot 0x000c0000 0x000c0000 0x00040000 1
    2: env1 0x00040000 0x00040000 0x00100000 0
    3: env2 0x00040000 0x00040000 0x00140000 0
    4: fpga_led 0x00040000 0x00040000 0x00180000 1
    5: reserved 0x00040000 0x00040000 0x001c0000 1
    6: rootfs_rec 0x03200000 0x03200000 0x00200000 1
    7: filesystem 0x0cc00000 0x0cb80000 (!) 0x03400000 0

    active partition: nand0,0 - (bootstrap) 0x00040000 @ 0x00000000

    defaults:
    mtdids : nand0=atmel_nand
    mtdparts: mtdparts=atmel_nand:256k(bootstrap)ro,768k(uboot)ro,256k(env1),256k(env2),256k(fpga_led)ro,256k(reserved)ro,50M(rootfs_rec)ro,-(filesystem)

    Signed-off-by: Alexander Dahl

    Alexander Dahl
     

12 Aug, 2019

1 commit


20 Sep, 2018

3 commits


24 Jul, 2018

1 commit

  • In the case that there was no name defined for a partition the
    code assumes that name_len is 22 and therefore allocates exactly
    that space for a dummy name. But the function sprintf() first
    resolves "0x%08llx@0x%08llx" to a string that is longer than 22
    bytes. This leads to a buffer overflow. The replacement function
    snprintf() limits the copied bytes to name_len and therefore
    avoids the buffer overflow.

    Signed-off-by: Kay Potthoff

    Kay Potthoff
     

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
     

08 Dec, 2017

1 commit

  • The debug() macro now evaluates its expression so does not need #ifdef
    protection. In fact the current code causes a warning with the new log
    implementation. Adjust the code to fix this.

    Signed-off-by: Simon Glass
    Reviewed-by: Bin Meng

    Simon Glass
     

04 Dec, 2017

1 commit

  • This header was renamed to rawnand.h in Linux.

    The following is the corresponding commit in Linux.

    commit d4092d76a4a4e57b65910899948a83cc8646c5a5
    Author: Boris Brezillon
    Date: Fri Aug 4 17:29:10 2017 +0200

    mtd: nand: Rename nand.h into rawnand.h

    We are planning to share more code between different NAND based
    devices (SPI NAND, OneNAND and raw NANDs), but before doing that
    we need to move the existing include/linux/mtd/nand.h file into
    include/linux/mtd/rawnand.h so we can later create a nand.h header
    containing all common structure and function prototypes.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

27 Aug, 2017

2 commits

  • When reworking this code to fix other issues found by Coverity, I forgot
    to ensure tmp_ep was always cleared before use.

    Reported-by: Coverity (CID: 166612)
    Fixes: bc028345acc4 ("mtdparts: Fix final outstanding issue reported by Coverity")
    Signed-off-by: Tom Rini

    Tom Rini
     
  • As part of fixing the previously reported issues, it was missed that in
    the case of mtdparts_init() we need to make sure that tmp_ep is long
    enough to contain PARTITION_MAXLEN and a NULL termination. Then, to be
    sure the buffer is NULL terminated, zero the entire buffer rather than
    just ensuring the first character is NULL.

    Cc: Lothar Waßmann
    Cc: Maxime Ripard
    Reported-by: Coverity (CID: 166329)
    Signed-off-by: Tom Rini

    Tom Rini
     

20 Aug, 2017

1 commit

  • Now that sandbox is building cmd/mtdparts.c Coverity has looked at the
    code and found a number of issues. In index_partitions() it is possible
    that part will be NULL, so re-work the checks and debug statements to
    take this into account. We have a number of string buffers that we
    print to in the exact size of, and use string functions on, so we need
    to ensure they are large enough to be NULL terminated. In
    device_parse() it is not possible for num_partitions to be 0 (we would
    have hit a different error first) so remove logically dead code.
    Finally, in parse_mtdparts() if we have an error we need to free the
    memory allocated to dev.

    Cc: Lothar Waßmann
    Cc: Maxime Ripard
    Reported-by: Coverity (CID: 166334, 166333, 166332, 166329, 166328)
    Signed-off-by: Tom Rini

    Tom Rini
     

16 Aug, 2017

4 commits

  • We are now using an env_ prefix for environment functions. Rename these
    other functions as well, for consistency:

    getenv_vlan()
    getenv_bootm_size()
    getenv_bootm_low()
    getenv_bootm_mapsize()
    env_get_default()

    Suggested-by: Wolfgang Denk
    Signed-off-by: Simon Glass

    Simon Glass
     
  • We are now using an env_ prefix for environment functions. Rename these
    two functions for consistency. Also add function comments in common.h.

    Quite a few places use getenv() in a condition context, provoking a
    warning from checkpatch. These are fixed up in this patch also.

    Suggested-by: Wolfgang Denk
    Signed-off-by: Simon Glass

    Simon Glass
     
  • We are now using an env_ prefix for environment functions. Rename these
    commonly used functions, for consistency. Also add function comments in
    common.h.

    Suggested-by: Wolfgang Denk
    Signed-off-by: Simon Glass

    Simon Glass
     
  • We are now using an env_ prefix for environment functions. Rename setenv()
    for consistency. Also add function comments in common.h.

    Suggested-by: Wolfgang Denk
    Signed-off-by: Simon Glass

    Simon Glass
     

12 Jun, 2017

1 commit

  • commit 06a040a31bcf ("cmd: mtdparts: fix null pointer dereference in parse_mtdparts")
    removed the initialization of a pointer variable, which is
    subsequently used in a debug() call. This produces an uninitialized
    variable warning, when compiling with DEBUG defined.

    Signed-off-by: Lothar Waßmann

    Lothar Waßmann
     

07 Apr, 2017

1 commit

  • CMD_MTDPARTS is something the user might or might not want to select, and
    might depends on (or be selected by) other options too.

    This is even truer for the MTDIDS_DEFAULT and MTDPARTS_DEFAULT options that
    might change from one board to another, or from one user to the other,
    depending on what it expects and what storage devices are available.

    In order to ease that configuration, add those options to Kconfig.

    Signed-off-by: Maxime Ripard
    Reviewed-by: Tom Rini
    Reviewed-by: Jagan Teki

    Maxime Ripard
     

25 Jul, 2016

1 commit


23 Jul, 2016

5 commits


06 May, 2016

1 commit


06 Feb, 2016

1 commit

  • Correct spelling of "U-Boot" shall be used in all written text
    (documentation, comments in source files etc.).

    Signed-off-by: Bin Meng
    Reviewed-by: Heiko Schocher
    Reviewed-by: Simon Glass
    Reviewed-by: Minkyu Kang

    Bin Meng
     

25 Jan, 2016

1 commit

  • Now that they are in their own directory, we can remove this prefix.
    This makes it easier to find a file since the prefix does not get in the
    way.

    Signed-off-by: Simon Glass
    Reviewed-by: Bin Meng
    Reviewed-by: Heiko Schocher
    Acked-by: Stefan Roese
    Acked-by: Przemyslaw Marczak

    Simon Glass