summaryrefslogtreecommitdiffstats
path: root/common/main.c
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* fdt: allow bootdelay to be specified via device treeStephen Warren2013-06-041-0/+5
| | | | | | | | | | | | | | | | This can be useful to force bootcmd to execute as soon as U-Boot has started. My use-case is: An SoC-specific tool pushes U-Boot into RAM, along with an image to be written to device boot flash, with the DT config property "bootcmd" set to contain a command to write that image to flash. In this scenario, we don't want to allow any stale bootdelay value taken from the current flash content to affect how long it takes before the flashing process starts. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Simon Glass <sjg@chromium.org> Acked-by: Gerald Van Baren <vanbaren@cideas.com>
* main: Add debug_bootkeys to avoid #ifdefsSimon Glass2013-06-041-12/+12
| | | | | | | | Define a simple debug condition at the top of the file, to avoid using lots of #ifdefs later on. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
* main: Add debug_parser() to avoid #ifdefsSimon Glass2013-06-041-35/+23
| | | | | | | | Define a simple debug condition at the top of the file, to avoid using lots of #ifdefs later on. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
* main: Correct header orderSimon Glass2013-06-041-15/+4
| | | | | | The headers are a bit out of order, so fix them. Signed-off-by: Simon Glass <sjg@chromium.org>
* main: Fix typos and checkpatch warnings in command line readingSimon Glass2013-06-041-11/+11
| | | | | | | | There are a few over-long lines and other checkpatch problems in this area of the code. Prepare the ground for the next patch by tidying these up. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
* main: Use get/setenv_ulong()Simon Glass2013-06-041-6/+2
| | | | | | | These functions are now available, so use them to avoid extra code here. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
* main: Move boot_delay code into its own functionSimon Glass2013-06-041-67/+70
| | | | | | Move this code into its own function, since it clutters up main_loop(). Signed-off-by: Simon Glass <sjg@chromium.org>
* main: Separate out the two abortboot() functionsSimon Glass2013-06-041-8/+11
| | | | | | | | | | | | | There are two implementations of abortboot(). Turn these into two separate functions, and create a single abortboot() which calls either one or the other. Also it seems that nothing uses abortboot() outside main, so make it static. At this point there is no further use of CONFIG_MENU in main.c. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
* net: Add prototype for update_tftpSimon Glass2013-06-041-4/+0
| | | | | | | This function should be declared in net.h. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
* Revert "fdt- Tell the FDT library where the device tree is"Simon Glass2013-05-011-8/+0
| | | | | | | | | | This reverts commit 3b73459ea3421e9f8c6c8c62e1d3fe458ca5bc56. In practice it doesn't seem like a good idea to make the the working FDT point to the control FDT. Now that we can access the control FDT using the 'fdt' command, there is no need for this feature. Remove it. Signed-off-by: Simon Glass <sjg@chromium.org>
* 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>
OpenPOWER on IntegriCloud