05 Mar, 2018

1 commit


15 Feb, 2018

1 commit


28 Jan, 2018

1 commit


30 Nov, 2017

1 commit

  • Up to now we were able to read/write environment data from/to UBI
    volumes only indirectly by gluebi driver. This driver creates NAND MTD
    on top of UBI volumes, which is quite a workaroung for this use case.

    Add support for direct read/write UBI volumes in order to not use
    obsolete gluebi driver.

    Forward-ported from this patch:
    http://patchwork.ozlabs.org/patch/619305/

    Original patch:
    Signed-off-by: Marcin Niestroj

    Forward port:
    Signed-off-by: S. Lockwood-Childs

    S. Lockwood-Childs
     

21 Nov, 2017

1 commit


06 Nov, 2017

1 commit

  • The fw_env utility family has a default environment compiled in
    which ties it quite strongly to the U-Boot source/config it has
    been built with. Allow to display the U-Boot version it has been
    built with using the -v/--version argument.

    Signed-off-by: Stefan Agner
    Reviewed-by: Lukasz Majewski

    Stefan Agner
     

16 Oct, 2017

1 commit


06 Sep, 2017

3 commits

  • The target is not currently mentioned anywhere. Add it to the help so
    people can find it.

    Signed-off-by: Simon Glass

    Simon Glass
     
  • This was broken by the recent environment refactoring. Specifically:

    $ make environ
    scripts/Makefile.build:59: tools/environ/Makefile: No such file or directory
    make[1]: *** No rule to make target 'tools/environ/Makefile'. Stop.
    make: *** [Makefile:1469: environ] Error 2

    Fix this by updating the Makefile and adjusting the #include filesnames in
    two C files.

    Fixes: ec74f5f (Makefile: Rename 'env' target to 'environ')
    Reported-by: Måns Rullgård
    Signed-off-by: Simon Glass

    Simon Glass
     
  • With the move of environment code from common/ to env/ a number of
    changes needed to be made to various make targets. We missed updating
    some of the files required for out of tree builds of the tools. Correct
    the 'environ' target to know that we need to work under tools/env/ still
    (not tools/environ/) and then update the wrappers in env_attr.c and
    env_flags.c to point to the new correct file.

    Reported-by: Peter Robinson
    Tested-by: Peter Robinson
    Signed-off-by: Tom Rini

    Tom Rini
     

04 Sep, 2017

1 commit

  • According to fsync specification [1] some special files (e.g., a pipe, FIFO,
    or socket) don't support synchronization and return either EROFS or EINVAL.

    On the linux side the sys_fsync -> do_fsync() checks if the requested file
    has f_op->fsync defined. If not it returns EINVAL [2].

    This commit prevents writing error messages for files (devices), which
    do not support fsync().

    [1] - http://man7.org/linux/man-pages/man2/fsync.2.html
    [2] - http://elixir.free-electrons.com/linux/v4.13-rc6/source/fs/sync.c#L183

    Signed-off-by: Lukasz Majewski
    Acked-by: Michael Heimpold

    Lukasz Majewski
     

16 Aug, 2017

1 commit


23 Jul, 2017

1 commit


18 Apr, 2017

1 commit


13 Apr, 2017

4 commits

  • fw_env_open allocates buffers to store the environment, but these
    buffers are never freed. This becomes quite nasty using the fw_ tools as
    library, because each access to the environment (even just reading a
    variable) generates a memory leak equal to the size of the environment.

    Fix this renaming fw_env_close() as fw_env_flush(), because the function
    really flushes the environment from RAM to storage, and add a
    fw_env_close function to free the allocated resources.

    Signed-off-by: Stefano Babic

    Stefano Babic
     
  • Changes in the environment library are difficult to tracked by programs
    using the library. Add simply an API version number that must be
    increased each time when the API is changed.

    This can be detected and a program can work with different versions of
    the library.

    Signed-off-by: Stefano Babic

    Stefano Babic
     
  • Move U-Boot private data into a separate file. This
    lets export fw_env.h to be used by external programs
    that want to change the environment using the library
    built in tools/env.

    Signed-off-by: Stefano Babic

    Stefano Babic
     
  • aes.h is a too generic name if this file can
    be exported and used by a program.
    Rename it to avoid any conflicts with
    other files (for example, from openSSL).

    Signed-off-by: Stefano Babic

    Stefano Babic
     

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
     

29 Nov, 2016

1 commit

  • commit 183923d3e412500bdc597d1745e2fb6f7f679ec7 enforces that the
    environment must start at an erase block boundary.

    For block devices the sample fw_env.config does not mandate a erase block size
    for block devices. A missing setting defaults to the full env size.

    Depending on the environment location the alignment check now errors out for
    perfectly legal settings.

    Fix this by defaulting to the standard blocksize of 0x200 for environments
    stored in a block device.
    That keeps the fw_env.config files for block devices working even with that
    new check.

    Signed-off-by: Max Krummenacher

    Max Krummenacher
     

08 Oct, 2016

1 commit

  • The default lockname is set to /var/lock. This limits the
    usage of this application where OS uses different lockfile
    location parameter.
    For example, In case of android, the default lock
    path location is /data.
    Hence by providing the command line option to input lockfile
    path will be useful to reuse the tool across multiple
    operating system.

    usage: ./fw_printenv -l

    Signed-off-by: Ravi Babu

    B, Ravi
     

07 Oct, 2016

4 commits


21 Aug, 2016

2 commits


16 Aug, 2016

1 commit

  • 56086921 added support for unaligned environments access.
    U-boot itself does not support this:
    - env_nand.c fails when using an unaligned offset. It produces an
    error in nand_erase_opts{drivers/mtd/nand/nand_util.c}
    - in env_sf/env_flash the unused space at the end is preserved, but
    not in the beginning. block alignment is assumed
    - env_sata/env_mmc aligns offset/length to the block size of the
    underlying device. data is silently redirected to the beginning of
    a block

    There is seems no use case for unaligned environment. If there is
    some useful data at the beginning of the the block (e.g. end of u-boot)
    that would be very unsafe. If the redundant environments are hosted by
    the same erase block then that invalidates the idea of double buffering.
    It might be that unaligned access was allowed in the past, and that
    people with legacy u-boot are trapped. But at the time of 56086921
    it wasn't supported and due to reasons above I guess it was never
    introduced.
    I prefer to remove that (unused) feature in favor of simplicity

    Signed-off-by: Andreas Fenkart
    Acked-by: Stefan Agner

    Andreas Fenkart
     

26 Jul, 2016

1 commit


23 Jul, 2016

5 commits

  • Try to avoid adhoc iteration of the environment. Reuse fw_getenv
    to find the variables that should be printed. Only use open-coded
    iteration when printing all variables.
    For backwards compatibility, keep emitting a newline when
    printing with value_only.

    Signed-off-by: Andreas Fenkart

    Andreas Fenkart
     
  • forward declaration not needed when re-ordered

    Reviewed-by: Simon Glass
    Signed-off-by: Andreas Fenkart

    Andreas Fenkart
     
  • there are two groups of functions:
    - application ready tools: fw_setenv/fw_getenv/fw_parse_script
    these are used, when creating a single binary containing multiple
    tools (busybox like)
    - file access like: open/read/write/close
    above functions are implemented on top of these. applications
    can use those to modify several variables without creating a
    temporary batch script file
    tested with "./scripts/kernel-doc -html -v tools/env/fw_env.h"

    Reviewed-by: Simon Glass
    Signed-off-by: Andreas Fenkart

    Andreas Fenkart
     
  • A negative value for the offset is treated as a backwards offset for
    from the end of the device/partition for block devices. This aligns
    the behavior of the config file with the syntax of CONFIG_ENV_OFFSET
    where the functionality has been introduced with
    commit 5c088ee841f9 ("env_mmc: allow negative CONFIG_ENV_OFFSET").

    Signed-off-by: Stefan Agner

    Stefan Agner
     
  • Currently flash_read completes a crucial part of the environment
    device configuration, the device type (mtd_type). This is rather
    confusing as flash_io calls flash_read conditionally, and one might
    think flash_write, which also makes use of mtd_type, gets called
    before flash_read. But since flash_io is always called with O_RDONLY
    first, this is not actually the case in reality.

    However, it is much cleaner to complete and verify the config early
    in parse_config. This also prepares the code for further extension.

    Signed-off-by: Stefan Agner
    Reviewed-by: Andreas Fenkart

    Stefan Agner
     

16 Jul, 2016

1 commit

  • Fix a number of typos, including:

    * "compatble" -> "compatible"
    * "eanbeld" -> "enabled"
    * "envrionment" -> "environment"
    * "FTD" -> "FDT" (for "flattened device tree")
    * "ommitted" -> "omitted"
    * "overriden" -> "overridden"
    * "partiton" -> "partition"
    * "propogate" -> "propagate"
    * "resourse" -> "resource"
    * "rest in piece" -> "rest in peace"
    * "suport" -> "support"
    * "varible" -> "variable"

    Signed-off-by: Robert P. J. Day

    Robert P. J. Day
     

31 May, 2016

1 commit


28 May, 2016

1 commit


27 May, 2016

3 commits