summaryrefslogtreecommitdiffstats
path: root/common/cmd_nvedit.c
Commit message (Collapse)AuthorAgeFilesLines
* Coding Style cleanup: remove trailing white spaceWolfgang Denk2013-10-141-1/+1
| | | | Signed-off-by: Wolfgang Denk <wd@denx.de>
* Add GPL-2.0+ SPDX-License-Identifier to source filesWolfgang Denk2013-07-241-17/+1
| | | | | | Signed-off-by: Wolfgang Denk <wd@denx.de> [trini: Fixup common/cmd_io.c] Signed-off-by: Tom Rini <trini@ti.com>
* env: Fix minor comment typos in cmd_nveditSimon Glass2013-05-141-2/+2
| | | | | | This should say 'environmnent'. Signed-off-by: Simon Glass <sjg@chromium.org>
* "env grep" - add support for regular expression matchesWolfgang Denk2013-05-011-6/+23
| | | | | | | | | | | | | | | | | | | | | | | | | When CONFIG_REGEX is enabled, the new option "-e" becomes available which causes regular expression matches to be used. This allows for example things like these: - print all MAC addresses: => env grep -e eth.*addr eth1addr=00:10:ec:80:c5:15 ethaddr=00:10:ec:00:c5:15 - print all variables that have at least 2 colons in their value: => env grep -v -e :.*: addip=setenv bootargs ${bootargs} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}:${netdev}:off panic=1 eth1addr=00:10:ec:80:c5:15 ethaddr=00:10:ec:00:c5:15 ver=U-Boot 2013.04-rc1-00289-g497746b-dirty (Mar 22 2013 - 12:50:25) etc. Signed-off-by: Wolfgang Denk <wd@denx.de>
* "env grep" - add options to grep in name, value, or both.Wolfgang Denk2013-05-011-5/+33
| | | | | | | | | | | | | | | | | | | | Add options to "env grep" command: -n : search only the envrironment variable names -v : search only their values -b : search both names and values (= default) An option "--" will stop parsing options, so to print variables that contain the striing "- " please use: env grep -- "- " Or to print all environment varioables which have a '-' in their name, use: env grep -n -- - Signed-off-by: Wolfgang Denk <wd@denx.de>
* "env grep" - reimplement command using hexport_r()Wolfgang Denk2013-05-011-18/+12
| | | | | | | Also drop hstrstr_r() which is not needed any more. The new code is way more flexible. Signed-off-by: Wolfgang Denk <wd@denx.de>
* hashtable: preparations to use hexport_r() for "env grep"Wolfgang Denk2013-05-011-3/+7
| | | | | | | | | | The output of "env grep" is unsorted, and printing is done by a private implementation to parse the hash table. We have all the needed code in place in hexport_r() alsready, so let's use this instead. Here we prepare the code for this, without any functional changes yet. Signed-off-by: Wolfgang Denk <wd@denx.de>
* Add getenv_hex() to return an environment variable as hexSimon Glass2013-05-011-0/+15
| | | | | | | | This conversion is required in a number of places in U-Boot. Add a standard function to provide this feature, so we avoid all the different variations in the way it is coded. Signed-off-by: Simon Glass <sjg@chromium.org>
* printenv: Correct out-of-memory condition check.Maxime Larocque2013-04-171-1/+2
| | | | | | | | | | | In common/cmd_nvedit.c, en env_print(), the wrong type is used for len. hexport_r() returns -1 on error (like OOM), which is converted to 0xffffffff when put in an unsigned. Said value is obviously bigger then 0, and as a result an uninitialized string is then displayed. Other usages of hexport_r() in the code correctly uses ssize_t to keep its return value. Signed-off-by: Maxime Larocque <maxmtl2002@yahoo.ca>
* env: Add support for UBI environmentJoe Hershberger2013-04-111-1/+2
| | | | | | | | | UBI is a better place for the environment on NAND devices because it handles wear-leveling and bad blocks. Gluebi is needed in Linux to access the env as an MTD partition. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* mtd: Make mtdparts work with pre-reloc envJoe Hershberger2013-04-111-0/+4
| | | | | | | | | | | | The env in UBI needs to look up the mtd partition as part of relocation, which happens before relocation. Make the mtdparts code capable of working on the default env to start with. The code tries to set values in the env as well, but again, the env isn't there yet, so add a check to setenv to not allow sets before the env is relocated. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* env: fix "env ask" commandWolfgang Denk2013-03-121-26/+28
| | | | | | | | | | | | | | | | | | | | The "env ask" traditionally uses a somewhat awkward syntax: env ask name [message ...] [size] So far, when a mesage was given, you always also had to enter a size. If you forgot to do that, the command would terminate without any indication of the problem. To avoid incompatible changes of the interface, we now check the last argument if it can be converted into a decimal number. If this is the case, we assume it is a size; otherwise we treat it as part of the message. Also, add a space after the message fore easier reading, and clean up help mesage. Signed-off-by: Wolfgang Denk <wd@denx.de>
* env: Avoid clobbering an edited variable on ctrl-cJoe Hershberger2013-03-041-1/+2
| | | | | | If readline says there was an error, don't write to the variable! Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* common: Use new numeric setenv functionsSimon Glass2013-02-281-2/+1
| | | | | | Use setenv_ulong(), setenv_hex() and setenv_addr() in common/ Signed-off-by: Simon Glass <sjg@chromium.org>
* Update set_working_fdt_addr() to use setenv_addr()Simon Glass2013-02-281-4/+4
| | | | | | | We might as well use this common function instead of repeating the same code. Signed-off-by: Simon Glass <sjg@chromium.org>
* env: Implement the env delete commandJoe Hershberger2012-12-131-3/+32
| | | | | | Implement a way to delete more than one variable at a time. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* env: Add setenv force supportJoe Hershberger2012-12-131-6/+23
| | | | | | Now that we have support for permissions, add a way to override them. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* env: Add support for access control to .flagsJoe Hershberger2012-12-131-6/+25
| | | | | | Add support for read-only, write-once, and change-default. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* env: Add a command to display details about env flagsJoe Hershberger2012-12-131-0/+59
| | | | | | | Similar to the env callback command, this will show details about the options available, the static list, and the currently active variables. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* env: Add environment variable flagsJoe Hershberger2012-12-131-49/+1
| | | | | | | | | | | Currently just validates variable types as decimal, hexidecimal, boolean, ip address, and mac address. If the entry is not found in the env ".flags", then look in the static one. This allows the env to override the static definitions, but prevents the need to have every definition in the environment distracting you. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* env: Add a console env handlerJoe Hershberger2012-12-131-33/+3
| | | | | | Remove the hard-coded console handler and use a callback instead Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* env: Add a loadaddr env handlerJoe Hershberger2012-12-131-12/+0
| | | | | | Remove the hard-coded loadaddr handler and use a callback instead Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* env: Add a baudrate env handlerJoe Hershberger2012-12-131-47/+0
| | | | | | Remove the hard-coded baudrate handler and use a callback instead Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* env: Add a bootfile env handlerJoe Hershberger2012-12-131-9/+0
| | | | | | Remove the hard-coded bootfile handler and use a callback instead Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* env: Add a command to view callbacksJoe Hershberger2012-12-131-0/+81
| | | | | | | | | The callbacks can be bound, but are otherwise invisible. Add a command to show what callbacks are available. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> !!! fix callback command
* env: Hide '.' variables in env print by defaultJoe Hershberger2012-12-131-9/+17
| | | | | | | | | | When printing all variables with env print, don't print variables that begin with '.'. If env print is called with a '-a' switch, then include variables that begin with '.' (just like the ls command). Variables printed explicitly will be printed even without the -a. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* env: Refactor apply into change_okJoe Hershberger2012-12-131-19/+15
| | | | | | | | | | | | | | | | Move the read of the old value to inside the check function. In some cases it can be avoided all together and at the least the code is only called from one place. Also name the function and the callback to more clearly describe what it does. Pass the ENTRY instead of just the name for direct access to the whole data structure. Pass an enum to the callback that specifies the operation being approved. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* env: Refactor do_apply to a flagJoe Hershberger2012-12-131-10/+9
| | | | | | | | | | Use a flag in hsearch_r for insert mode passed from import to allow the behavior be different based on use. Now that "do_check" is called for all imports, ensure console init is complete before updating the console on relocation import Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* common/cmd_*.c: sparse fixesKim Phillips2012-11-041-9/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | cmd_boot.c:40:5: warning: symbol 'do_go' was not declared. Should it be static? cmd_bootm.c:164:6: warning: symbol '__arch_preboot_os' was not declared. Should it be static? cmd_bootm.c:477:5: warning: symbol 'do_bootm_subcommand' was not declared. Should it be static? cmd_bootm.c:1022:1: error: directive in argument list cmd_bootm.c:1028:1: error: directive in argument list cmd_bootm.c:1029:1: error: directive in argument list cmd_bootm.c:1036:1: error: directive in argument list cmd_bootm.c:1042:1: error: directive in argument list cmd_bootm.c:1044:1: error: directive in argument list cmd_bootm.c:1045:1: error: directive in argument list cmd_bootm.c:1047:1: error: directive in argument list cmd_bootm.c:1089:5: warning: symbol 'do_iminfo' was not declared. Should it be static? cmd_bootm.c:1176:5: warning: symbol 'do_imls' was not declared. Should it be static? cmd_bootm.c:1654:1: error: directive in argument list cmd_bootm.c:1660:1: error: directive in argument list cmd_console.c:32:5: warning: symbol 'do_coninfo' was not declared. Should it be s cmd_date.c:46:5: warning: symbol 'do_date' was not declared. Should it be static? cmd_echo.c:27:5: warning: symbol 'do_echo' was not declared. Should it be static? cmd_exit.c:27:5: warning: symbol 'do_exit' was not declared. Should it be static? cmd_fat.c:97:5: warning: symbol 'do_fat_ls' was not declared. Should it be static? cmd_fat.c:136:5: warning: symbol 'do_fat_fsinfo' was not declared. Should it be s cmd_fdt.c:66:5: warning: symbol 'do_fdt' was not declared. Should it be static? cmd_fdt.c:542:43: warning: incorrect type in assignment (different base types) cmd_fdt.c:542:43: expected unsigned int [unsigned] [usertype] <noident> cmd_fdt.c:542:43: got restricted __be32 [usertype] <noident> cmd_fdt.c:679:42: warning: cast to restricted __be32 cmd_fdt.c:820:1: error: directive in argument list cmd_fdt.c:822:1: error: directive in argument list cmd_flash.c:292:5: warning: symbol 'do_flinfo' was not declared. Should it be static? cmd_flash.c:324:5: warning: symbol 'do_flerase' was not declared. Should it be static? cmd_flash.c:457:5: warning: symbol 'do_protect' was not declared. Should it be st cmd_help.c:27:5: warning: symbol 'do_help' was not declared. Should it be static? cmd_i2c.c:136:6: warning: symbol '__def_i2c_init_board' was not declared. Should it be static? cmd_i2c.c:144:14: warning: symbol '__def_i2c_get_bus_speed' was not declared. Should it be static? cmd_i2c.c:151:5: warning: symbol '__def_i2c_set_bus_speed' was not declared. Should it be static? cmd_i2c.c:1322:1: error: directive in argument list cmd_i2c.c:1324:1: error: directive in argument list cmd_i2c.c:1326:1: error: directive in argument list cmd_i2c.c:1328:1: error: directive in argument list cmd_i2c.c:1337:1: error: directive in argument list cmd_i2c.c:1339:1: error: directive in argument list cmd_irq.c:27:5: warning: symbol 'do_interrupts' was not declared. Should it be static? cmd_itest.c:133:5: warning: symbol 'binary_test' was not declared. Should it be static? cmd_itest.c:158:5: warning: symbol 'do_itest' was not declared. Should it be stat cmd_load.c:54:5: warning: symbol 'do_load_serial' was not declared. Should it be static? cmd_load.c:431:6: warning: symbol 'his_eol' was not declared. Should it be static? cmd_load.c:432:6: warning: symbol 'his_pad_count' was not declared. Should it be static? cmd_load.c:433:6: warning: symbol 'his_pad_char' was not declared. Should it be static? cmd_load.c:434:6: warning: symbol 'his_quote' was not declared. Should it be static? cmd_load.c:436:5: warning: symbol 'do_load_serial_bin' was not declared. Should it be static? cmd_load.c:549:6: warning: symbol 'send_pad' was not declared. Should it be static? cmd_load.c:558:6: warning: symbol 'ktrans' was not declared. Should it be static? cmd_load.c:568:5: warning: symbol 'chk1' was not declared. Should it be static? cmd_load.c:578:6: warning: symbol 's1_sendpacket' was not declared. Should it be static? cmd_load.c:587:6: warning: symbol 'send_ack' was not declared. Should it be static? cmd_load.c:600:6: warning: symbol 'send_nack' was not declared. Should it be static? cmd_load.c:614:6: warning: symbol 'os_data_init' was not declared. Should it be static? cmd_load.c:615:6: warning: symbol 'os_data_char' was not declared. Should it be static? cmd_load.c:657:6: warning: symbol 'k_data_init' was not declared. Should it be static? cmd_load.c:663:6: warning: symbol 'k_data_save' was not declared. Should it be static? cmd_load.c:669:6: warning: symbol 'k_data_restore' was not declared. Should it be static? cmd_load.c:675:6: warning: symbol 'k_data_char' was not declared. Should it be static? cmd_load.c:693:6: warning: symbol 'send_parms' was not declared. Should it be static? cmd_load.c:694:6: warning: symbol 'send_ptr' was not declared. Should it be static? cmd_load.c:698:6: warning: symbol 'handle_send_packet' was not declared. Should i cmd_mdio.c:60:5: warning: symbol 'mdio_write_ranges' was not declared. Should it be static? cmd_mdio.c:82:5: warning: symbol 'mdio_read_ranges' was not declared. Should it be static? cmd_mdio.c:115:5: warning: symbol 'extract_reg_range' was not declared. Should it be static? cmd_mdio.c:144:5: warning: symbol 'extract_phy_range' was not declared. Should it cmd_mem.c:54:5: warning: symbol 'do_mem_md' was not declared. Should it be static? cmd_mem.c:150:5: warning: symbol 'do_mem_mm' was not declared. Should it be static? cmd_mem.c:154:5: warning: symbol 'do_mem_nm' was not declared. Should it be static? cmd_mem.c:159:5: warning: symbol 'do_mem_mw' was not declared. Should it be static? cmd_mem.c:256:5: warning: symbol 'do_mem_cmp' was not declared. Should it be static? cmd_mem.c:326:5: warning: symbol 'do_mem_cp' was not declared. Should it be static? cmd_mem.c:436:5: warning: symbol 'do_mem_base' was not declared. Should it be static? cmd_mem.c:449:5: warning: symbol 'do_mem_loop' was not declared. Should it be static? cmd_mem.c:595:5: warning: symbol 'do_mem_mtest' was not declared. Should it be static? cmd_mem.c:618:26: warning: Using plain integer as NULL pointer cmd_mem.c:1057:5: warning: symbol 'do_mem_crc' was not declared. Should it be static? cmd_misc.c:30:5: warning: symbol 'do_sleep' was not declared. Should it be static cmd_mmc.c:118:5: warning: symbol 'do_mmcinfo' was not declared. Should it be static? cmd_mmc.c:272:32: warning: Using plain integer as NULL pointer cmd_mmc.c:150:5: warning: symbol 'do_mmcops' was not declared. Should it be stati cmd_mp.c:27:1: warning: symbol 'cpu_cmd' was not declared. Should it be static? cmd_mp.c:85:1: error: directive in argument list cmd_mp.c:88:1: error: directive in argument list cmd_mtdparts.c:150:18: warning: symbol 'mtdids' was not declared. Should it be static? cmd_mtdparts.c:153:18: warning: symbol 'devices' was not declared. Should it be static? cmd_mtdparts.c:713:5: warning: symbol 'mtd_device_validate' was not declared. Should it be static? cmd_mtdparts.c:1887:5: warning: symbol 'do_chpart' was not declared. Should it be static? cmd_mtdparts.c:1925:5: warning: symbol 'do_mtdparts' was not declared. Should it be static? cmd_mtdparts.c:2060:1: error: directive in argument list cmd_mtdparts.c:2063:1: error: directive in argument list cmd_mtdparts.c:2066:1: error: directive in argument list cmd_mtdparts.c:2071:1: error: directive in argument list cmd_mtdparts.c:2073:1: error: directive in argument list cmd_nand.c:377:18: error: bad constant expression cmd_nand.c:431:5: warning: symbol 'do_nand' was not declared. Should it be static? cmd_nand.c:796:1: error: directive in argument list cmd_nand.c:801:1: error: directive in argument list cmd_nand.c:802:1: error: directive in argument list cmd_nand.c:806:1: error: directive in argument list cmd_nand.c:819:1: error: directive in argument list cmd_nand.c:824:1: error: directive in argument list cmd_nand.c:825:1: error: directive in argument list cmd_nand.c:831:1: error: directive in argument list cmd_nand.c:918:5: warning: symbol 'do_nandboot' was not declared. Should it be static? cmd_net.c:33:5: warning: symbol 'do_bootp' was not declared. Should it be static? cmd_net.c:107:5: warning: symbol 'do_dhcp' was not declared. Should it be static? cmd_net.c:120:5: warning: symbol 'do_nfs' was not declared. Should it be static? cmd_nvedit.c:138:5: warning: symbol 'do_env_print' was not declared. Should it be static? cmd_nvedit.c:323:5: warning: symbol '_do_env_set' was not declared. Should it be static? cmd_nvedit.c:435:5: warning: symbol 'do_env_set' was not declared. Should it be static? cmd_nvedit.c:514:5: warning: symbol 'do_env_edit' was not declared. Should it be static? cmd_nvedit.c:620:5: warning: symbol 'do_env_save' was not declared. Should it be static? cmd_nvedit.c:1016:1: error: directive in argument list cmd_nvedit.c:1018:1: error: directive in argument list cmd_nvedit.c:1021:1: error: directive in argument list cmd_nvedit.c:1023:1: error: directive in argument list cmd_nvedit.c:1024:1: error: directive in argument list cmd_nvedit.c:1026:1: error: directive in argument list cmd_nvedit.c:1027:1: error: directive in argument list cmd_nvedit.c:1029:1: error: directive in argument list cmd_nvedit.c:1030:1: error: directive in argument list cmd_nvedit.c:1032:1: error: directive in argument list cmd_nvedit.c:1034:1: error: directive in argument list cmd_nvedit.c:1036:1: error: directive in argument list cmd_nvedit.c:1037:1: error: directive in argument list cmd_nvedit.c:1039:1: error: directive in argument list cmd_pci.c:38:17: warning: symbol 'ShortPCIListing' was not declared. Should it be static? cmd_pci.c:38:22: warning: 'ShortPCIListing' defined but not used [-Wunused-variable] cmd_pci.c:411:5: warning: symbol 'do_pci' was not declared. Should it be static? cmd_pci.c:494:1: error: directive in argument list cmd_pci.c:497:1: error: directive in argument list cmd_reginfo.c:40:5: warning: symbol 'do_reginfo' was not declared. Should it be static? cmd_sata.c:31:5: warning: symbol 'sata_curr_device' was not declared. Should it be static? note -> ata_piix.c doesn't seem to use 'sata_curr_device'; deleted. cmd_sata.c:32:18: warning: symbol 'sata_dev_desc' was not declared. Should it be static? cmd_sata.c:70:5: warning: symbol 'do_sata' was not declared. Should it be static? cmd_setexpr.c:53:5: warning: symbol 'do_setexpr' was not declared. Should it be static? cmd_source.c:186:1: error: directive in argument list cmd_source.c:190:1: error: directive in argument list cmd_test.c:27:5: warning: symbol 'do_test' was not declared. Should it be static? cmd_test.c:153:5: warning: symbol 'do_false' was not declared. Should it be static? cmd_test.c:164:5: warning: symbol 'do_true' was not declared. Should it be static cmd_usb.c:43:6: warning: symbol 'usb_get_class_desc' was not declared. Should it be static? cmd_usb.c:69:6: warning: symbol 'usb_display_class_sub' was not declared. Should it be static? cmd_usb.c:151:6: warning: symbol 'usb_display_string' was not declared. Should it be static? cmd_usb.c:161:6: warning: symbol 'usb_display_desc' was not declared. Should it be static? cmd_usb.c:195:6: warning: symbol 'usb_display_conf_desc' was not declared. Should it be static? cmd_usb.c:210:6: warning: symbol 'usb_display_if_desc' was not declared. Should it be static? cmd_usb.c:227:6: warning: symbol 'usb_display_ep_desc' was not declared. Should it be static? cmd_usb.c:252:6: warning: symbol 'usb_display_config' was not declared. Should it be static? cmd_usb.c:283:6: warning: symbol 'usb_show_tree_graph' was not declared. Should it be static? cmd_usb.c:343:6: warning: symbol 'usb_show_tree' was not declared. Should it be static? cmd_usb.c:356:5: warning: symbol 'do_usbboot' was not declared. Should it be static? cmd_usb.c:366:5: warning: symbol 'do_usb' was not declared. Should it be static? cmd_version.c:31:5: warning: symbol 'do_version' was not declared. Should it be s cmd_ximg.c:46:1: warning: symbol 'do_imgextract' was not declared. Should it be static? cmd_ximg.c:272:1: error: directive in argument list cmd_ximg.c:276:1: error: directive in argument list Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
* serial: remove calls to serial_assign()Allen Martin2012-10-261-3/+0
| | | | | | | | | | | | | | Remove calls to serial_assign() that are failing now that it returns a proper error code. This calls were not actually doing anything because they passed the name of a stdio_dev when a serial_device name is exptectd. Signed-off-by: Allen Martin <amartin@nvidia.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Marek Vasut <marex@denx.de> Acked-by: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org> Tested-by: Stephen Warren <swarren@nvidia.com>
* env: Check for NULL pointer in envmatch()Joe Hershberger2012-10-151-0/+3
| | | | | | | If the pointer passed into envmatch() is NULL, return -1 instead of crashing. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* serial: Remove CONFIG_SERIAL_MULTI from remaining sourcesMarek Vasut2012-10-151-2/+0
| | | | | | | | | | | | Remove the parts depending either on disabled CONFIG_SERIAL_MULTI or ifdefs around CONFIG_SERIAL_MULTI parts since CONFIG_SERIAL_MULTI is now enabled by default. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Marek Vasut <marek.vasut@gmail.com> Cc: Tom Rini <trini@ti.com> Cc: Anatolij Gustschin <agust@denx.de> Cc: Stefan Roese <sr@denx.de>
* COMMON: Use __stringify() instead of MK_STR()Marek Vasut2012-10-151-4/+1
| | | | | | | | | Kill multiple occurances and redeclaration of MK_STR in favor of __stringify(). Signed-off-by: Marek Vasut <marex@denx.de> Cc: Wolfgang Denk <wd@denx.de> Signed-off-by: Tom Rini <trini@ti.com>
* env: fix crash using default -f -aGerlando Falauto2012-10-051-0/+3
| | | | | | | | | | | env default -a -f calls env_check_apply on all existing environment variables with a NULL value for "newval" as a way of cleaning up. This causes string manipulation functions to crash on most architectures. So replace a NULL argument with an empty string. Reported-By: Stefano Babic <sbabic@denx.de> Signed-off-by: Gerlando Falauto <gerlando.falauto@keymile.com> Tested-by: Stefano Babic <sbabic@denx.de>
* OMAP: networking support for SPLIlya Yanok2012-10-011-0/+8
| | | | | | | | | | | | | | This patch adds support for networking in SPL. Some devices are capable of loading SPL via network so it makes sense to load the main U-Boot binary via network too. This patch tries to use existing network code as much as possible. Unfortunately, it depends on environment which in turn depends on other code so SPL size is increased significantly. No effort was done to decouple network code and environment so far. Signed-off-by: Ilya Yanok <ilya.yanok@cogentembedded.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com> Signed-off-by: Tom Rini <trini@ti.com>
* env: make "env default" selective, check and applyGerlando Falauto2012-09-181-6/+34
| | | | | | | | | | | | Change the syntax (user API) for "env default": -f: override write-once variables var... : accept individual variable(s) -a: all (resetting the whole env is NOT the default behavior) Enable variable checking and make changes effective by enabling do_apply argument to himport_r(). Signed-off-by: Gerlando Falauto <gerlando.falauto@keymile.com>
* env: check and apply changes on delete/destroyGerlando Falauto2012-09-181-1/+1
| | | | | Signed-off-by: Gerlando Falauto <gerlando.falauto@keymile.com> Reviewed-by: Marek Vasut <marex@denx.de>
* env: add check/apply logic to himport_r()Gerlando Falauto2012-09-181-1/+2
| | | | | | | | | | | | | | | | | | | Change hashtable so that a callback function will decide whether a variable can be overwritten, and possibly apply the changes. So add a new field to struct hsearch_data: o "apply" callback function to check whether a variable can be overwritten, and possibly immediately apply the changes; when NULL, no check is performed. And a new argument to himport_r(): o "do_apply": whether to call the apply callback function NOTE: This patch does not change the current behavior. Signed-off-by: Gerlando Falauto <gerlando.falauto@keymile.com> Reviewed-by: Marek Vasut <marex@denx.de>
* env: make himport_r() selective on variablesGerlando Falauto2012-09-181-1/+2
| | | | | | | | | | | | Add 2 new arguments to himport_r(): o "nvars", "vars": number and list of variables to take into account (0 means ALL) NOTE: This patch does not change the current behaviour. Signed-off-by: Gerlando Falauto <gerlando.falauto@keymile.com> Reviewed-by: Marek Vasut <marex@denx.de>
* env: unify logic to check and apply changesGerlando Falauto2012-09-181-49/+92
| | | | | | | | | | | | | | The logic of checking special parameters (e.g. baudrate, stdin, stdout, for a valid value and/or whether can be overwritten) and applying the new value to the running system is now all within a single function env_check_apply() which can be called whenever changes are made to the environment, no matter if by set, default or import. With this patch env_check_apply() is only called by "env set", retaining previous behavior. Signed-off-by: Gerlando Falauto <gerlando.falauto@keymile.com> Reviewed-by: Marek Vasut <marex@denx.de>
* env: cosmetic: drop assignment i = iomux_doenv()Gerlando Falauto2012-09-181-3/+2
| | | | | | | | | iomux_doenv() can only return 0 or 1. So there is no need to save its return value in variable i, as checking its truth value within an if statement is enough. Signed-off-by: Gerlando Falauto <gerlando.falauto@keymile.com> Reviewed-by: Marek Vasut <marex@denx.de>
* env import/export: Remove from help if disabledBenoît Thébaudeau2012-09-181-0/+4
| | | | | | Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com> Cc: Wolfgang Denk <wd@denx.de> Acked-by: Mike Frysinger <vapier@gentoo.org>
* Block: Remove MG DISK supportMarek Vasut2012-06-211-2/+1
| | | | | | | | This driver is unused and obsolete. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Wolfgang Denk <wd@denx.de> Cc: unsik Kim <donari75@gmail.com>
* common/cmd_nvedit.c: Fix GCC 4.6 warningAnatolij Gustschin2012-05-221-1/+0
| | | | | | | cmd_nvedit.c: In function '_do_env_set': cmd_nvedit.c:207:9: warning: unused variable 'bd' [-Wunused-variable] Signed-off-by: Anatolij Gustschin <agust@denx.de>
* net: punt bd->bi_ip_addrMike Frysinger2012-05-151-15/+1
| | | | | | | | | This field gets read in one place (by "bdinfo"), and we can replace that with getenv("ipaddr"). After all, the bi_ip_addr field is kept up-to-date implicitly with the value of the ipaddr env var. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
* powerpc/corenet_ds: Slave reads ENV from master when boot from SRIOLiu Gang2012-04-241-1/+2
| | | | | | | | | | | | | | | | | | | | When boot from SRIO, slave's ENV can be stored in master's memory space, then slave can fetch the ENV through SRIO interface. NOTE: Because the slave can not erase, write master's NOR flash by SRIO interface, so it can not modify the ENV parameters stored in master's NOR flash using "saveenv" or other commands. Master needs to: 1. Put the slave's ENV into it's own memory space. 2. Set an inbound SRIO window covered slave's ENV stored in master's memory space. Slave needs to: 1. Set a specific TLB entry in order to fetch ucode and ENV from master. 2. Set a LAW entry with the TargetID SRIO1 or SRIO2 for ucode and ENV. Signed-off-by: Liu Gang <Gang.Liu@freescale.com> Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
* Add support for loading and saving the environment to a FAT partitionMaximilian Schwerin2012-03-301-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | The following must be defined: CONFIG_ENV_IS_IN_FAT Enable this saving environment to FAT. FAT_ENV_INTERFACE Interface the FAT resides on (e.g. mmc). FAT_ENV_DEVICE The interface device number (e.g. 0 for mmc0) FAT_ENV_PART The device part (e.g. 1 for mmc0:1) FAT_ENV_FILE The filename of the environment file. Author: Maximilian Schwerin <mvs@tigris.de> Removed dead DEBUG comment. Signed-off-by: Wolfgang Denk <wd@denx.de>
* Convert cmd_usage() calls in common to use a return valueSimon Glass2012-03-061-11/+11
| | | | | | | | | Change all files in common/ to use CMD_RET_USAGE instead of calling cmd_usage() directly. I'm not completely sure about this patch since the code since impact is small (100 byte or so on ARM) and it might need splitting into smaller patches. But for now here it is. Signed-off-by: Simon Glass <sjg@chromium.org>
* common: add possibility for readline_into_buffer timeoutHeiko Schocher2012-02-121-1/+1
| | | | | | | | | add possibility to add a timeout when reading a line into a buffer. Signed-off-by: Heiko Schocher <hs@denx.de> Cc: Mike Frysinger <vapier@gentoo.org> Acked-by: Mike Frysinger <vapier@gentoo.org>
* common/cmd_nvedit.c: Fix size calculation in do_env_import()Horst Kronstorfer2011-12-191-1/+1
| | | | | | | | do_env_import() missed the final '\0' terminator when calculating the size of an environment data block. This led to an erroneous 'bad CRC, import failed' message for a checksum protected environment (-c.) Signed-off-by: Horst Kronstorfer <hkronsto@frequentis.com>
OpenPOWER on IntegriCloud