Commit Graph

2110 Commits

Author SHA1 Message Date
Joe Hershberger
8ac88f2d28 fdt: Check for a token to skip auto-hash validation
Allow the itb file to declare to u-boot that its hash should not be
checked automatically on bootm or iminfo.  This allows an image to
either be checked automatically or to include a script which may
check it otherwise (such as after part of the itb has been relocated
to RAM by the script).

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-10-15 19:20:32 -04:00
Joe Hershberger
8805beec8f fdt: Identify scripts in ITBs as printable strings
Scripts in the ITB format will have spaces in them and will end in a
newline charachter.  Make sure that these are considered printable.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-10-15 19:20:26 -04:00
Joe Hershberger
bc80295b62 fdt: Add get commands to fdt
Add commands to access data in the fdt.  This allows data from a dtb
or itb to be accessed from the shell scripts.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-10-15 19:20:22 -04:00
Joe Hershberger
f0a29d4331 fdt: Limit printed hex in fdt print and list commands
Prevent printing the entire image in a itb. It is most likely unhelpful
to have the hex of the entire image scroll for minutes on your slow
serial console.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-10-15 19:20:16 -04:00
Joe Hershberger
367e125976 fdt: Check error codes returned from fdtlib when loading ITB
Before this patch, error codes returned from fdtlib were ignored and
continued access would cause a crash. Now just check if the image is
truncated and error if so.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-10-15 19:20:08 -04:00
Gerlando Falauto
7ac80551c4 env: fix crash using default -f -a
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>
2012-10-05 11:07:42 -07:00
Joe Hershberger
961c437b6c Improve license declaration for cmd_ini.h
Instead of referenceing the source webpage (which can change) include
the license in the source file.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reported-by: Igor Grinberg <grinberg@compulab.co.il>
Cc: Igor Grinberg <grinberg@compulab.co.il>
Cc: Tom Rini <trini@ti.com>
Cc: Wolfgang Denk <wd@denx.de>
Acked-by: Wolfgang Denk <wd@denx.de>
2012-10-05 11:07:42 -07:00
Tom Rini
1981668777 Merge branch 'master' of git://git.denx.de/u-boot-arm 2012-10-04 10:00:42 -07:00
Michal Simek
194846f398 serial: Add Zynq serial driver
The driver is used on Xilinx Zynq platform.

Signed-off-by: Michal Simek <monstr@monstr.eu>
CC: Joe Hershberger <joe.hershberger@gmail.com>
CC: Marek Vasut <marex@denx.de>
Acked-by: Marek Vasut <marex@denx.de>
2012-10-04 16:46:18 +02:00
Joe Hershberger
bb64d1c92f Output strings from echo with puts where easy
Change echo to puts characters together where it knows about them
together.  This improves netconsole performance by greatly reducing
the number of packets that are sent.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-10-03 16:13:34 -07:00
Joe Hershberger
da83bcd7b3 Add a command to access the system timer
Two sub-commands... start and get.
 * start sets the reference.
 * get prints out the time since the last start (in "<sec>.<msec>" format).
If get is called without start, returns time since boot.
Simple way to benchmark an operation: "timer start;<commands-to-measure>;timer get"

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-10-03 16:01:23 -07:00
Joe Hershberger
c167cc0203 Add a new "ini" command
This allows you to read ini-formatted data from anywhere and then
import one of the sections into the environment

This is based on rev 16 at http://code.google.com/p/inih/

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-10-03 16:01:23 -07:00
Joe Hershberger
36180d96cc Cleanup cache command prints
Only print when queried, not every time the setting is changed.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-10-03 16:01:22 -07:00
Joe Hershberger
e9455fcc45 Fix checkpatch.pl complaints in cmd_cache.c
Old code that is not compliant.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-10-03 16:01:22 -07:00
Joe Hershberger
ecd7295004 Add parameter to md5sum to save the md5 sum
Add a parameter that allows you to store the md5 sum to either a
memory location or a variable.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-10-03 16:01:22 -07:00
Joe Hershberger
5ab177bede Implement verify option for md5sum command
Loosely based on CONFIG_CRC32_VERIFY.

The sum to verify against can be in memory, in a variable, or the last
parameter to the function directly.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-10-03 16:01:22 -07:00
Joe Hershberger
3c210e29cd Add parameter to sha1sum to save the SHA1 sum
Add a parameter that allows you to store the SHA1 sum to either a
memory location or a variable.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-10-03 16:01:22 -07:00
Joe Hershberger
e6e77d354f Implement verify option for sha1sum command
Loosely based on CONFIG_CRC32_VERIFY.

The sum to verify against can be in memory, in a variable, or the last
parameter to the function directly.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-10-03 16:01:22 -07:00
Joe Hershberger
b0fe6abd71 Change dead code in "test" cmd to debug output
Improve debug output for test by indicating the number of parameters
and quoting the parameters to make it clear exactly what each contains

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
2012-10-03 16:01:22 -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
Ilya Yanok
7ac2fe2da2 OMAP: networking support for SPL
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>
2012-10-01 10:02:14 -07:00
Ilya Yanok
4063c77deb OMAP: spl: call timer_init() from SPL
We need to initialize timer properly, otherwise all delays
inside SPL will be wrong.

Signed-off-by: Ilya Yanok <ilya.yanok@cogentembedded.com>
2012-10-01 10:02:14 -07:00
Anatolij Gustschin
e5acb883ae cmd_fat.c: fix build warning
Commit cfda5aeab8
(cmd_fat: use common get_device_and_partition function)
introduced a warning:
cmd_fat.c: In function 'do_fat_fswrite':
cmd_fat.c:178:8: warning: unused variable 'ep' [-Wunused-variable]

Fix it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Reported-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
Tested-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
2012-09-29 10:00:29 -07:00
Lei Wen
f2b96dfbbc common: add zip command support
Signed-off-by: Lei Wen <leiwen@marvell.com>
2012-09-29 07:26:09 -07:00
Tom Rini
cec2655c3b Merge branch 'master' of git://git.denx.de/u-boot-net 2012-09-27 12:06:07 -07:00
Pavel Machek
c57b953da9 SPL: Add support for loading image from ram in SPL.
Signed-off-by: Pavel Machek <pavel@denx.de>
Signed-off-by: Tom Rini <trini@ti.com>
2012-09-27 11:20:28 -07:00
Tom Rini
4212098181 SPL: Rework how we inform about un-headered images
First, remove the puts from the case where we don't have an mkimage
header as this is somewhat common and intentional for no-arg target
images.  Second, rework the final switch statement in board_init_r to,
in the case of !CONFIG_SPL_OS_BOOT be only about doing debug prints
about if we know what the magic is or not (the CONFIG_SPL_OS_BOOT case
is unchanged).  Then we call jump_to_image_no_args().  This gives us the
same behavior as before but with slightly smaller code.

Signed-off-by: Tom Rini <trini@ti.com>
2012-09-27 11:20:28 -07:00
Tom Rini
1292eaf353 SPL: Make un-supported boot device puts a debug instead
Signed-off-by: Tom Rini <trini@ti.com>
2012-09-27 11:20:27 -07:00
Stefan Roese
3c6f8a0d19 SPL: Enable use of custom defined U-Boot entry point
By setting CONFIG_SYS_UBOOT_START boards can now use a different entry
point for their U-Boot image. So the U-Boot entry point is not fixed
to CONFIG_SYS_TEXT_BASE any more.

Signed-off-by: Stefan Roese <sr@denx.de>
Signed-off-by: Tom Rini <trini@ti.com>
2012-09-27 11:20:27 -07:00
Tom Rini
a4cc1c4877 SPL: SPI: Enhance spi_spl_load to match the other load functions
Signed-off-by: Tom Rini <trini@ti.com>
2012-09-27 11:20:27 -07:00
Stefan Roese
022b4975c8 SPL: Add option to skip copying of the mkimage header
On some system (e.g. powerpc), the load-address and entry-point is
located at address 0. So the current approach to load the image
(payload) including the header to the address "load-address - 64"
can't work here.

This patch adds an flag to skip this copying including header to
the SPL framework. By setting SPL_COPY_PAYLOAD_ONLY, only the
playload will be copied. This will be used by the SPL NOR flash
driver on powerpc.

Signed-off-by: Stefan Roese <sr@denx.de>
Signed-off-by: Tom Rini <trini@ti.com>
2012-09-27 11:20:27 -07:00
Stefan Roese
33d346464a SPL: Add NOR flash booting support
SPL NOR flash booting support is quite simple. Only copying of the
images is needed.

On MPC5xxx we need to make sure to only use the standard memcpy()
implementation and not the MPC5xxx specific one. As the MPC5xxx
version has some complexity which is not needed for this SPL
booting.

Signed-off-by: Stefan Roese <sr@denx.de>
Signed-off-by: Tom Rini <trini@ti.com>
2012-09-27 11:20:27 -07:00
Chander Kashyap
a655938a93 PXE: FDT: Add support for fdt in PXE
Now DT support is becoming common for all new SoC's. Hence it is better
to have option for getting specific FDT from the remote server.

This patch adds support for new label i.e. 'fdt'. This will allow to
retrieve 'fdt blob' from the remote server. This patch take care for
the following scenarios.

The usage of fdt is optional.
The 'fdt blob' can be retrieved from tftp or can be available locally
or can be absent.

If 'fdt_addr_r' environment variable is set and 'fdt' label is defined
retrieve 'fdt blob' from tftp. 'fdt_addr_r' is then passed along bootm
command.

If 'fdt_addr' is set and 'fdt blob' is not retrieved from the tftp pass
'fdt_addr' to bootm command. In this case 'fdt blob' will be available
at 'fdt_addr'.

If 'fdt_addr' is not set and 'fdt blob' is not retrieve from tftp pass
NULL to boot command. In this case 'fdt blob' is not required and absent.

Signed-off-by: Chander Kashyap <chander.kashyap@linaro.org>
Acked-by: Jason Hobbs <jason.hobbs@calxeda.com>
2012-09-27 12:22:11 -05:00
Tom Rini
d97b4ce805 SPL: NAND: Move arch/arm/cpu/armv7/omap-common/spl_nand.c to common/spl
We move the spl_nand_load_image function to common/spl.  This will allow
for easier integration of SPL-boots-Linux code on other arches.

Signed-off-by: Tom Rini <trini@ti.com>
2012-09-27 09:50:00 -07:00
Stefan Roese
77552b0633 SPL: Use image_get_xxx() functions to access header values
Signed-off-by: Stefan Roese <sr@denx.de>
Signed-off-by: Tom Rini <trini@ti.com>
2012-09-27 09:50:00 -07:00
Stefano Babic
ae83d882f5 SPL: do not use fix value for u-boot size
If an u-boot image is not found, SPL thinks to load a bare
u-boot.bin image with a maximum size of 200KB.
Use CONFIG_SYS_MONITOR_LEN instead.

Signed-off-by: Stefan Roese <stefan.roese@gmail.com>
Signed-off-by: Stefano Babic <sbabic@denx.de>
Signed-off-by: Tom Rini <trini@ti.com>
2012-09-27 09:49:59 -07:00
Tom Rini
6507f133f3 SPL: Create arch/arm/lib/spl.c for board_init_f and jump_to_image_linux
In SPL (CONFIG_SPL_FRAMEWORK) board_init_f must setup the stack pointer,
clear the BSS and call board_init_r.  We mark this as weak as some
platforms may need to perform additional initalization at this point.
We provide a gd that we know will be in a usable location, once the BSS
has been cleared to help with this as well.  Finally, we no longer call
relocate_code so remove that from the armv7 version.

Next, both board_init_f and jump_to_image_linux are going to be
inherently arch-specific, so move these versions to arch/arm/lib/spl.c

Signed-off-by: Tom Rini <trini@ti.com>
2012-09-27 09:49:59 -07:00
Tom Rini
47f7bcae8c SPL: Move the omap SPL framework to common/spl
Add a new flag, CONFIG_SPL_FRAMEWORK to opt into the common/spl SPL
framework, enable on all of the previously using boards.  We move the
spl_ymodem.c portion to common/ and spl_mmc.c to drivers/mmc/.  We leave
the NAND one in-place as we plan to replace it later in this series.

We use common/spl to avoid linker problems with respect to merging
constant strings in objects.   Otherwise all strings in common/ will be
linked in and kept which grows SPL in size too much.

Signed-off-by: Tom Rini <trini@ti.com>
2012-09-27 09:49:59 -07:00
Benoît Thébaudeau
1170e634dd FAT: Make it possible to read from any file position
When storage devices contain files larger than the embedded RAM, it is
useful to be able to read these files by chunks, e.g. for a software
update to the embedded NAND Flash from an external storage device (USB
stick, SD card, etc.).

Hence, this patch makes it possible by adding a new FAT API to read
files from a given position. This patch also adds this feature to the
fatload command.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Cc: Wolfgang Denk <wd@denx.de>
Signed-off-by: Tom Rini <trini@ti.com>
2012-09-26 11:11:32 -07:00
Igor Grinberg
9aa90c1df0 env: checkpatch clean env_fat
env_fat has several checkpatch warnings - clean those up.

Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
2012-09-26 11:08:32 -07:00
Igor Grinberg
3bb89e5bd5 env: remove duplicated env_get_char_spec()
env_fat and env_remote have an implementation of env_get_char_spec()
function that is not different than the default.
Remove the duplicated code.

Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
2012-09-26 11:08:32 -07:00
Tom Rini
b3873d3f4c Merge branch 'master' of git://git.denx.de/u-boot-video 2012-09-25 16:18:22 -07:00
Stephen Warren
5cf41dccff cmd_part: add partition-related command
This implements the following:

part uuid mmc 0:1
  -> print partition UUID
part uuid mmc 0:1 uuid
  -> set environment variable to partition UUID
part list mmc 0
  -> list the partitions on the specified device

"part uuid" can be useful when writing a bootcmd which searches all
known devices for something bootable, and then wants the kernel to
use the same partition as the root device, e.g.:

part uuid ${devtype} ${devnum}:${rootpart} uuid
setenv bootargs root=PARTUUID=${uuid} ...

Signed-off-by: Stephen Warren <swarren@nvidia.com>
2012-09-25 15:05:47 -07:00
Stephen Warren
10a37fd7a4 disk: get_device_and_partition() "auto" partition and cleanup
Rework get_device_and_partition() to:
a) Implement a new partition ID of "auto", which requests that U-Boot
   search for the first "bootable" partition, and fall back to the first
   valid partition if none is found. This way, users don't need to
   specify an explicit partition in their commands.
b) Make use of get_device().
c) Add parameter to indicate whether returning a whole device is
   acceptable, or whether a partition is mandatory.
d) Make error-checking of the user's device-/partition-specification
   more complete. In particular, if strtoul() doesn't convert all
   characters, it's an error rather than just ignored.

The resultant device/partition returned by the function will be as
follows, based on whether the disk has a partition table (ptable) or not,
and whether the calling command allows the whole device to be returned
or not.

(D and P are integers, P >= 1)

D
D:
  No ptable:
    !allow_whole_dev: error
    allow_whole_dev: device D
  ptable:
    device D partition 1
D:0
  !allow_whole_dev: error
  allow_whole_dev: device D
D:P
  No ptable: error
  ptable: device D partition P
D:auto
  No ptable:
    !allow_whole_dev: error
    allow_whole_dev: device D
  ptable:
    first partition in device D with bootable flag set.
    If none, first valid paratition in device D.

Note: In order to review this patch, it's probably easiest to simply
look at the file contents post-application, rather than reading the
patch itself.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
[swarren: Rob implemented scanning for bootable partitions. I fixed a
couple of issues there, switched the syntax to ":auto", added the
error-checking rework, and ":0" syntax for the whole device]
Signed-off-by: Stephen Warren <swarren@nvidia.com>
2012-09-25 14:58:48 -07:00
Rob Herring
650f36641c cmd_reiser: use common get_device_and_partition function
Convert reiserload and reiserls to use common device and partition parsing
function. With the common function "dev:part" can come from the
environment and a '-' can be used in that case.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
2012-09-25 14:49:18 -07:00
Rob Herring
4120457044 cmd_zfs: use common get_device_and_partition function
Convert zfsload and zfsls to use common device and partition parsing
function. With the common function "dev:part" can come from the
environment and a '-' can be used in that case.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
2012-09-25 14:49:17 -07:00
Rob Herring
475c7970c1 cmd_disk: use common get_device_and_partition function
Signed-off-by: Rob Herring <rob.herring@calxeda.com>
2012-09-25 14:49:05 -07:00
Rob Herring
cfda5aeab8 cmd_fat: use common get_device_and_partition function
Convert fatload, fatls, and fatinfo to use common device and partition
parsing function. With the common function "dev:part" can come from the
environment and a '-' can be used in that case.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
2012-09-25 14:46:57 -07:00
Rob Herring
81180819b8 cmd_extX: use common get_device_and_partition function
Convert ext2/4 load, ls, and write functions to use common device and
partition parsing function. With the common function "dev:part" can come
from the environment and a '-' can be used in that case.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
2012-09-25 14:46:55 -07:00
Rob Herring
9450106296 ext4: remove init_fs/deinit_fs
There's no real need to expose this and it can be removed by using a static
allocation.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
2012-09-25 14:46:35 -07:00