By now, the majority of architectures have working relocation
support, so the few remaining architectures have become exceptions.
To make this more obvious, we make working relocation now the default
case, and flag the remaining cases with CONFIG_NEEDS_MANUAL_RELOC.
Signed-off-by: Wolfgang Denk <wd@denx.de>
Tested-by: Heiko Schocher <hs@denx.de>
Tested-by: Reinhard Meyer <u-boot@emk-elektronik.de>
The device tree (fdt) must always exist in within the bootmap (usually the
first 16MB of RAM). If it doesn't, then boot_relocate_fdt() will allocate
an LMB region in the bootmap and copy the fdt into that region. It will
also increase the size of the fdt.
If the fdt is already in the bootmap, then previously the memory was just
reserved. There was no contingency if the reservation failed, however.
By always allocating an lmb region and copying/resizing the fdt into that
region, the code is simplified and the memory region is always allocated
properly.
Also change the types of some variables to avoid some typecasts.
Signed-off-by: Timur Tabi <timur@freescale.com>
Tested-by: Ira Snyder <iws@ovro.caltech.edu>
Acked-by: Gerald Van Baren <vanbaren@cideas.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
The routines boot_ramdisk_high, boot_get_cmdline and boot_get_kbd
are currently enabled by various combinations of CONFIG_M68K,
CONFIG_POWERPC and CONFIG_SPARC.
Use CONFIG_SYS_BOOT_<FEATURE> defines instead.
CONFIG_SYS_BOOT_RAMDISK_HIGH
CONFIG_SYS_BOOT_GET_CMDLINE
CONFIG_SYS_BOOT_GET_KBD
Define these as appropriate in arch/include/asm/config.h files.
Signed-off-by: John Rigby <john.rigby@linaro.org>
Acked-by: Wolfgang Denk <wd@denx.de>
fdt_totalsize returns size in cpu endian so don't call be32_to_cpu
on the result. This was harmless on big endian platforms but not
on little endian ARMs.
Signed-off-by: John Rigby <john.rigby@linaro.org>
boot_relocate_fdt is called on platforms with CONFIG_SYS_BOOTMAPSZ
defined to relocate the device tree blob to be inside the
boot map area between bootmap_base and bootmap_base+CONFIG_SYS_BOOTMAPSZ.
For the case where the blob needs to be relocated, space is
allocated inside the bootmap by calling lmb_alloc_base with
size passed in plus some padding:
of_len = *of_size + CONFIG_SYS_FDT_PAD;
For the case where the blob is already inside the bounds of the boot map
area, lmb_reserve is called to reserve the the space where the blob is
already residing. The calculation for this case is currently:
of_len = (CONFIG_SYS_BOOTMAPSZ + bootmap_base) - (ulong)fdt_blob;
This is wrong because it reserves all the space in the boot map area
from the blob to the end ignoring completely the actual size. The
worst case is where the blob is at the beginning and the entire boot map
area get reserved. Fix this by changing the length calculation to this:
of_len = *of_size + CONFIG_SYS_FDT_PAD;
This bug has likely never manifested itself because bootm has never
been called with the fdt blob already in the bootmap area. In my
testing on an OMAP3 beagle board I initially worked around the bug
by simply moving the initial location of the fdt blob. I have tested
with the new calculation with the fdt blob both inside and outside
the boot map area.
Signed-off-by: John Rigby <john.rigby@linaro.org>
Platforms with flat device tree support can use a bootmap to relocate
the fdt_blob. This is not a must. That's why the relocation function
boot_relocate_fdt() should be use only if CONFIG_OF_LIBFDT was defined
together with CONFIG_SYS_BOOTMAPSZ (see common/cmd_bootm.c).
On MicroBlaze platforms there is no need to use a bootmap to relocate
a fdt blob. So we need a more precise focus on the compilation and usage
of boot_relocate_fdt().
In general it is valid to exclude the function boot_relocate_fdt() if
the bootmap size CONFIG_SYS_BOOTMAPSZ is not defined.
Signed-off-by: Stephan Linz <linz@li-pro.net>
If the user sets bootm_low and does not set bootm_size, u-boot will
report the memory node in the flat device tree incorrectly. Instead
of reporting the remaining size of memory, it will report the total
available memory which is incorrect.
Specifically this fixes the situation when booting a relocatable
kernel and the memory is reported as an offset and size in the
device tree, and the size needs to be adjusted accordingly.
Signed-off-by: Matthew McClintock <msm@freescale.com>
Acked-by: Kumar Gala <galak@kernel.crashing.org>
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>
This patch adds support for "imximage" (MX Boot Image)
to the mkimage utility. The imximage is used on the Freescales's
MX.25, MX.35 and MX.51 processors.
Further details under doc/README.imximage.
This patch was tested on a Freescale mx51evk board.
Signed-off-by: Stefano Babic <sbabic@denx.de>
There is more and more usage of printing 64bit values,
so enable this feature generally, and delete the
CONFIG_SYS_64BIT_VSPRINTF and CONFIG_SYS_64BIT_STRTOUL
defines.
Signed-off-by: Heiko Schocher <hs@denx.de>
Add lzop decompression support to the existing lzo bitstream handling
(think gzip versus zlib), and support it for uImage decompression if
CONFIG_LZO is enabled.
Lzop doesn't compress as good as gzip (~10% worse), but decompression
is very fast (~0.7s faster here on a slow ppc). The lzop decompression
code is based on Albin Tonnerre's recent ARM Linux lzo support patch.
Cc: albin.tonnerre@free-electrons.com
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
This patch adds support for "kwbimage" (Kirkwood Boot Image)
image types to the mkimage code.
For details refer to docs/README.kwbimage
This patch is tested with Sheevaplug board
Signed-off-by: Prafulla Wadaskar <prafulla@marvell.com>
Acked-by: Ron Lee <ron@debian.org>
Signed-off-by: Prafulla Wadaskar <prafulla@marvell.com>
- make get_table_entry_id() global
- make get_table_entry_name() global
- move struct table_entry to image.h
Currently this code is used by image.c only.
This patch makes this API global so it can be used by other parts of
code, too.
Signed-off-by: Prafulla Wadaskar <prafulla@marvell.com>
Acked-by: Ron Lee <ron.debian.org>
Edit comments and commit message.
Signed-off-by: Wolfgang Denk <wd@denx.de>
Currently it is used by image.c only, but the the function can be
used to support additional mkimage types like for example kwbimage,
so make this function globally visible.
Signed-off-by: Prafulla Wadaskar <prafulla@marvell.com>
Edited commit message.
Signed-off-by: Wolfgang Denk <wd@denx.de>
This fixes some compiler warnings:
tools/default_image.c:141: warning: initialization from incompatible pointer type
tools/fit_image.c:202: warning: initialization from incompatible pointer type
and changes to code to use "const" attributes in a few places where
it's appropriate.
Signed-off-by: Wolfgang Denk <wd@denx.de>
Add #ifdefs where necessary to not perform relocation fixups. This
allows boards/architectures which support relocation to trim a decent
chunk of code.
Note that this patch doesn't add #ifdefs to architecture-specific code
which does not support relocation.
Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
This patch adds support for "kwbimage" (Kirkwood Boot Image)
image types to the mkimage code.
For details refer to docs/README.kwbimage
This patch is tested with Sheevaplug board
Signed-off-by: Prafulla Wadaskar <prafulla@marvell.com>
Acked-by: Ron Lee <ron@debian.org>
Signed-off-by: Prafulla Wadaskar <prafulla@marvell.com>
- make get_table_entry_id() global
- make get_table_entry_name() global
- move struct table_entry to image.h
Currently this code is used by image.c only.
This patch makes this API global so it can be used by other parts of
code, too.
Signed-off-by: Prafulla Wadaskar <prafulla@marvell.com>
Acked-by: Ron Lee <ron.debian.org>
Edit comments and commit message.
Signed-off-by: Wolfgang Denk <wd@denx.de>
Currently it is used by image.c only, but the the function can be
used to support additional mkimage types like for example kwbimage,
so make this function globally visible.
Signed-off-by: Prafulla Wadaskar <prafulla@marvell.com>
Edited commit message.
Signed-off-by: Wolfgang Denk <wd@denx.de>
This fixes some compiler warnings:
tools/default_image.c:141: warning: initialization from incompatible pointer type
tools/fit_image.c:202: warning: initialization from incompatible pointer type
and changes to code to use "const" attributes in a few places where
it's appropriate.
Signed-off-by: Wolfgang Denk <wd@denx.de>
Without this, u-boot can crash or print garbage if the original link
address no longer points to a valid string.
Signed-off-by: Scott Wood <scottwood@freescale.com>
FDT support is used for both FIT style images and for architectures
that can pass a fdt blob to an OS (ppc, m68k, sparc).
For other architectures and boards which do not pass a fdt blob to an
OS but want to use the new uImage format, we just need FIT support.
Now we can have the 4 following configurations :
1) FIT only CONFIG_FIT
2) fdt blob only CONFIG_OF_LIBFDT
3) both CONFIG_OF_LIBFDT & CONFIG_FIT
4) none none
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Now that the auto-update feature uses the 'firmware' type for updates, it is
useful to inspect the load address of such images.
Signed-off-by: Bartlomiej Sieka <tur@semihalf.com>
Fix printf format-string/arg mismatches under -DDEBUG.
These warnings occur with DEBUG defined for a platform using
cpu/mpc85xx. Users of other architectures can unearth similar
problems by adding the line "CFLAGS += -DDEBUG=1" in config.mk right
after "CFLAGS += $(call cc-option,-fno-stack-protector)".
Signed-off-by: Andrew Klossner <andrew@cesa.opbu.xerox.com>
Signed-off-by: Andy Fleming <afleming@freescale.com>
- add function fit_all_image_check_hashes() that verifies if all
hashes of all images in the FIT are valid
- improve output of fit_image_check_hashes() when the hash check fails
Signed-off-by: Bartlomiej Sieka <tur@semihalf.com>
Pantelis Antoniou stated:
AFAIK, it is still used but the products using PPC are long gone.
Nuke it plz (from orbit).
So remove it since it cleans up a usage of env_get_char outside of
the environment code.
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Adds returning an error from the ramdisk detection code if
its not a real ramdisk (invalid). There is no reason we can't
just return back to the console if we detect an invalid
ramdisk or CRC error.
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
This patch adds bootm_start() return value check. If
error status is returned, we do not proceed further to
prevent board reset or crash as we still can recover
at this point.
Signed-off-by: Anatolij Gustschin <agust@denx.de>
Set the fdt working address so "fdt FOO" commands can be used as part
of the bootm flow. Also set an the environment variable "fdtaddr"
with the value.
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Move the code that handles finding a device tree blob and relocating
it (if needed) into common code so all arch's have access to it.
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
The autostart revert caused a bit of duplicated code as well as
code that was using images->autostart that needs to get removed so
we can build again.
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
This reverts commit f5614e7926.
The commit was based on a misunderstanding of the (documented)
meaning of the 'autostart' environment variable. It might cause
boards to hang if 'autostart' was used, with the potential to brick
them. Go back to the documented behaviour.
Conflicts:
common/cmd_bootm.c
common/image.c
include/image.h
Signed-off-by: Wolfgang Denk <wd@denx.de>
boot_get_ramdisk() should not treat the case when a FIT image does
not contain a ramdisk as an error.
Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
Acked-by: Michal Simek <monstr@monstr.eu>
Microblaze and PowerPC use boot_get_ramdisk for loading
ramdisk to memory with checking return value.
Return 0 means success. Return 1 means failed.
Here is correspond part of code from bootm.c which check
return code.
ret = boot_get_ramdisk (argc, argv, images, IH_ARCH_PPC,
&rd_data_start, &rd_data_end);
if (ret)
goto error;
Signed-off-by: Michal Simek <monstr@monstr.eu>
This updates the lmb code to use phys_size_t
and phys_addr_t instead of unsigned long. Other code
which interacts with this code, like getenv_bootm_size()
is also updated.
Booted on MPC8641HPCN, build-tested ppc, arm, mips.
Signed-off-by: Becky Bruce <becky.bruce@freescale.com>
Add logbuffer to reserved LMB areas to prevent initrd allocation
from overlaping with it.
Make sure to use correct logbuffer base address.
Signed-off-by: Marian Balakowicz <m8@semihalf.com>
Calculation of tail was incorrect when size % 4 == 0.
New code removes the conditional and does the same thing but with arithmetic
Signed-off-by: Nick Spence <nick.spence@freescale.com>
Add logbuffer to reserved LMB areas to prevent initrd allocation
from overlaping with it.
Make sure to use correct logbuffer base address.
Signed-off-by: Marian Balakowicz <m8@semihalf.com>
Recent modifcations to LOGBUFFER handling code were incorrecly
introduced to fit_check_kernel() routine during
"Merge branch 'new-image' of git://www.denx.de/git/u-boot-testing",
commit 27f33e9f45.
This patch cleans up this merge issue.
Signed-off-by: Marian Balakowicz <m8@semihalf.com>
Add support for the recognition of 'powerpc' as an alias for the PowerPC
architecture type since Linux is already trending in that direction,
preferring 'powerpc' to 'ppc'.
Signed-off-by: Grant Erickson <gerickson@nuovations.com>
Some files didn't get updated properly with the "Use watchdog-aware
functions when calculating hashes of images" commit, this commit
fixes this.
Signed-off-by: Bartlomiej Sieka <tur@semihalf.com>
Signed-off-by: Wolfgang Denk <wd@denx.de>
As suggested by Wolfgang Denk:
- image printing functions:
- remove wrappers
- remove indentation prefix from functions' signatures
- merge getenv_verify and getenv_autostart into one parametrized function
Signed-off-by: Bartlomiej Sieka <tur@semihalf.com>