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
     

19 Jul, 2018

1 commit


13 Jun, 2018

2 commits


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
     

28 Apr, 2018

1 commit


17 Apr, 2018

2 commits


09 Apr, 2018

1 commit


07 Apr, 2018

3 commits

  • Use CONFIG_IS_ENABLED to see if CONFIG_BLK is enabled. Otherwise
    SPL compilation breaks on boards which do have CONFIG_BLK enabled but
    not DM_MMC for the SPL as follows:

    env/mmc.c: In function ‘init_mmc_for_env’:
    env/mmc.c:164:6: warning: implicit declaration of function ‘blk_get_from_parent’; did you mean ‘efi_get_ram_base’? [-Wimplicit-function-declaration]
    if (blk_get_from_parent(mmc->dev, &dev))
    ^~~~~~~~~~~~~~~~~~~
    efi_get_ram_base
    env/mmc.c:164:29: error: ‘struct mmc’ has no member named ‘dev’
    if (blk_get_from_parent(mmc->dev, &dev))
    ^~

    Signed-off-by: Sjoerd Simons
    Reviewed-by: Simon Glass

    Sjoerd Simons
     
  • Modifying the default environment via CONFIG_EXTRA_ENV_SETTINGS is
    somewhat inflexible, partly because the cpp language does not allow
    appending to an existing macro. This prevents reuse of "environment
    fragments" for different boards, which in turn makes maintaining that
    environment consistently tedious and error-prone.

    This implements a Kconfig option for allowing one to define the entire
    default environment in an external file, which can then, for example, be
    generated programmatically as part of a Yocto recipe, or simply be kept
    in version control separately from the U-boot repository.

    Tested-by: Sean Nyekjaer
    Signed-off-by: Rasmus Villemoes
    Reviewed-by: Lukasz Majewski

    Rasmus Villemoes
     
  • Commit 7653942b10e9e ("common/env_embedded.c: drop support for
    CONFIG_SYS_USE_PPCENV") dropped the .ppcenv section which was
    used in linking scripts to allow fine placement of embedded
    environment sections.

    This implies that GCC randomly places objects from env/embedded.o
    and environment is not guaranteed to be located at the correct address:

    04003df8 g F .text 00000038 mii_init
    04004000 g O .text 00000004 env_size
    04004004 g O .text 00002000 environment
    04006004 g F .text 00000040 .hidden __lshrdi3

    This patch restores this capability by allocating each object marked
    with __UBOOT_ENV_SECTION__ into a different section. Hence
    'environment' will be alone in .text.environment, allowing a
    fine placement in u-boot.lds with:

    . = DEFINED(env_offset) ? env_offset : .;
    env/embedded.o (.text.environment)

    Fixes: 7653942b10e9e ("common/env_embedded.c: drop support for CONFIG_SYS_USE_PPCENV")
    Cc: Thomas Petazzoni
    Signed-off-by: Christophe Leroy

    Christophe Leroy
     

05 Apr, 2018

1 commit


04 Apr, 2018

1 commit

  • Since the dawn of time for the Allwinner support in mainline U-Boot
    we store the environment to the SD card and write directly at
    544KB from the beginning of the device. This leads to problems when
    the U-Boot proper image grows beyond 504KB and eventually overlaps.
    With one release of having the environment preferably in a FAT
    partition, let's now turn off the MMC variant fallback, so we get back
    all the space we need to implement features.

    Signed-off-by: Andre Przywara
    Reviewed-by: Jagan Teki
    Acked-by: Maxime Ripard

    Andre Przywara
     

24 Mar, 2018

2 commits

  • Signed-off-by: Petr Vorel

    Petr Vorel
     
  • Introduce another difference from upstream (kernel) source in
    fs/ubifs/super.c: adding preprocessor condition as y variable in
    mount_ubifs() depends on CONFIG_UBIFS_SILENCE_MSG:
    fs/ubifs/super.c:1337:15: error: variable ?y? set but not used [-Werror=unused-but-set-variable]
    long long x, y;

    Not setting CONFIG_UBIFS_SILENCE_MSG in am335x_igep003x_defconfig and
    igep0032_defconfig. Although it was defined in their config headers, it
    depends on CMD_UBIFS which is not set for them.

    Signed-off-by: Petr Vorel
    Cc: Joe Hershberger
    Cc: Heiko Schocher

    Petr Vorel
     

20 Feb, 2018

1 commit


17 Feb, 2018

2 commits

  • With multiple environments, the 'get_char' callback for env
    drivers does not really make sense any more because it is
    only supported by two drivers (eeprom and nvram).

    To restore single character loading for these drivers,
    override 'env_get_char_spec'.

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

    Goldschmidt Simon
     
  • Commit 7d714a24d725 ("env: Support multiple environments") added
    static variable env_load_location. When saving environmental
    variables, this variable is presumed to have the value set before.
    In case the value was set before relocation and U-Boot runs from a
    NOR flash, this variable wasn't writable. This causes failure when
    saving the environment. To save this location, global data must be
    used instead.

    Signed-off-by: York Sun
    CC: Maxime Ripard

    York Sun
     

13 Feb, 2018

1 commit

  • When saving the environment on a platform which has DMA alignment
    larger than the natural alignment, env_fat_save triggers a debug
    message in file_fat_write:

    Saving Environment to FAT... writing uboot.env
    FAT: Misaligned buffer address (9df1c8e0)
    OK

    Signed-off-by: Alex Kiernan

    Alex Kiernan
     

01 Feb, 2018

4 commits

  • For the redundant environment configuration, env_sf_load still
    contained duplicate code instead of using env_import_redund().

    Simplify the code by only executing the load twice and delegating
    everything else to env_import_redund.

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

    Simon Goldschmidt
     
  • For multiple env drivers to correctly implement fallback when
    one environment fails to load (e.g. crc error), the return value
    of env_import has to be propagated by all env driver's load
    function.

    Without this change, the first driver that succeeds to load an
    environment with an invalid CRC return 0 (success) and no other
    drivers are checked.

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

    Simon Goldschmidt
     
  • 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

13 commits

  • Now that we have everything in place to implement the transition scheme,
    let's enable it by default.

    Reviewed-by: Andre Przywara
    Reviewed-by: Lukasz Majewski
    Signed-off-by: Maxime Ripard

    Maxime Ripard
     
  • Allow boards and architectures to override the default environment lookup
    code by overriding env_get_location.

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

    Maxime Ripard
     
  • Now that we have everything in place in the code, let's allow to build
    multiple environments backend through Kconfig.

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

    Maxime Ripard
     
  • The raw MMC environment directly calls into the MMC framework. Make sure
    it's enabled before we can select it.

    Reviewed-by: Simon Glass
    Signed-off-by: Maxime Ripard
    Reviewed-by: Jaehoon Chung

    Maxime Ripard
     
  • Since we want to have multiple environments, we will need to initialise
    all the environments since we don't know at init time what drivers might
    fail when calling load.

    Let's init all of them, and only consider for further operations the ones
    that have not reported any errors at init time.

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

    Maxime Ripard
     
  • Now that we have everything in place to support multiple environment, let's
    make sure the current code can use it.

    The priority used between the various environment is the same one that was
    used in the code previously.

    At read / init times, the highest priority environment is going to be
    detected, and we'll use the same one without lookup during writes. This
    should implement the same behaviour than we currently have.

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

    Maxime Ripard
     
  • 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
     
  • 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 MMC play a little nicer by removing all the extra \n and formatting
    that is redundant with the global output.

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

    Maxime Ripard
     
  • 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 FAT play a little nicer by removing all the extra \n and formatting
    that is redundant with the global output.

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

    Maxime Ripard
     
  • Since we can have multiple environments now, it's better to provide a
    decent indication on what environments were tried and which were the one to
    fail and succeed.

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

    Maxime Ripard
     
  • Since we'll soon have support for multiple environments, the environment
    saving message might end up being printed multiple times if the higher
    priority environment cannot be used.

    That might confuse the user, so let's make it explicit if the operation
    failed or not.

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

    Maxime Ripard
     
  • In preparation for the multiple environment support, let's introduce two
    new parameters to the environment driver lookup function: the priority and
    operation.

    The operation parameter is meant to identify, obviously, the operation you
    might want to perform on the environment.

    The priority is a number passed to identify the environment priority you
    want to retrieve. The lowest priority parameter (0) will be the primary
    source.

    Combining the two parameters allow you to support multiple environments
    through different priorities, and to change those priorities between read
    and writes operations.

    This is especially useful to implement migration mechanisms where you want
    to always use the same environment first, be it to read or write, while the
    common case is more likely to use the same environment it has read from to
    write it to.

    Signed-off-by: Maxime Ripard

    Maxime Ripard
     
  • The env_driver_lookup_default and env_get_default_location functions are
    about to get refactored to support loading from multiple environment.

    The name is therefore not really well suited anymore. Drop the default
    part to be a bit more relevant.

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

    Maxime Ripard