summaryrefslogtreecommitdiff
path: root/boot/image-fit.c
AgeCommit message (Collapse)AuthorFilesLines
2024-05-22image: remove redundant hash includesRaymond Mao1-4/+0
Remove the redundant includes of u-boot/md5.h, u-boot/sha1.h, u-boot/sha256.h and u-boot/sha512.h Signed-off-by: Raymond Mao <raymond.mao@linaro.org> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Igor Opaniuk <igor.opaniuk@gmail.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2024-05-06boot: Remove <common.h> and add needed includesTom Rini1-1/+0
Remove <common.h> from all "boot/" files and when needed add missing include files directly. Signed-off-by: Tom Rini <trini@konsulko.com>
2023-12-21global: Restrict use of '#include <linux/kconfig.h>'Tom Rini1-1/+1
In general terms, we -include include/linux/kconfig.h and so normal U-Boot code does not need to also #include it. However, for code which is shared with userspace we may need to add it so that either our full config is available or so that macros such as CONFIG_IS_ENABLED() can be evaluated. In this case make sure that we guard these includes with a test for USE_HOSTCC so that it clear as to why we're doing this. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com>
2022-10-31image: Allow loading a FIT image for a particular phaseSimon Glass1-10/+73
Add support for filtering out FIT images by phase. Rather than adding yet another argument to this already overloaded function, use a composite value, where the phase is only added in if needed. The FIT config is still selected (and verified) as normal, but the images are selected based on the phase. Tests for this come in a little later, as part of the updated VPL test. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-31image: Move comment for fit_conf_find_compat()Simon Glass1-43/+0
Move this comment to the header file, where the APIs should be defined. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-29treewide: Drop bootm_headers_t typedefSimon Glass1-8/+8
This is not needed and we should avoid typedefs. Use the struct instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-07image: fit: Add some helpers for getting dataSean Anderson1-0/+37
Several different firmware users have repetitive code to extract the firmware data from a FIT. Add some helper functions to reduce the amount of repetition. fit_conf_get_prop_node (eventually) calls fdt_check_node_offset_, so we can avoid an explicit if. In general, this version avoids printing on error because the callers are typically library functions, and because the FIT code generally has (debug) prints of its own. One difference in these helpers is that they use fit_image_get_data_and_size instead of fit_image_get_data, as the former handles external data correctly. Signed-off-by: Sean Anderson <sean.anderson@seco.com> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Peng Fan <peng.fan@nxp.com>
2022-08-31image-fit: don't set compression if it can't be readDaniel Golle1-2/+1
fit_image_get_comp() should not set value -1 in case it can't read the compression node. Instead, leave the value untouched in that case as it can be absent and a default value previously defined by the caller of fit_image_get_comp() should be used. As a result the warning message WARNING: 'compression' nodes for ramdisks are deprecated, please fix your .its file! no longer shows if the compression node is actually absent. Signed-off-by: Daniel Golle <daniel@makrotopia.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-07-01image: fit: Use stack allocation macroJoel Stanley1-2/+1
The documentation above the DEFINE_ALIGN_BUFFER says it's for use outside functions, but we're inside one. Instead use ALLOC_CACHE_ALIGN_BUFFER, the stack based macro, which also includes the cache alignment. Fixes: b583348ca8c8 ("image: fit: Align hash output buffers") Signed-off-by: Joel Stanley <joel@jms.id.au> Tested-by: Chia-Wei Wang <chiawei_wang@aspeedtech.com> Reviewed-by: Sean Anderson <sean.anderson@seco.com>
2022-04-19image-fit: don't check free() argumentHeinrich Schuchardt1-9/+3
* free() checks if its argument is NULL. Remove duplicate checks. * Remove duplicate free(ovcopy). Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-04-11image: fit: Align hash output buffersSean Anderson1-1/+3
Hardware-accelerated hash functions require that the input and output buffers be aligned to the minimum DMA alignment. memalign.h helpfully provides a macro just for this purpose. It doesn't exist on the host, but we don't need to be aligned there either. Fixes: 5dfb521386 ("[new uImage] New uImage low-level API") Signed-off-by: Sean Anderson <sean.anderson@seco.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-01-26tools: Pass the key blob aroundSimon Glass1-5/+7
At present we rely on the key blob being in the global_data fdt_blob pointer. This is true in U-Boot but not with tools. For clarity, pass the parameter around. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-24image-fit: Make string of algo parameter constantJan Kiszka1-4/+4
Modifications would be invalid. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-01-19doc: replace @return by Return:Heinrich Schuchardt1-2/+2
Sphinx expects Return: and not @return to indicate a return value. find . -name '*.c' -exec \ sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \; find . -name '*.h' -exec \ sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \; Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2021-11-17image: fit: Fix parameter name for hash algorithmChia-Wei Wang1-2/+2
Fix inconsistent function parameter name of the hash algorithm. Signed-off-by: Chia-Wei Wang <chiawei_wang@aspeedtech.com> Fixes: 92055e138f2 ("image: Drop if/elseif hash selection in calculate_hash()") Reviewed-by: Joel Stanley <joel@jms.id.au> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-11-11Create a new boot/ directorySimon Glass1-0/+2448
Quite a lot of the code in common/relates to booting and images. Before adding more it seems like a good time to move the code into its own directory. Most files with 'boot' or 'image' in them are moved, except: - autoboot.c which relates to U-Boot automatically running a script - bootstage.c which relates to U-Boot timing Drop the removal of boot* files from the output directory, since this interfers with the symlinks created by tools and there does not appear to be any such file from my brief testing. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Artem Lapkin <email2tema@gmail.com> Tested-by: Artem Lapkin <email2tema@gmail.com>