summaryrefslogtreecommitdiff
path: root/common
AgeCommit message (Collapse)AuthorFilesLines
2021-10-10Merge tag 'video-20211009' of ↵Tom Rini1-2/+2
https://source.denx.de/u-boot/custodians/u-boot-video - add 30bpp support (EFI, simplefb, vidconsole) - fix video console name in CONSOLE_MUX Kconfig help - move mxsfb driver config option to Kconfig - remove unused mx3fb driver # gpg verification failed.
2021-10-09common: Kconfig: use 'vidconsole' name instead of old 'video'Anatolij Gustschin1-2/+2
After DM_VIDEO conversion the 'vidconsole' is the correct name for the frame buffer console. 'video' will not work, so update the description of the config option. Signed-off-by: Anatolij Gustschin <agust@denx.de>
2021-10-09lz4: Use a private header for U-BootSimon Glass1-1/+1
At present U-Boot has a header file called lz4.h for its own use. If the host has its own lz4 header file installed (e.g. from the 'liblz4-dev' package) then host builds will use that instead. Move the U-Boot file into its own directory, as is done with various other headers with the same problem. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-10-08image: Split up boot_get_fdt()Simon Glass1-100/+126
This function is far too long. Before trying to remove #ifdefs, split out the code that deals with selecting the FDT into a separate function. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-10-08image: Reduce variable scope in boot_get_fdt()Simon Glass1-12/+11
Move the variables declarations to where they are needed, to reduce the number of #ifdefs needed. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-10-08image: Remove some #ifdefs from image-fit and image-fit-sigSimon Glass3-9/+16
Drop the #ifdefs which are easy to remove without refactoring. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-10-08image: Remove #ifdefs from select_ramdisk()Simon Glass1-67/+72
Use boolean variables to deal with the strange #ifdef logic of this function, so we can remove the #ifdefs. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-10-08image: Split up boot_get_ramdisk()Simon Glass1-63/+86
This function is far too long. Before trying to remove #ifdefs, split out the code that deals with selecting the ramdisk into a separate function. Leave the code indented as it was for easier review. The next patch cleans this up along with checkpatch violations. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-10-08image: Reduce variable scope in boot_get_ramdisk()Simon Glass1-11/+11
Move the variables declarations to where they are needed, to reduce the number of #ifdefs needed. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-10-08image: Drop most #ifdefs in image-board.cSimon Glass1-61/+50
Remove ifdefs in this file, so far as possible without too much refactoring. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-10-08image: Drop #ifdefs for fit_print_contents()Simon Glass1-5/+6
Use a simple return to drop the unwanted code. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-10-08image: Tidy up fit_unsupported_reset()Simon Glass1-0/+8
This function is only used in one place and does not need to use the preprocessor. Move it to the C file and convert it to a normal function. Drop fit_unsupported() since it is not used. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-10-08image: Drop IMAGE_ENABLE_IGNORESimon Glass1-1/+1
We can use the new host_build() function for this, so drop it. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2021-10-08image: Drop IMAGE_OF_SYSTEM_SETUPSimon Glass1-1/+1
This is not needed with Kconfig, since we can use IS_ENABLED() easily enough. Drop it. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2021-10-08image: Drop IMAGE_OF_BOARD_SETUPSimon Glass1-2/+2
This is not needed with Kconfig, since we can use IS_ENABLED() easily enough. Drop it. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2021-10-08image: Drop IMAGE_BOOT_GET_CMDLINESimon Glass1-1/+1
This is not needed with Kconfig, since we can use IS_ENABLED() easily enough and the board code is now in a separate file. Update the only place where this is used and drop it. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2021-10-08image: Use the correct checks for CRC32Simon Glass2-6/+20
Add a host Kconfig for CRC32. With this we can use CONFIG_IS_ENABLED(CRC32) directly in the host build, so drop the unnecessary indirection. Add a few more conditions to SPL_CRC32 to avoid build failures as well as TPL_CRC32. Also update hash.c to make crc32 optional and to actually take notice of SPL_CRC32. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2021-10-08image: Drop IMAGE_ENABLE_OF_LIBFDTSimon Glass3-7/+7
Add a host Kconfig for OF_LIBFDT. With this we can use CONFIG_IS_ENABLED(OF_LIBFDT) directly in the tools build, so drop the unnecessary indirection. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2021-10-08image: Drop IMAGE_ENABLE_FITSimon Glass3-14/+14
Make use of the host Kconfig for FIT. With this we can use CONFIG_IS_ENABLED(FIT) directly in the host build, so drop the unnecessary indirection. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2021-10-08hash: Drop some #ifdefs in hash.cSimon Glass1-29/+25
We can use the __maybe_unused attribute to avoid some of the #ifdefs in this file. Update the functions accordingly. Note: The actual hashing interface is still a mess, with four separate combinations and lots of #ifdefs. This should really use a driver approach, e.g. as is done with partition drivers. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2021-10-08hash: Use Kconfig to enable hashing in host tools and SPLSimon Glass1-26/+23
At present when building host tools, we force CONFIG_SHAxxx to be enabled regardless of the board Kconfig setting. This is done in the image.h header file. For SPL we currently just assume the algorithm is desired if U-Boot proper enables it. Clean this up by adding new Kconfig options to enable hashing on the host, relying on CONFIG_IS_ENABLED() to deal with the different builds. Add new SPL Kconfigs for hardware-accelerated hashing, to maintain the current settings. This allows us to drop the image.h code and the I_WANT_MD5 hack. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2021-10-08image: Add Kconfig options for FIT in the tools buildSimon Glass2-3/+4
In preparation for enabling CONFIG_IS_ENABLED() on the host build, add some options to enable the various FIT options expected in these tools. This will ensure that the code builds correctly when CONFIG_TOOLS_xxx is distinct from CONFIG_xxx. Drop some #ifdefs which are immediately unnecessary (many more are in later patches). Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com> Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2021-10-08compiler: Rename host_build() to tools_build()Simon Glass2-10/+10
With the new TOOLS_LIBCRYPTO and some other changes, it seems that we are heading towards calling this a tools build rather than a host build, although of course it does happen on the host. I cannot think of anything built by the host which cannot be described as a tool, so rename this function. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2021-10-08image: Remove ifdefs around image_setup_linux() el atSimon Glass2-16/+11
Drop some more ifdefs in image-board.c and also the FPGA part of bootm.c which calls into it. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-10-08image: Avoid #ifdefs for manual relocationSimon Glass1-18/+22
Add a macro to handle manually relocating a pointer. Update the iamge code to use this to avoid needing #ifdefs. This also fixes a bug where the 'done' flag was not set. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-10-08image: Create a function to do manual relocationSimon Glass1-26/+7
Rather than adding an #ifdef and open-coding this calculation, add a helper function to handle it. Use this in the image code. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-10-08image: Split host code out into its own fileSimon Glass3-37/+45
To avoid having #ifdefs in a few functions which are completely different in the board and host code, create a new image-host.c file. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-10-08image: Fix up checkpatch warnings in image-board.cSimon Glass1-70/+72
Tidy up the warnings. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-10-08image: Split board code out into its own fileSimon Glass3-924/+928
To avoid a large #ifdef in the image.c file, move the affected code into a separate file. Avoid any style fix-ups for easier review. Those are in the next patch. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-10-08image: Update image_decomp() to avoid ifdefsSimon Glass1-77/+68
Adjust this function so that preprocessor macros are not needed. With this, the host build uses more of the same header files as the target build. Rather than definining CONFIG_SYS_MALLOC_LEN, add a CONSERVE_MEMORY define, since that is the purpose of the value. This appears to have no impact on code size from a spot check of a few boards (snow, firefly-rk3288, boston32r2el, m53menlo). Signed-off-by: Simon Glass <sjg@chromium.org>
2021-10-08image: Update zstd to avoid reporting error twiceSimon Glass1-5/+3
The zstd implementation prints the error in image_decomp() which is incorrect and does not match other algorithms. Drop this and let the caller report the error. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-10-08image: Avoid switch default in image_decomp()Simon Glass1-6/+8
At present this function is full of preprocessor macros. Adjust it to check for an unsupported algorithm after the switch(). This will allow us to drop the macros. Fix up the return-value path and an extra blank line while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-10-08zstd: Create a function for use from U-BootSimon Glass1-41/+9
The existing zstd API requires the same sequence of calls to perform its task. Create a helper for U-Boot, to avoid code duplication, as is done with other compression algorithms. Make use of of this from the image code. Note that the zstd code lacks a test in test/compression.c and this should be added by the maintainer. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-10-07riscv: image: Use the first DRAM bank for bootm_lowSamuel Holland1-1/+1
bootm_low is used as a base address is used to allocate space for the FDT blob, initrd, cmdline, etc. when booting Linux. Set the default value for RISC-V to the start of the first DRAM bank, so platforms can get their DRAM layout from the device tree, and do not need to define CONFIG_SYS_SDRAM_BASE. Signed-off-by: Samuel Holland <samuel@sholland.org> Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
2021-10-05lib: optee: remove the duplicate CONFIG_OPTEEPatrick Delaunay3-5/+5
The configuration CONFIG_OPTEE is defined 2 times: 1- in lib/optee/Kconfig for support of OPTEE images loaded by bootm command 2- in drivers/tee/optee/Kconfig for support of OP-TEE driver. It is abnormal to have the same CONFIG define for 2 purpose; and it is difficult to managed correctly their dependencies. Moreover CONFIG_SPL_OPTEE is defined in common/spl/Kconfig to manage OPTEE image load in SPL. This definition causes an issue with the macro CONFIG_IS_ENABLED(OPTEE) to test the availability of the OP-TEE driver. This patch cleans the configuration dependency with: - CONFIG_OPTEE_IMAGE (renamed) => support of OP-TEE image in U-Boot - CONFIG_SPL_OPTEE_IMAGE (renamed) => support of OP-TEE image in SPL - CONFIG_OPTEE (same) => support of OP-TEE driver in U-Boot - CONFIG_OPTEE_LIB (new) => support of OP-TEE library After this patch, the macro have the correct behavior: - CONFIG_IS_ENABLED(OPTEE_IMAGE) => Load of OP-TEE image is supported - CONFIG_IS_ENABLED(OPTEE) => OP-TEE driver is supported Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
2021-09-30WS cleanup: remove SPACE(s) followed by TABWolfgang Denk3-3/+3
Signed-off-by: Wolfgang Denk <wd@denx.de>
2021-09-30WS cleanup: remove trailing white spaceWolfgang Denk1-1/+1
Signed-off-by: Wolfgang Denk <wd@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-09-30WS cleanup: remove trailing empty linesWolfgang Denk2-3/+0
Signed-off-by: Wolfgang Denk <wd@denx.de>
2021-09-28ti: keystone: Move away from CONFIG_SOC_KEYSTONETom Rini1-1/+1
We have individual SOC symbols for each keystone 2 platform. Use the existing CONFIG_ARCH_KEYSTONE rather than CONFIG_SOC_KEYSTONE to encompass all of the keystone families. Signed-off-by: Tom Rini <trini@konsulko.com>
2021-09-25treewide: Simply conditions with the new OF_REALSimon Glass2-5/+5
Use this new Kconfig to simplify the compilation conditions where appropriate. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-09-25treewide: fdt: Move fdt_get_config_... to ofnode_conf_read...Simon Glass4-15/+12
The current API is outdated as it requires a devicetree pointer. Move these functions to use the ofnode API and update this globally. Add some tests while we are here. Correct the call in exynos_dsim_config_parse_dt() which is obviously wrong. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-09-23image: add lz4 zstd compression magic mapArtem Lapkin1-0/+2
Add lz4 and zstd compression magic map. Already can decompress images with lz4 and zstd compression type. Signed-off-by: Artem Lapkin <art@khadas.com>
2021-09-17Remove including timestamp.h in version.hPali Rohár1-0/+3
Header file version.h does not use anything from timestamp.h. Including of timestamp.h has side effect which cause recompiling object file at every make run because timestamp.h changes at every run. So remove timestamp.h from version.h and include timestamp.h in files which needs it. This change reduce recompilation time of final U-Boot binary when U-Boot source files were not changed as less source files needs to be recompiled. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com> [trini: Add in lib/acpi/acpi_table.c and test/dm/acpi.c, rework a few others] Signed-off-by: Tom Rini <trini@konsulko.com>
2021-09-17version: Move version_string[] from version.h to version_string.hPali Rohár1-1/+1
More C files do not use compile time timestamp macros and do not have to be recompiled every time when SOURCE_DATE_EPOCH changes. This patch moves version_string[] from version.h to version_string.h and updates other C files which only needs version_string[] string to include version_string.h instead of version.h. After applying this patch these files are not recompiled every time when SOURCE_DATE_EPOCH changes. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2021-09-16Merge tag 'v2021.10-rc4' into nextTom Rini8-140/+37
Prepare v2021.10-rc4 Signed-off-by: Tom Rini <trini@konsulko.com> # gpg: Signature made Tue 14 Sep 2021 06:58:32 PM EDT # gpg: using RSA key 1A3C7F70E08FAB1707809BBF147C39FF9634B72C # gpg: Good signature from "Thomas Rini <trini@konsulko.com>" [ultimate] # Conflicts: # board/Arcturus/ucp1020/spl.c # cmd/mvebu/Kconfig # common/Kconfig.boot # common/image-fit.c # configs/UCP1020_defconfig # configs/sifive_unmatched_defconfig # drivers/pci/Kconfig # include/configs/UCP1020.h # include/configs/sifive-unmatched.h # lib/Makefile # scripts/config_whitelist.txt
2021-09-15image: Avoid erroneous double byte-swap in CRC valueAlexandru Gagniuc1-9/+0
The hash algorithm selection was streamlined in commit 92055e138f28 ("image: Drop if/elseif hash selection in calculate_hash()"). Said commit kept the call to cpu_to_uimage() to convert the CRC to big endian format. This would have been correct when calling crc32_wd(). However, the ->hash_func_ws member of crc32 points to crc32_wd_buf(), which already converts the CRC to big endian. On a little endian host, doing both conversions results in a little-endian CRC. This is incorrect. To remedy this, simply drop the call to cpu_to_uimage(), thus only doing the byte-order conversion once. Fixes: 92055e138f28 ("image: Drop if/elseif hash selection in calculate_hash()") Tested-by: Tom Rini <trini@konsulko.com> Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2021-09-14image: rsa: Move padding_algos to linker listsAlexandru Gagniuc1-17/+6
We are not guaranteed to have the padding_pkcs_15_verify symbol since commit 92c960bc1d ("lib: rsa: Remove #ifdefs from rsa.h"), and commit 61416fe9df ("Kconfig: FIT_SIGNATURE should not select RSA_VERIFY") The padding_algos only make sense with RSA verification, which can now be disabled in lieu of ECDSA. In fact this will lead to build failures because of the missing symbol mentioned earlier. To resolve this, move the padding_algos to a linker list, with declarations moved to rsa_verify.c. This is consistent with commit 6909edb4ce ("image: rsa: Move verification algorithm to a linker list") One could argue that the added #ifdef USE_HOSTCC is ugly, and should be hidden within the U_BOOT_PADDING_ALGO() macro. However, this would be inconsistent with the "cryptos" list. This logic for was not previously explored: Without knowledge of the U_BOOT_PADDING_ALGO() macro, its use is similar to something being declared. However, should #ifndef USE_HOSTCC be part of the macro, it would not be obvious that it behaves differently on host code and target code. Having the #ifndef outside the macro makes this obvious. Also, the #ifdef is not always necessary. For example ecda-verify makes use of U_BOOT_CRYPTO_ALGO() without any accompanying #ifdefs. The fundamental issue is a lack of separation of host and target code in rsa_verify. Therefore, the declaration of a padding algo with the external #ifdef is more readable and consistent. Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
2021-09-14pci: Drop DM_PCISimon Glass1-1/+0
This option has not effect now. Drop it, using PCI instead where needed. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-09-08image: Drop if/elseif hash selection in calculate_hash()Alexandru Gagniuc2-26/+21
calculate_hash() would try to select the appropriate hashing function by a if/elseif contruct. But that is exactly why hash_lookup_algo() exists, so use it instead. This does mean that we now have to 'select HASH' to make sure we get the hash_lookup_algo() symbol. However, the change makes sense because even basic FITs will have to deal with "hash" nodes. My only concern is that the 'select SPL_HASH' might cause some platform to grow above its SPL size allowance Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com> [trini: Make FSL_CAAM be implied only on ARM && SPL] Signed-off-by: Tom Rini <trini@konsulko.com>
2021-09-08common: Move MD5 hash to hash_algo[] array.Alexandru Gagniuc1-0/+13
MD5 is being called directly in some places, but it is not available via hash_lookup_algo("md5"). This is inconsistent with other hasing routines. To resolve this, add an "md5" entry to hash_algos[]. The #ifdef clause looks funnier than those for other entries. This is because both MD5 and SPL_MD5 configs exist, whereas the other hashes do not have "SPL_" entries. The long term plan is to get rid of the ifdefs, so those should not be expected to survive much longer. The md5 entry does not have .hash_init/update/finish members. That's okay because hash_progressive_lookup_algo() will catch that, and return -EPROTONOSUPPORT, while hash_lookup_algo() will return the correct pointer. Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com> [trini: Use CONFIG_IS_ENABLED not IS_ENABLED for MD5 check] Signed-off-by: Tom Rini <trini@konsulko.com>