Commit Graph

126 Commits

Author SHA1 Message Date
Wolfgang Denk 93e1459641 Coding Style cleanup: replace leading SPACEs by TABs
Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Drop changes for PEP 4 following python tools]
Signed-off-by: Tom Rini <trini@ti.com>
2013-10-14 16:06:54 -04:00
Wolfgang Denk 1a4596601f Add GPL-2.0+ SPDX-License-Identifier to source files
Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>
2013-07-24 09:44:38 -04:00
Stephen Warren 99bd544ee7 fdt: allow bootdelay to be specified via device tree
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>
2013-06-04 16:06:32 -04:00
Simon Glass d34d186ef9 main: Add debug_bootkeys to avoid #ifdefs
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>
2013-06-04 16:06:31 -04:00
Simon Glass 3e4088737b main: Add debug_parser() to avoid #ifdefs
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>
2013-06-04 16:06:31 -04:00
Simon Glass fbcdf32af7 main: Correct header order
The headers are a bit out of order, so fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-06-04 16:06:31 -04:00
Simon Glass 4933381a5b main: Fix typos and checkpatch warnings in command line reading
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>
2013-06-04 16:06:31 -04:00
Simon Glass f2abca8459 main: Use get/setenv_ulong()
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>
2013-06-04 16:06:31 -04:00
Simon Glass bc2b4c27d0 main: Move boot_delay code into its own function
Move this code into its own function, since it clutters up main_loop().

Signed-off-by: Simon Glass <sjg@chromium.org>
2013-06-04 16:06:31 -04:00
Simon Glass 063ae006ae main: Separate out the two abortboot() functions
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>
2013-06-04 16:06:31 -04:00
Simon Glass ea5427e260 net: Add prototype for update_tftp
This function should be declared in net.h.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
2013-06-04 16:06:31 -04:00
Simon Glass 095686d3f5 Revert "fdt- Tell the FDT library where the device tree is"
This reverts commit 3b73459ea3.

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>
2013-05-01 11:17:21 -04:00
Joe Hershberger d514544fe0 CONFIG_BOOTDELAY default should not affect runtime
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>
2013-03-12 12:43:31 -04:00
Barak Wasserstrom fe492cee35 common/main: move set_working_fdt_addr to enable usage of $fdtaddr
When using $fdtaddr in $bootcmd and $bootcmd is automatically called,
$fdtaddr is yet not defined.

Signed-off-by: Barak Wasserstrom <wbarak@gmail.com>
2013-03-12 12:43:31 -04:00
Richard Genoud 34765e8853 cmd_time: merge run_command_and_time_it with cmd_process
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>
2013-02-04 09:14:02 -05:00
Jim Lin b2f3e0ea3e console: USB: KBD: Fix incorrect autoboot timeout
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>
2013-02-04 09:07:21 -05:00
Allen Martin a098cf41fd Merge remote-tracking branch 'u-boot/master' into u-boot-arm-merged
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
2012-12-19 13:02:36 -08:00
Simon Glass 01433d6001 Add new bootstage step for the main loop
Mark when we get to the main loop.

Signed-off-by: Simon Glass <sjg@chromium.org>
2012-12-11 13:17:32 -07:00
Simon Glass f39612d360 fdt: Correct global_data condition in main
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>
2012-11-28 19:26:49 -05:00
Simon Glass 9a8efc4604 lcd: Add support for flushing LCD fb from dcache after update
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>
2012-11-19 08:15:38 -07:00
Simon Glass fcabc24f4f fdt: Set kernaddr if fdt indicates a kernel is present
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>
2012-11-12 23:14:57 -05:00
Doug Anderson 67e1ea26e8 fdt: Allow device tree to specify secure booting
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>
2012-11-12 23:14:57 -05:00
Gabe Black 3b73459ea3 fdt: Tell the FDT library where the device tree is
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>
2012-11-12 23:14:57 -05:00
Che-Liang Chiou 224b72e639 fdt: Load boot command from device tree
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>
2012-11-12 23:14:57 -05:00
Kim Phillips 199adb601f common/misc: sparse fixes
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>
2012-11-04 11:00:35 -07:00
Joe Hershberger 93d7212fa6 Allow runtime configuration of "zero-delay" check
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>
2012-10-03 16:01:21 -07:00
Dirk Eibach a5aae0a1a9 Consider CONFIG_ZERO_BOOTDELAY_CHECK when CONFIG_AUTOBOOT_KEYED is set
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>
2012-08-09 22:40:15 +02:00
Simon Glass 3a8a02beb7 Allow newlines within command environment vars
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>
2012-08-09 22:06:23 +02:00
Simon Glass d51004a832 Add run_command_list() to run a list of commands
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>
2012-08-09 22:06:03 +02:00
Joe Hershberger 48522bb503 net: cosmetic: net.c checkpatch compliance
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
2012-05-15 17:16:19 -05:00
Timo Ketola 030fca5228 Fix the behaviour of the 'run' command
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>
2012-04-23 22:07:00 +02:00
Simon Glass 4c12eeb8b5 Convert cmd_usage() calls in common to use a return value
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>
2012-03-06 21:09:46 +01:00
Simon Glass 9d12d5d41d Add cmd_process() to process commands in one place
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>
2012-03-06 21:09:41 +01:00
Simon Glass bdf8e34b93 Create a single cmd_call() function to handle command execution
We should aim for a single point of entry to the commands, whichever
parser is used.

Signed-off-by: Simon Glass <sjg@chromium.org>
2012-03-06 21:09:34 +01:00
Simon Glass 7fed89e00e Don't include standard parser if hush is used
This saves about 1KB of code space on ARM with CONFIG_SYS_HUSH_PARSER
defined.

Signed-off-by: Simon Glass <sjg@chromium.org>
2012-03-06 21:09:30 +01:00
Simon Glass 5307153236 Stop using builtin_run_command()
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>
2012-03-06 21:09:26 +01:00
Simon Glass 009dde1955 Rename run_command2() to run_command()
This is a more sensible name, so rename it.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Mike Frysinger <vapier@gentoo.org>
2012-03-06 21:09:22 +01:00
Simon Glass f47360a74e Rename run_command() to builtin_run_command()
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>
2012-03-06 21:09:18 +01:00
Simon Glass 79714c1e26 Remove CMD_PXE's static on run_command()
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>
2012-03-06 21:09:14 +01:00
Heiko Schocher 317d6c57d5 common, menu: show menu on startup if CONFIG_MENU_SHOW is defined
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>
2012-02-12 10:11:24 +01:00
Heiko Schocher 9c3483113d common: add possibility for readline_into_buffer timeout
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>
2012-02-12 10:11:23 +01:00
Jason Hobbs 06283a6401 Add pxe command
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>
2011-10-17 22:25:35 +02:00
Jason Hobbs 4d91a6ecab Replace space and tab checks with isblank
These are various places I found that checked for conditions equivalent
to isblank.

Signed-off-by: Jason Hobbs <jason.hobbs@calxeda.com>
2011-10-17 22:25:34 +02:00
Jason Hobbs ce2d4c9532 cosmetic: remove unneeded curly braces
This prevents a checkpatch warning in the patch to use isblank

Signed-off-by: Jason Hobbs <jason.hobbs@calxeda.com>
2011-10-17 22:25:34 +02:00
Jason Hobbs c8a2079e49 common: add run_command2 for running simple or hush commands
Signed-off-by: Jason Hobbs <jason.hobbs@calxeda.com>
Cc: Mike Frysinger <vapier@gentoo.org>
Acked-by: Mike Frysinger <vapier@gentoo.org>
2011-10-17 22:25:34 +02:00
Jason Hobbs b41bc5a82d common, menu: use abortboot for menu timeout
Signed-off-by: Jason Hobbs <jason.hobbs@calxeda.com>
2011-10-17 22:25:33 +02:00
Andreas Bießmann 09c2e90c11 unify version_string
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 Biemann <andreas.devel@googlemail.com>
CC: Mike Frysinger <vapier@gentoo.org>
CC: Peter Pan <pppeterpppan@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
2011-07-28 17:22:53 +02:00
Andreas Pretzsch 8d6b73202c automatic update from FIT image: add optional address parameter
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>
2011-07-26 16:58:44 +02:00
Jason Hobbs 370d1e3e58 cosmetic, main: correct indentation/spacing issues
Signed-off-by: Jason Hobbs <jason.hobbs@calxeda.com>
2011-07-25 23:28:05 +02:00
Jason Hobbs 3c766dccb3 cosmetic, main: clean up declarations of abortboot
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>
2011-07-25 23:27:43 +02:00