summaryrefslogtreecommitdiffstats
path: root/common/uimage.c
Commit message (Collapse)AuthorAgeFilesLines
* uimage: Fix lseek error check in uimage_load_to_buf()Andrey Smirnov2019-03-111-10/+7
| | | | | | | | Don't use 'int' to store lseek()'s return value to avoid problems with large seek offsets. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* uimage: Fix lseek error check in uimage_load()Andrey Smirnov2019-03-111-4/+4
| | | | | | | | | Don't use 'int' to store lseek()'s return value to avoid problems with large seek offsets. While at it, make sure to populate return error code from 'errno'. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* uimage: Fix lseek error check in uimage_verify()Andrey Smirnov2019-03-111-3/+4
| | | | | | | | | Don't use 'int' to store lseek()'s return value to avoid problems with large seek offsets. While at it, make sure to populate return error code from 'errno'. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* uimage: Use is_tftp_fs() and cache_file() to ease TFTP workaroundSascha Hauer2018-01-251-25/+22
| | | | | | | We have helper functions now to ease file caching when a file is on TFTP. Use them. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* uimage: fix memory leak in error pathSascha Hauer2018-01-251-0/+2
| | | | | | | handle->name is dynamically allocated, so free it in the error path. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reported-by: Stefan Lengfeld <contact@stefanchrist.eu>
* uimage: fix: add can_lseek_backward and use in uimage_openMichael Grzeschik2017-11-101-2/+2
| | | | | | | | | | Since commit ce0cc7fe we support forward seek on tftpfs. This feature breaks the condition to check rather we open an uimage over tftp. Since backward seeking is the problem here, we add the function can_lseek_backward and check for it instead of the simple lseek. Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* bootm: Move bootm options to common/KconfigSascha Hauer2016-05-101-1/+1
| | | | | | | | | | | | bootm has a C API, so the bootm options have to depend on the option providing the bootm code (CONFIG_BOOTM), not on the option providing the command (CONFIG_CMD_BOOTM). Fixing the dependencies makes it possible to fully use bootm from C without enabling the bootm command support. This also removes the CMD_ prefix from the options which means we have to update the defconfigs aswell. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* include: move crc specific stuff to crc.hSascha Hauer2016-04-151-0/+1
| | | | | | | We have a crc.h, so move our crc function prototypes there to further cleanup common.h. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Convert users of PRINTF_CONVERSION_RESOURCE to %paSascha Hauer2016-01-151-4/+3
| | | | | | | | printf now supports printing resource_size_t directly, convert all users of the previously used PRINTF_CONVERSION_RESOURCE over to %pa. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* move file helper functions to separate fileSascha Hauer2014-08-071-0/+1
| | | | | | | | | | We have our file helper functions in several places. Move them all to lib/libfile.c. With this we no longer have file helpers in fs/fs.c which contains the core fs functions and no functions in lib/libbb.c which are not from busybox. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fix format specifiersSascha Hauer2014-06-051-1/+3
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* don't cast negative error codes to unsigned size_tLucas Stach2014-04-231-3/+3
| | | | | | | The cast prevents us from doing proper error checking. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* uimage: fix: fill size when no compression is usedJean-Christophe PLAGNIOL-VILLARD2013-08-121-0/+1
| | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* uimage: fix: always support multi image supportJean-Christophe PLAGNIOL-VILLARD2013-08-121-7/+0
| | | | | | | drop ifdef CONFIG_UIMAGE_MULTI as the Kconfig option is not present anyway Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: fix format specifiersSascha Hauer2013-01-271-2/+3
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/tftp'Sascha Hauer2012-12-071-24/+0
|\
| * uimage: fix misunderstanding in common/uimage.cVicente Bergas2012-11-261-24/+0
| | | | | | | | | | | | | | | | | | The option of reading the file at once was discarded because the option of increasing the buffer size provided almost the same benefit. Signed-off-by: Vicente Bergas <vicencb@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | filetype: Pass bufsizeSascha Hauer2012-12-031-1/+1
|/ | | | | | | | | | Pass the buffer size to the file detection code. This makes sure we do not read past the buffer. This is especially useful for ext filesystem detection as the magic is at byte offset 1080. Also introduce a FILE_TYPE_SAFE_BUFSIZE define which is set to the minimum bufsize the detection code needs to detect all known filetypes. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* uimage: improve transfer speedVicente2012-11-161-2/+25
| | | | | Signed-off-by: Vicente <vicencb@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2012-11-161-1/+1
|\ | | | | | | | | | | | | Conflicts: commands/Makefile Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * UIMAGE: improve transfer speedVicente Bergas2012-10-151-1/+1
| | | | | | | | | | Signed-off-by: Vicente Bergas <vicencb@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | uimage: Fix deleting of temporary fileSascha Hauer2012-10-301-2/+2
|/ | | | | | | the uImage support may generate a temporary file which ought to be deleted after usage. Due to the wrong filename this never happened. Fix this. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Treewide: remove address of the Free Software FoundationSascha Hauer2012-09-171-4/+0
| | | | | | | The FSF address has changed in the past. Instead of updating it each time the address changes, just drop it completely treewide. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* uimage_laod: fix ramdisk supportJean-Christophe PLAGNIOL-VILLARD2012-08-131-1/+2
| | | | | | ramdisk U-Boot expect to ignore the compression type Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* uimage_sdram_flush: fix resource startJean-Christophe PLAGNIOL-VILLARD2012-08-131-1/+2
| | | | | | The start is the start of the previous resource nor the size of it. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* resource: store 'end' instead of 'size' in struct resourceSascha Hauer2012-07-011-3/+3
| | | | | | | | | | Storing the size instead of the resource end in struct resource was a mistake. 'size' ranges from 0 to UINT[32|64]_MAX + 1 which obviously leads to problems. 'end' on the other hand will never exceed UINT[32|64]_MAX. Also this way we can express a iomem region covering the whole address space. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* uimage/file_to_sdram: fix resource allocationSascha Hauer2012-05-021-1/+5
| | | | | | | | | | | file_to_sdram is used to load an initrd. The resource size is then used to pass the initrd size to Linux. This means that the resource size must exactly match the initrd size. Currently this is not the case since we request the sdram region in chunks of 8 Kbytes. Fix this by adjusting the resource size when the file is loaded. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* make uimages work on tftpfsSascha Hauer2012-02-191-0/+25
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* reimplement uImage codeSascha Hauer2011-12-151-0/+505
Provide a new API for accessing uImages which makes it easy for commands to open images, verify them, load to (free) sdram regions and show information about uImages. - We now do not load the image to malloced space anymore. - The data in the header is now stored in cpu native endianess after uimage_open which makes it easy to access the header data. - uImage can be loaded to dynamically allocated sdram regions. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>