aboutsummaryrefslogtreecommitdiff
path: root/tools/env/fw_env_main.c
AgeCommit message (Collapse)AuthorFilesLines
2019-08-11env: Move env_set() to env.hSimon Glass1-0/+1
Move env_set() over to the new header file. Acked-by: Joe Hershberger <joe.hershberger@ni.com> Signed-off-by: Simon Glass <sjg@chromium.org>
2018-05-07SPDX: Convert all of our single license tags to Linux Kernel styleTom Rini1-2/+1
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 <trini@konsulko.com>
2018-04-10fw_printenv: Fix crash due to incorrect size for malloc'ed string.Kristian Amlie1-1/+1
Using sizeof gives the size of the pointer only, not the string. This could easily lead to crashes when using -l argument. Signed-off-by: Kristian Amlie <kristian.amlie@northern.tech>
2018-02-14Fix --noheader on fw_printenvAlex Kiernan1-1/+1
The single argument `--noheader' is expecting isn't taken from getopt parsing, but instead from the remaining argv arguments. Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
2017-11-21env: Remove CONFIG_ENV_AES supportTom Rini1-14/+0
This support has been deprecated since v2017.09 due to security issues. We now remove this support. Signed-off-by: Tom Rini <trini@konsulko.com>
2017-11-06tools: env: allow to print U-Boot versionStefan Agner1-3/+11
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 <stefan.agner@toradex.com> Reviewed-by: Lukasz Majewski <lukma@denx.de>
2017-08-16env: Rename setenv() to env_set()Simon Glass1-4/+4
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 <wd@denx.de> Signed-off-by: Simon Glass <sjg@chromium.org>
2017-04-12env: split fw_env.h in public and private partsStefano Babic1-0/+1
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 <sbabic@denx.de>
2016-10-08env: tool: add command line option to input lockfile pathB, Ravi1-6/+29
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 <lockfile path> Signed-off-by: Ravi Babu <ravibabu@ti.com>
2016-05-27tools/env: no global variable sharing between application and libraryAndreas Fenkart1-10/+18
Signed-off-by: Andreas Fenkart <andreas.fenkart@digitalstrom.com>
2016-05-27tools/env: fw_printenv pass value_only as argumentAndreas Fenkart1-2/+2
Signed-off-by: Andreas Fenkart <andreas.fenkart@digitalstrom.com>
2016-03-27tools: env: bug: config structs must be defined in tools libraryAndreas Fenkart1-4/+0
fw_senten/fw_printenv can be compiled as a tools library, excluding the fw_env_main object. Reported-by: Stefano Babic <sbabic@denx.de> Signed-off-by: Andreas Fenkart <andreas.fenkart@digitalstrom.com>
2016-03-22Fix spelling of "comment".Vagrant Cascadian1-1/+1
Signed-off-by: Vagrant Cascadian <vagrant@debian.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2016-02-08tools: env: update usage stringsAndreas Fenkart1-42/+75
Signed-off-by: Andreas Fenkart <andreas.fenkart@digitalstrom.com>
2016-02-08tools: env: factor out parse_common_argsAndreas Fenkart1-25/+37
Signed-off-by: Andreas Fenkart <andreas.fenkart@digitalstrom.com>
2016-02-08tools: env: shift optind arguments and fix argument indicesAndreas Fenkart1-0/+4
Signed-off-by: Andreas Fenkart <andreas.fenkart@digitalstrom.com>
2016-02-08tools: env: parse aes key / suppress flag into argument structAndreas Fenkart1-5/+26
disabled original parsing, but not yet removed since the argument indexing needs to be fixed Signed-off-by: Andreas Fenkart <andreas.fenkart@digitalstrom.com>
2016-02-08tools: env: introduce setenv/printenv argument structsAndreas Fenkart1-38/+75
goal is to use getopt for all argument parsing instead of adhoc parsing in fw_getenv/fw_setenv functions Signed-off-by: Andreas Fenkart <andreas.fenkart@digitalstrom.com>
2015-11-18tools/env: allow config filename to be passed via command line argumentMichael Heimpold1-1/+9
When for example generating/manipulating SD card/eMMC images which contain U-Boot and its environment(s), it is handy to use a given configuration file instead of the compiled-in default one. And since the default configuration file is expected under /etc it's hard for an usual linux user account without special permissions to use fw_printenv/fw_setenv for this purpose. So allow to pass an optional filename via a new '-c' command line argument. Example: $ ln -s fw_printenv tools/env/fw_setenv $ cat fw_env.config test.img 0x20000 0x20000 test.img 0x40000 0x20000 $ tools/env/fw_printenv -c ./fw_env.config fdt_file fdt_file=imx28-duckbill.dtb $ tools/env/fw_setenv -c ./fw_env.config fdt_file imx28-duckbill-spi.dtb $ tools/env/fw_printenv -c ./fw_env.config fdt_file fdt_file=imx28-duckbill-spi.dtb Signed-off-by: Michael Heimpold <mhei@heimpold.de>
2014-03-21env: Implement support for AES encryption into fw_* toolsMarek Vasut1-5/+12
Implement support for encrypting/decrypting the environment block into the tools/env/fw_* tools. The cipher used is AES 128 CBC and the implementation depends solely on components internal to U-Boot. To allow building against the internal AES library, the library did need minor adjustments to not include U-Boot's headers which are not wanted to be included and define missing types. Signed-off-by: Marek Vasut <marex@denx.de>
2013-10-14Coding Style cleanup: remove trailing white spaceWolfgang Denk1-1/+1
Signed-off-by: Wolfgang Denk <wd@denx.de>
2013-07-24Add GPL-2.0+ SPDX-License-Identifier to source filesWolfgang Denk1-17/+1
Signed-off-by: Wolfgang Denk <wd@denx.de> [trini: Fixup common/cmd_io.c] Signed-off-by: Tom Rini <trini@ti.com>
2012-12-19fw_env: fix incorrect usage of open(O_CREAT)Mike Frysinger1-1/+1
When using open(), the O_CREAT flag must be given a mode, otherwise it uses random garbage from the stack. Also, it can fail to build: In file included from /usr/include/fcntl.h:290:0, from fw_env_main.c:42: In function 'open', inlined from 'main' at fw_env_main.c:97:9: /usr/include/bits/fcntl2.h:50:24: error: call to '__open_missing_mode' declared with attribute error: open with O_CREAT in second argument needs 3 arguments Signed-off-by: Mike Frysinger <vapier@gentoo.org> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2012-10-15tools/env: Serialize calls to fw_*envJoe Hershberger1-22/+37
Use a lock file at /var/lock/fw_printenv.lock. Avoids seriously confusing the MTD driver. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2010-09-18tools/env: fail on invalid optionsDaniel Hobi1-0/+4
Signed-off-by: Daniel Hobi <daniel.hobi@schmid-telecom.ch>
2010-09-18tools/env: allow option "-n" for fw_printenvDaniel Hobi1-2/+5
In commit bd7b26f8 (Tools: set multiple variable with fw_setenv utility), the option parsing was changed to getopt_long(3), but option "-n" of fw_printenv was not included. This leads to an error message "invalid option -- 'n'" on stderr, although the output on stdout is correct. Signed-off-by: Daniel Hobi <daniel.hobi@schmid-telecom.ch>
2010-06-29Tools: set multiple variable with fw_setenv utilityStefano Babic1-7/+60
Add a sort of batch mode to fw_setenv, allowing to set multiple variables in one shot, without updating the flash after each set as now. It is added the possibility to pass a config file with a list of pairs <variable, value> to be set, separated by a TAB character. Signed-off-by: Stefano Babic <sbabic@denx.de>
2008-05-09Propagate Error Status to the Shell on fw_printenv ErrorsGrant Erickson1-11/+14
Changed implementation such that fw_printenv returns failure status when one or more specified variables do not exist or when incorrect command syntax is used. This aids scripting fw_printenv such that the script can key of the return status rather than relying on standard error "scraping". Signed-off-by: Grant Erickson <gerickson@nuovations.com> Signed-off-by: Wolfgang Denk <wd@denx.de>
2003-03-12* Patch by Josef Wagner, 12 Mar 2003:wdenk1-1/+1
- 16/32 MB and 50/80 MHz support with auto-detection for IP860 - ETH05 and BEDBUG support for CU824 - added support for MicroSys CPC45 - new BOOTROM/FLASH0 and DOC base for PM826 * Patch by Robert Schwebel, 12 Mar 2003: Fix the chpart command on innokom board * Name cleanup: mv include/asm-i386/ppcboot-i386.h include/asm-i386/u-boot-i386.h s/PPCBoot/U-Boot/ in some files s/pImage/uImage/ in some files * Patch by Detlev Zundel, 15 Jan 2003: Fix '' command line quoting * Patch by The LEOX team, 19 Jan 2003: - add support for the ELPT860 board - add support for Dallas ds164x RTC
2002-12-17* Use 1-byte-read instead of -write for iprobe() functionwdenk1-0/+78
Add i2c commands to PM826 config * extend I2C POST code: check for list on known addresses