summaryrefslogtreecommitdiffstats
path: root/common/main.c
Commit message (Collapse)AuthorAgeFilesLines
* CONFIG_BOOTDELAY default should not affect runtimeJoe Hershberger2013-03-121-8/+6
| | | | | | | | | | | Because the code that handles bootdelay is compiled in conditionally based on the default value, you are restricted in the default, regardless of what you want the runtime options to be. Change the source to always check if any default is given so that other values can be selected and used at runtime. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* common/main: move set_working_fdt_addr to enable usage of $fdtaddrBarak Wasserstrom2013-03-121-4/+4
| | | | | | | When using $fdtaddr in $bootcmd and $bootcmd is automatically called, $fdtaddr is yet not defined. Signed-off-by: Barak Wasserstrom <wbarak@gmail.com>
* cmd_time: merge run_command_and_time_it with cmd_processRichard Genoud2013-02-041-1/+1
| | | | | | | | | | As far as every arch has a get_timer function, run_command_and_time_it code can now disappear. Signed-off-by: Richard Genoud <richard.genoud@gmail.com> Acked-By: Che-Liang Chiou <clchiou@chromium.org> [trini: s/ulong/unsigned long/ in command.h portion] Signed-off-by: Tom Rini <trini@ti.com>
* console: USB: KBD: Fix incorrect autoboot timeoutJim Lin2013-02-041-5/+5
| | | | | | | | | Autoboot timeout defined by CONFIG_BOOTDELAY will not be accurate if CONFIG_USB_KEYBOARD and CONFIG_SYS_USB_EVENT_POLL are defined in configuration file and when tstc() function for checking key pressed takes longer time than 10 ms (e.g., 50 ms) to finish. Signed-off-by: Jim Lin <jilin@nvidia.com>
* Merge remote-tracking branch 'u-boot/master' into u-boot-arm-mergedAllen Martin2012-12-191-3/+103
|\ | | | | | | | | | | | | | | | | | | | | | | Conflicts: README arch/arm/cpu/armv7/exynos/clock.c board/samsung/universal_c210/universal.c drivers/misc/Makefile drivers/power/power_fsl.c include/configs/mx35pdk.h include/configs/mx53loco.h include/configs/seaboard.h
| * Add new bootstage step for the main loopSimon Glass2012-12-111-0/+2
| | | | | | | | | | | | Mark when we get to the main loop. Signed-off-by: Simon Glass <sjg@chromium.org>
| * fdt: Correct global_data condition in mainSimon Glass2012-11-281-2/+0
| | | | | | | | | | | | | | | | We need an extra condition here in case we want to use fdt without the silent console/cmdline editing/post options. It is easier to just remove the #ifdef. Signed-off-by: Simon Glass <sjg@chromium.org>
| * fdt: Set kernaddr if fdt indicates a kernel is presentSimon Glass2012-11-121-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If kernel-offset is specified in the fdt, set an environment variable so that scripts can access the attached kernel. This can be used by a packaging program to tell U-Boot about a kernel that has been downloaded alongside U-Boot. The value in the fdt is the offset of the kernel from the start of the U-Boot image, so we can find it just by adding CONFIG_SYS_TEXT_BASE. It is then fairly easy to put something like this in the environment variables in the board header file: "if test ${kernaddr} != \"\"; then "\ "echo \"Using bundled kernel\"; "\ "bootm ${kernaddr};" \ "fi; "\ /* rest of boot sequence follows here */ Signed-off-by: Simon Glass <sjg@chromium.org>
| * fdt: Allow device tree to specify secure bootingDoug Anderson2012-11-121-0/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | When secure booting is chosen: * The u-boot shell is never invoked during boot--we just do a simple table lookup to find the command. This means we could even remove the shell parsing from u-boot and still be able to boot. * The boot command can't be interruped. * Failure doesn't cause us to fall back to the shell. Signed-off-by: Gabe Black <gabeblack@google.com> Signed-off-by: Doug Anderson <dianders@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
| * fdt: Tell the FDT library where the device tree isGabe Black2012-11-121-0/+8
| | | | | | | | | | | | | | | | | | | | | | This change adds a call to set_working_fdt_addr near the end of u-boot initialization which tells the fdt command/library where the device tree is. This makes it possible to use the fdt command to look at the active device tree since otherwise there would be no way to know what address it was at to set things up manually. Signed-off-by: Gabe Black <gabeblack@google.com> Signed-off-by: Simon Glass <sjg@chromium.org>
| * fdt: Load boot command from device treeChe-Liang Chiou2012-11-121-1/+15
| | | | | | | | | | | | | | | | Load boot command from /config/bootcmd of device tree if present. Signed-off-by: Tom Wai-Hong Tam <waihong@chromium.org> Signed-off-by: Che-Liang Chiou <clchiou@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
* | lcd: Add support for flushing LCD fb from dcache after updateSimon Glass2012-11-191-2/+10
|/ | | | | | | | This provides an option for the LCD to flush the dcache after each update (puts, scroll or clear). Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Warren <twarren@nvidia.com>
* common/misc: sparse fixesKim Phillips2012-11-041-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | command.c:44:38: error: bad constant expression dlmalloc.c:1468:2: warning: Using plain integer as NULL pointer dlmalloc.c:1468:5: warning: Using plain integer as NULL pointer dlmalloc.c:2176:12: warning: Using plain integer as NULL pointer dlmalloc.c:2179:31: warning: Using plain integer as NULL pointer dlmalloc.c:2382:14: warning: Using plain integer as NULL pointer dlmalloc.c:2436:14: warning: Using plain integer as NULL pointer dlmalloc.c:2582:31: warning: Using plain integer as NULL pointer dlmalloc.c:2585:17: warning: Using plain integer as NULL pointer dlmalloc.c:2646:14: warning: Using plain integer as NULL pointer dlmalloc.c:2659:19: warning: Using plain integer as NULL pointer dlmalloc.c:2692:19: warning: Using plain integer as NULL pointer dlmalloc.c:2707:19: warning: Using plain integer as NULL pointer dlmalloc.c:2708:14: warning: Using plain integer as NULL pointer dlmalloc.c:2786:31: warning: Using plain integer as NULL pointer dlmalloc.c:2801:12: warning: Using plain integer as NULL pointer dlmalloc.c:2801:22: warning: Using plain integer as NULL pointer dlmalloc.c:2926:27: warning: Using plain integer as NULL pointer dlmalloc.c:2928:14: warning: Using plain integer as NULL pointer dlmalloc.c:2929:12: warning: Using plain integer as NULL pointer dlmalloc.c:3075:14: warning: Using plain integer as NULL pointer hush.c:292:14: warning: symbol 'last_return_code' was not declared. Should it be static? hush.c:293:5: warning: symbol 'nesting_level' was not declared. Should it be static? hush.c:2175:20: warning: Using plain integer as NULL pointer hush.c:2175:34: warning: Using plain integer as NULL pointer hush.c:2210:41: warning: Using plain integer as NULL pointer hush.c:2216:45: warning: Using plain integer as NULL pointer hush.c:2249:25: warning: Using plain integer as NULL pointer hush.c:2332:13: warning: symbol 'new_pipe' was not declared. Should it be static? hush.c:2390:5: warning: symbol 'reserved_word' was not declared. Should it be static? hush.c:2927:5: warning: symbol 'parse_stream' was not declared. Should it be static? hush.c:3127:6: warning: symbol 'mapset' was not declared. Should it be static? hush.c:3133:6: warning: symbol 'update_ifs_map' was not declared. Should it be static? hush.c:3161:5: warning: symbol 'parse_stream_outer' was not declared. Should it be static? hush.c:3295:34: warning: Using plain integer as NULL pointer hush.c:3631:5: warning: symbol 'do_showvar' was not declared. Should it be static image.c:1282:29: warning: Using plain integer as NULL pointer image.c:1315:41: warning: Using plain integer as NULL pointer image.c:1330:25: warning: Using plain integer as NULL pointer image.c:1706:25: warning: Using plain integer as NULL pointer main.c:510:10: warning: symbol 'hist_num' was not declared. Should it be static? main.c:512:5: warning: symbol 'hist_list' was not declared. Should it be static? main.c:513:6: warning: symbol 'hist_lines' was not declared. Should it be static? usb_storage.c:195:6: warning: symbol 'usb_show_progress' was not declared. Should it be static? usb_storage.c:440:48: warning: Using plain integer as NULL pointer usb_storage.c:503:5: warning: symbol 'usb_stor_BBB_comdat' was not declared. Should it be static? usb_storage.c:551:5: warning: symbol 'usb_stor_CB_comdat' was not declared. Should it be static? usb_storage.c:629:55: warning: Using plain integer as NULL pointer usb_storage.c:620:5: warning: symbol 'usb_stor_CBI_get_status' was not declared. Should it be static? usb_storage.c:675:43: warning: Using plain integer as NULL pointer usb_storage.c:668:5: warning: symbol 'usb_stor_BBB_clear_endpt_stall' was not declared. Should it be static? usb_storage.c:679:5: warning: symbol 'usb_stor_BBB_transport' was not declared. Should it be static? usb_storage.c:801:5: warning: symbol 'usb_stor_CB_transport' was not declared. Sh xyzModem.c:104:1: warning: symbol 'CYGACC_COMM_IF_GETC_TIMEOUT' was not declared. Should it be static? xyzModem.c:122:1: warning: symbol 'CYGACC_COMM_IF_PUTC' was not declared. Should it be static? xyzModem.c:169:1: warning: symbol 'parse_num' was not declared. Should it be stat note: hush.c's nesting_level deleted because not used. Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
* Allow runtime configuration of "zero-delay" checkJoe Hershberger2012-10-031-2/+3
| | | | | | | Define the new "-2" value for bootdelay to mean autoboot with no delay and don't check for an abort key (while "0" value means do check). Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* Consider CONFIG_ZERO_BOOTDELAY_CHECK when CONFIG_AUTOBOOT_KEYED is setDirk Eibach2012-08-091-0/+5
| | | | | | | | When CONFIG_ZERO_BOOTDELAY_CHECK is not defined, bootdelay==0 prevents the check for console input (as stated in README.autoboot). This must also work in CONFIG_AUTOBOOT_KEYED mode. Signed-off-by: Dirk Eibach <eibach@gdsys.de>
* Allow newlines within command environment varsSimon Glass2012-08-091-3/+3
| | | | | | | | | | | | Any environment variable can hold commands to be executed by the 'run' command. The environment variables preboot, bootcmd and menucmd have special code for triggering execution in certain circumstances. We adjust these calls to use run_command_list() instead of run_command(). This change permits these variables to have embedded newlines so that they work the same as the 'source' command. Signed-off-by: Simon Glass <sjg@chromium.org>
* Add run_command_list() to run a list of commandsSimon Glass2012-08-091-0/+85
| | | | | | | | | This new function runs a list of commands separated by semicolon or newline. We move this out of cmd_source so that it can be used by other code. The PXE code also uses the new function. Suggested-by: Michael Walle <michael@walle.cc> Signed-off-by: Simon Glass <sjg@chromium.org>
* net: cosmetic: net.c checkpatch complianceJoe Hershberger2012-05-151-1/+0
| | | | | Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
* Fix the behaviour of the 'run' commandTimo Ketola2012-04-231-1/+2
| | | | | | | | | | If one command fails, 'run' command should terminate and not execute any remaining variables. Signed-off-by: Timo Ketola <timo@exertus.fi> Tested-by: Wolfgang Denk <wd@denx.de> Tested-by: Simon Glass <sjg@chromium.org> Acked-by: Simon Glass <sjg@chromium.org>
* Convert cmd_usage() calls in common to use a return valueSimon Glass2012-03-061-1/+1
| | | | | | | | | 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>
* Add cmd_process() to process commands in one placeSimon Glass2012-03-061-36/+1
| | | | | | | | | | | | | We currently have the same code in hush.c and main.c. This brings the code into one place. As an added feature, if the command function returns CMD_RET_USAGE then cmd_process() will print a usage message for the command before returning the standard failure code of 1. ARM code size increases about 32 bytes with this clean-up. Signed-off-by: Simon Glass <sjg@chromium.org>
* Create a single cmd_call() function to handle command executionSimon Glass2012-03-061-2/+1
| | | | | | | We should aim for a single point of entry to the commands, whichever parser is used. Signed-off-by: Simon Glass <sjg@chromium.org>
* Don't include standard parser if hush is usedSimon Glass2012-03-061-0/+2
| | | | | | | This saves about 1KB of code space on ARM with CONFIG_SYS_HUSH_PARSER defined. Signed-off-by: Simon Glass <sjg@chromium.org>
* Stop using builtin_run_command()Simon Glass2012-03-061-23/+26
| | | | | | | | | | Boards can select either the 'built-in' parser or the hush parser. We should not call builtin_run_command() if we are using the hush parser. We use run_command() instead, since it knows how to call the correct parser. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Mike Frysinger <vapier@gentoo.org>
* Rename run_command2() to run_command()Simon Glass2012-03-061-5/+5
| | | | | | | This is a more sensible name, so rename it. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Mike Frysinger <vapier@gentoo.org>
* Rename run_command() to builtin_run_command()Simon Glass2012-03-061-4/+5
| | | | | | | | | The current run_command() is only one of the parsing options - the other is hush. We should not call run_command() when the hush parser is being used. So we rename this function to better explain its purpose. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Mike Frysinger <vapier@gentoo.org>
* Remove CMD_PXE's static on run_command()Simon Glass2012-03-061-3/+0
| | | | | | | | It really isn't clear why this is here and there is no comment, so drop it. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Mike Frysinger <vapier@gentoo.org>
* common, menu: show menu on startup if CONFIG_MENU_SHOW is definedHeiko Schocher2012-02-121-0/+4
| | | | | | | | | show a menu on startup instead running the shell. Signed-off-by: Heiko Schocher <hs@denx.de> Cc: Jason Hobbs <jason.hobbs@calxeda.com> Cc: Mike Frysinger <vapier@gentoo.org> Acked-by: Jason Hobbs <jason.hobbs@calxeda.com>
* common: add possibility for readline_into_buffer timeoutHeiko Schocher2012-02-121-4/+16
| | | | | | | | | 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>
* Add pxe commandJason Hobbs2011-10-171-0/+2
| | | | | | | | | | | | Add pxe command, which is intended to mimic PXELINUX functionality. 'pxe get' uses tftp to retrieve a file based on UUID, MAC address or IP address. 'pxe boot' interprets the contents of PXELINUX config like file to boot using a specific initrd, kernel and kernel command line. This patch also adds a README.pxe file - see it for more details on the pxe command. Signed-off-by: Jason Hobbs <jason.hobbs@calxeda.com>
* Replace space and tab checks with isblankJason Hobbs2011-10-171-2/+3
| | | | | | | These are various places I found that checked for conditions equivalent to isblank. Signed-off-by: Jason Hobbs <jason.hobbs@calxeda.com>
* cosmetic: remove unneeded curly bracesJason Hobbs2011-10-171-4/+2
| | | | | | This prevents a checkpatch warning in the patch to use isblank Signed-off-by: Jason Hobbs <jason.hobbs@calxeda.com>
* common: add run_command2 for running simple or hush commandsJason Hobbs2011-10-171-29/+27
| | | | | | Signed-off-by: Jason Hobbs <jason.hobbs@calxeda.com> Cc: Mike Frysinger <vapier@gentoo.org> Acked-by: Mike Frysinger <vapier@gentoo.org>
* common, menu: use abortboot for menu timeoutJason Hobbs2011-10-171-2/+8
| | | | Signed-off-by: Jason Hobbs <jason.hobbs@calxeda.com>
* unify version_stringAndreas Bießmann2011-07-281-2/+1
| | | | | | | | | | | | This patch removes the architecture specific implementation of version_string where possible. Some architectures use a special place and therefore we provide U_BOOT_VERSION_STRING definition and a common weak symbol version_string. Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com> CC: Mike Frysinger <vapier@gentoo.org> CC: Peter Pan <pppeterpppan@gmail.com> Acked-by: Mike Frysinger <vapier@gentoo.org>
* automatic update from FIT image: add optional address parameterAndreas Pretzsch2011-07-261-2/+2
| | | | | | | | | | | | | Current update_tftp() flow: 1.) fetch "updatefile" from defined TFTP server 2.) check if FIT format 3.) flash contained images Add an address parameter to update_tftp(). If this address is non-zero, skip the TFTP transfer and use the image at this address. Also extend update_tftp() to return success/fail. Signed-off-by: Andreas Pretzsch <apr@cn-eng.de>
* cosmetic, main: correct indentation/spacing issuesJason Hobbs2011-07-251-6/+6
| | | | Signed-off-by: Jason Hobbs <jason.hobbs@calxeda.com>
* cosmetic, main: clean up declarations of abortbootJason Hobbs2011-07-251-6/+2
| | | | | | | Remove an unneeded prototype declaration from the top of main.c, and use plain inline instead of __inline__ to please checkpatch. Signed-off-by: Jason Hobbs <jason.hobbs@calxeda.com>
* ARM: drop unsupported 'trab' boardWolfgang Denk2011-06-221-11/+0
| | | | | | | | | | The 'trab' board configuration is broken, and there is nobody who is interested and willing to fix it. Drop it. This includes support for VFD displays which have always been used by this board only. Signed-off-by: Wolfgang Denk <wd@denx.de>
* cmd editing: mark erase/tab seqs constantMike Frysinger2011-01-091-2/+2
| | | | | | These strings are only read, so no need to have them be writable. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* autocomplete: remove runtime handler installMike Frysinger2010-11-281-4/+0
| | | | | | | | | | | Rather than add runtime overhead of installing completion handlers, do it statically at build time. This requires a new build time helper macro to declare a command and the completion handler at the same time. Then we convert the env related funcs over to this. This gives an opportunity to also unify the U_BOOT_CMD macros. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* do_reset: unify duplicate prototypesMike Frysinger2010-11-281-4/+0
| | | | | | | The duplication of the do_reset prototype has gotten out of hand, and they're not all in sync. Unify them all in command.h. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* do_bootd: unify duplicate prototypesMike Frysinger2010-11-281-2/+0
| | | | Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* Replace MAX_CMDBUF_SIZE references with CONFIG_SYS_CBSIZEPeter Tyser2010-10-061-5/+2
| | | | | | | The MAX_CMDBUF_SIZE define is unneeded as it should always equal CONFIG_SYS_CBSIZE. Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
* cmd editing: optimize/shrink output blankingMike Frysinger2010-08-091-5/+3
| | | | | | | | | No need to output spaces 1 char at a time in a loop when the printf code can do the same thing with the right format string. This shrinks things and gives a nice speed up when killing off lines more than a byte or two as printf will send out the buffer in one big chunk. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* cmd_usage(): simplify return code handlingWolfgang Denk2010-07-241-4/+2
| | | | | | | | | | | | | | | | Lots of code use this construct: cmd_usage(cmdtp); return 1; Change cmd_usage() let it return 1 - then we can replace all these ocurrances by return cmd_usage(cmdtp); This fixes a few places with incorrect return code handling, too. Signed-off-by: Wolfgang Denk <wd@denx.de>
* Make sure that argv[] argument pointers are not modified.Wolfgang Denk2010-07-041-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The hush shell dynamically allocates (and re-allocates) memory for the argument strings in the "char *argv[]" argument vector passed to commands. Any code that modifies these pointers will cause serious corruption of the malloc data structures and crash U-Boot, so make sure the compiler can check that no such modifications are being done by changing the code into "char * const argv[]". This modification is the result of debugging a strange crash caused after adding a new command, which used the following argument processing code which has been working perfectly fine in all Unix systems since version 6 - but not so in U-Boot: int main (int argc, char **argv) { while (--argc > 0 && **++argv == '-') { /* ====> */ while (*++*argv) { switch (**argv) { case 'd': debug++; break; ... default: usage (); } } } ... } The line marked "====>" will corrupt the malloc data structures and usually cause U-Boot to crash when the next command gets executed by the shell. With the modification, the compiler will prevent this with an error: increment of read-only location '*argv' N.B.: The code above can be trivially rewritten like this: while (--argc > 0 && **++argv == '-') { char *arg = *argv; while (*++arg) { switch (*arg) { ... Signed-off-by: Wolfgang Denk <wd@denx.de> Acked-by: Mike Frysinger <vapier@gentoo.org>
* Remove AmigaOneG3SE boardWolfgang Denk2010-06-231-8/+1
| | | | | | | | | | The AmigaOneG3SE board has been orphaned or a very long time, and broken for more than 12 releases resp. more than 3 years. As nobody seems to be interested any more in this stuff we may as well ged rid of it, especially as it clutters many areas of the code so it is a continuous pain for all kinds of ongoing work. Signed-off-by: Wolfgang Denk <wd@denx.de>
* FIX: watchdog timeout, while waiting for inputJens Scharsig2010-04-101-0/+3
| | | | | | | | * add WATCHDOG_RESET to !tstc() loops * prevents watchdog timeout, while waiting for input, if CONFIG_BOOT_RETRY_TIME or CONFIG_SHOW_ACTIVITY defined Signed-off-by: Jens Scharsig <js_at_ng@scharsoft.de>
* cmd history: Match history buffer size to console bufferJohn Schmoller2010-03-211-1/+1
| | | | | | | | Match history buffer size to console buffer size. History buffer size was hard coded to 256, artificially limiting the command buffer size. The history buffer now tracks CONFIG_SYS_CBSIZE. Signed-off-by: John Schmoller <jschmoller@xes-inc.com>
OpenPOWER on IntegriCloud