aboutsummaryrefslogtreecommitdiff
path: root/common/image.c
AgeCommit message (Collapse)Author
2011-04-25Respect memreserve regions specified in the device treeGrant Likely
If a regions is reserved in the fdt, then it should not be used. Add the memreserve regions to the lmb so that u-boot doesn't use them to store the initrd. Signed-off-by: Grant Likely <grant.likely@linaro.org>
2011-04-25Remove device tree booting dependency on CONFIG_SYS_BOOTMAPSZGrant Likely
The previous patch makes u-boot use the full accessible size of ram as the default boot mapped size if CONFIG_SYS_BOOTMAPSZ is not defined, which means boot_relocate_fdt() can be changed to depend solely on CONFIG_OF_LIBFDT. Signed-off-by: Grant Likely <grant.likely@linaro.org>
2011-04-25Default to bootm_size() when CONFIG_SYS_BOOTMAPSZ is not definedGrant Likely
This patch adds a function getenv_bootm_mapsize() for obtaining the size of the early mapped region accessible by the kernel during early boot. It defaults to CONFIG_SYS_BOOTMAPSZ, or if not defined, defaults to getenv_bootm_size(), which in turn defaults to the size of RAM. getenv_bootm_mapsize() can also be overridden with a "bootm_mapsize" environmental variable. Signed-off-by: Grant Likely <grant.likely@linaro.org>
2011-04-25Stop passing around bootmem_base value.Grant Likely
For the calls to boot_relocate_fdt(), boot_get_cmdline(), and boot_get_kbd(), the value of bootmem_base is always obtained by calling getenv_bootm_low(). Since the value always comes from the same source, the calling signature for those functions can be simplified by making them call getenv_bootm_low() directly. Signed-off-by: Grant Likely <grant.likely@linaro.org>
2010-11-28image: constify lookup tablesMike Frysinger
These are pure lookup tables -- no need to be writable. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-10-29Replace CONFIG_RELOC_FIXUP_WORKS by CONFIG_NEEDS_MANUAL_RELOCWolfgang Denk
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>
2010-10-20always relocate fdt into an lmb-allocated memory blockTimur Tabi
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>
2010-10-18boot: change some arch ifdefs to feature ifdefsJohn Rigby
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>
2010-10-18common/image.c remove extra calls to be32_to_cpu in boot_get_fdtJohn Rigby
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>
2010-10-18common/image.c fix length calculation in boot_relocate_fdtJohn Rigby
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>
2010-09-28Add support for operating system OSETorkel Lundgren
Add OSE as operating system for mkimage and bootm. Signed-off-by: Torkel Lundgren <torkel.lundgren@enea.com>
2010-08-08fdt relocate: have more attention to use a bootmap or notStephan Linz
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>
2010-08-07Fix condition where bootm_size not set and wrong memory size reportedMatthew McClintock
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>
2010-07-04Make sure that argv[] argument pointers are not modified.Wolfgang Denk
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>
2010-05-28nios: remove nios-32 archThomas Chou
The nios-32 arch is obsolete and broken. So it is removed. Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
2010-05-06Move test for unnecessary memmove to memmove_wd()Larry Johnson
Signed-off-by: Larry Johnson <lrj@acm.org>
2010-01-25mkimage: Add Freescale imx Boot Image support (imximage)Stefano Babic
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>
2009-12-08common: delete CONFIG_SYS_64BIT_VSPRINTF and CONFIG_SYS_64BIT_STRTOULHeiko Schocher
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>
2009-12-05add lzop decompression supportPeter Korsgaard
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>
2009-10-03Conditionally perform common relocation fixupsPeter Tyser
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>
2009-09-10mkimage: Add Kirkwood Boot Image support (kwbimage)Prafulla Wadaskar
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>
2009-09-10mkimage: Make table_entry code globalPrafulla Wadaskar
- 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>
2009-09-10mkimage: Make genimg_print_size() globalPrafulla Wadaskar
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>
2009-09-10tools/mkimage: fix compiler warnings, use "const"Wolfgang Denk
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>
2009-04-04common/image.c: Relocate strings in tables.Scott Wood
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>
2008-12-13Fix FIT and FDT support to have CONFIG_OF_LIBFDT and CONFIG_FIT independentJean-Christophe PLAGNIOL-VILLARD
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>
2008-10-18rename CFG_ macros to CONFIG_SYSJean-Christophe PLAGNIOL-VILLARD
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2008-10-18FIT: output image load address for type 'firmware', fix message while thereBartlomiej Sieka
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>
2008-09-13Add support for LZMA uncompression algorithm.Luigi 'Comio' Mantellini
Signed-off-by: Luigi 'Comio' Mantellini <luigi.mantellini@idf-hit.com> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2008-09-09Fix printf errors under -DDEBUGAndrew Klossner
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>
2008-09-09FIT: add ability to check hashes of all images in FIT, improve outputBartlomiej Sieka
- 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>
2008-09-09Add support for booting of INTEGRITY operating system uImagesPeter Tyser
Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
2008-09-09Remove support for booting ARTOS imagesKumar Gala
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>
2008-09-07Prevent crash if random/invalid ramdisks are passed to bootmKumar Gala
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>
2008-09-07Prevent crash if random DTB address is passed to bootmAnatolij Gustschin
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>
2008-08-26bootm: Set working fdt address as part of the bootm flowKumar Gala
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>
2008-08-26bootm: refactor fdt locating and relocation codeKumar Gala
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>
2008-08-12Fix fallout from autostart revertKumar Gala
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>
2008-08-10Revert "[new uImage] Add autostart flag to bootm_headers structure"Wolfgang Denk
This reverts commit f5614e7926863bf0225ec860d9b319741a9c4004. 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>
2008-08-09FIT: Fix handling of images without ramdisksPeter Tyser
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>
2008-07-13FIS: repare incorrect return value with ramdisk handlingMichal Simek
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>
2008-06-12Change lmb to use phys_size_t/phys_addr_tBecky Bruce
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>
2008-06-03Avoid initrd and logbuffer area overlapsMarian Balakowicz
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>
2008-05-12Revert "Avoid initrd and logbuffer area overlaps"Wolfgang Denk
This reverts commit 1b5605ca57fbb364f4d78eeee28b974ed875e888 which breaks building on all PPC boards that don't use a log buffer.
2008-05-12Fix offset calculation for multi-type legacy images.Nick Spence
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>
2008-05-10Avoid initrd and logbuffer area overlapsMarian Balakowicz
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>
2008-05-10Fix build errors when CONFIG_LOGBUFFER and CONFIG_FIT are enabledMarian Balakowicz
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 27f33e9f45ef7f9685cbdc65066a1828e85dde4f. This patch cleans up this merge issue. Signed-off-by: Marian Balakowicz <m8@semihalf.com>
2008-05-09Recognize 'powerpc' As an Alias for IH_ARCH_PPCGrant Erickson
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>
2008-04-25Use watchdog-aware functions when calculating hashes of images - take twoBartlomiej Sieka
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>
2008-04-24Memory footprint optimizationsBartlomiej Sieka
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>