03 Dec, 2019

2 commits


05 Oct, 2019

1 commit


12 Aug, 2019

5 commits


23 May, 2019

1 commit

  • Solve compilation issue when cli_simple.o is used in SPL
    and CONFIG_SPL_ENV_SUPPORT is not defined.

    env/built-in.o:(.data.env_htab+0xc): undefined reference to `env_flags_validate'
    u-boot/scripts/Makefile.spl:384: recipe for target 'spl/u-boot-spl' failed
    make[2]: *** [spl/u-boot-spl] Error 1
    u-boot/Makefile:1649: recipe for target 'spl/u-boot-spl' failed
    make[1]: *** [spl/u-boot-spl] Error 2

    Signed-off-by: Patrick Delaunay

    Patrick Delaunay
     

26 Jan, 2019

1 commit

  • Callers of env_import*() functions might want to check the case when we
    have incorrect environment (with bad CRC). For example, when environment
    location is being defined in env_load(), call chain may look like this:

    env_load() -> drv->load() = env_mmc_load() -> env_import()

    Return code will be passed from env_import() all way up to env_load().
    Right now both env_mmc_load() and env_import() return -EIO error code,
    so env_load() can't differentiate between two cases:
    1. Driver reports the error, because device is not accessible
    2. Device is actually accessible, but environment is broken

    Let's return -ENOMSG in env_import(), so we can distinguish two cases
    mentioned above. It will make it possible to continue working with "bad
    CRC" environment (like doing "env save"), instead of considering it not
    functional (implemented in subsequent patch).

    Signed-off-by: Sam Protsenko
    Reviewed-by: Simon Goldschmidt

    Sam Protsenko
     

16 Jan, 2019

1 commit

  • Add the dollar_complete() function to auto-complete arguments starting
    with a '$' and use it in the cmd_auto_complete() path such that all
    args starting with a $ can be auto-completed based on the available env
    vars.

    Signed-off-by: Boris Brezillon
    [trini: Fix some linking problems]
    Signed-off-by: Tom Rini

    Boris Brezillon
     

21 Jul, 2018

1 commit

  • The error message should start with `## Error: ` so that it's easily
    detectable by tests without needing to have a complex regexp for
    matching all possible error message patterns.

    Let's add the `## Error: ` prefix to the error messages since it's the
    one already in use.

    Suggested-by: Stephen Warren
    Signed-off-by: Quentin Schulz
    Reviewed-by: Simon Glass
    Reviewed-by: Stephen Warren
    Tested-by: Stephen Warren

    Quentin Schulz
     

20 Jul, 2018

3 commits

  • The function set_default_env() sets the hashtable flags for import_r().
    Formally set_default_env() doesn't accept flags from its callers. In
    practice the caller can (un)set the H_INTERACTIVE flag, but it has to be
    done using the first character of the function's string argument. Other
    flags like H_FORCE can't be set by the caller.

    Change the function to accept flags argument. The benefits are:
    1. The caller will have to explicitly set the H_INTERACTIVE flag,
    instead of un-setting it using a special char in a string.
    2. Add the ability to propagate flags from the caller to himport(),
    especially the H_FORCE flag from do_env_default() in nvedit.c that
    currently gets ignored for "env default -a -f" commands.
    3. Flags and messages will not be coupled together. A caller will be
    able to set flags without passing a string and vice versa.

    Please note:
    The propagation of H_FORCE from do_env_default() does not introduce any
    functional changes, because currently himport_r() is set to destroy the
    old environment regardless if H_FORCE flag is set or not. More changes
    are needed to utilize the propagation of H_FORCE.

    Signed-off-by: Yaniv Levinsky
    Acked-by: Igor Grinberg

    Yaniv Levinsky
     
  • The function set_default_vars() in common.c adds H_INTERACTIVE to the
    h_import() flag, but the function has no way of telling if the command
    actually was user directed like this flag suggest. The flag should be
    set by the calling function do_env_default() in nvedit.c instead, where
    the command is certainty user directed.

    Move the H_INTERACTIVE flag from set_default_vars() to do_env_default().

    Signed-off-by: Yaniv Levinsky
    Acked-by: Igor Grinberg

    Yaniv Levinsky
     
  • The env_flag in do_env_default() doesn't get propagated and therefore
    gets ignored by himport_r(). This breaks to ability to "forcibly" reset
    variables to their default values using the environment command.

    Scenario example of the problem:
    # setenv kernel uImage
    # setenv .flags kernel:so
    # env default -f kernel
    ## Error: Can't overwrite "kernel"
    himport_r: can't insert "kernel=zImage" into hash table

    Change the call path so it will pass the flag correctly.

    Signed-off-by: Yaniv Levinsky
    Acked-by: Igor Grinberg

    Yaniv Levinsky
     

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
     

17 Apr, 2018

1 commit


01 Feb, 2018

2 commits

  • There is more common code in mmc, nand and ubi env drivers that
    can be shared by moving to env_import_redund.

    For this, a status/error value whether the buffers were loaded
    are passed as additional parameters to env_import_redund.
    Ideally, these are already returned to the env driver by the
    storage driver. This is the case for mmc, nand and ubi, so for
    this change, code deduplicated.

    Signed-off-by: Simon Goldschmidt
    Acked-by: Maxime Ripard

    Simon Goldschmidt
     
  • env_import (and env_import_redund) currently return 1 on success
    and 0 on error. However, they are only used from functions
    returning 0 on success or a negative value on error.

    Let's clean this up by making env_import and env_import_redund
    return 0 on success and -EIO on error (as was the case for all
    users before).

    Users that cared for the return value are also updated. Funny
    enough, this only affects onenand.c and sf.c

    Signed-off-by: Simon Goldschmidt
    Acked-by: Maxime Ripard

    Simon Goldschmidt
     

27 Jan, 2018

1 commit

  • Since we have global messages to indicate what's going on, the custom
    messages in the environment drivers only make the output less readable.

    Make the common code play a little nicer by removing all the extra output
    in the standard case.

    Reviewed-by: Andre Przywara
    Reviewed-by: Simon Glass
    Signed-off-by: Maxime Ripard

    Maxime Ripard
     

21 Nov, 2017

1 commit


04 Oct, 2017

1 commit

  • U-Boot widely uses error() as a bit noisier variant of printf().

    This macro causes name conflict with the following line in
    include/linux/compiler-gcc.h:

    # define __compiletime_error(message) __attribute__((error(message)))

    This prevents us from using __compiletime_error(), and makes it
    difficult to fully sync BUILD_BUG macros with Linux. (Notice
    Linux's BUILD_BUG_ON_MSG is implemented by using compiletime_assert().)

    Let's convert error() into now treewide-available pr_err().

    Done with the help of Coccinelle, excluing tools/ directory.

    The semantic patch I used is as follows:

    //
    @@@@
    -error
    +pr_err
    (...)
    //

    Signed-off-by: Masahiro Yamada
    Reviewed-by: Simon Glass
    [trini: Re-run Coccinelle]
    Signed-off-by: Tom Rini

    Masahiro Yamada
     

21 Aug, 2017

1 commit


16 Aug, 2017

5 commits


15 Aug, 2017

6 commits