image: Reduce #ifdefs and ad-hoc defines in image code (Part B)
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v5 Latest26 of 29 patches 63 repliesIn review
- v415 patches 15 repliesSuperseded
- v315 patches 1 replySuperseded
Earlier versions · 2
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v2 | 50 patches | 0 replies | Superseded | |
| v1 | 49 patches | 8 replies | Superseded |
Changes in v5 from the cover letter
- Add a new patch to rename host_build() to tools_build()
- Add new patch to bring back SPL_ versions of SHA
- Avoid preprocessor in a few more places
- Drop I_WANT_MD5
- Drop changes to tools/Makefile since they already use TOOLS_ Kconfigs
- Drop rd_load since it is not used
- Fix up tools/Makefile to have the correct condition
- Rebase to next
- Update commit message
- Update commit message to indicate that the code is in a separate file
- Use TOOLS_ instead of HOST_
26 of 29 patches are in this archive. The cover letter announces 29.
Patches in v5 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/29 | compiler: Rename host_build() to tools_build()common/ common/ include/ | +13 | 2 replies | |
| 2/29 | kconfig: Add tools support to CONFIG_IS_ENABLED()include/ | +10 | 19 replies | |
| 3/29 | image: Add Kconfig options for FIT in the tools buildcommon/ common/ tools/ | +29 | 3 replies | |
| 4/29 | spl: cypto: Bring back SPL_ versions of SHAlib/ | +42 | 2 replies | |
| 5/29 | hash: Use Kconfig to enable hashing in host tools and SPLcommon/ include/ lib/ +1 more | +66 | 5 replies | |
| 6/29 | hash: Drop some #ifdefs in hash.ccommon/ | +25 | 2 replies | |
| 7/29 | image: Drop IMAGE_ENABLE_FITarch/ common/ common/ +3 more | +24 | 2 replies | |
| 8/29 | image: Drop IMAGE_ENABLE_OF_LIBFDTarch/ arch/ arch/ +9 more | +22 | 2 replies | |
| 9/29 | image: Use Kconfig to enable CONFIG_FIT_VERBOSE on hostinclude/ tools/ | +7 | 2 replies | |
| 10/29 | image: Use Kconfig to enable FIT_RSASSA_PSS on hostinclude/ include/ lib/ +2 more | +10 | 2 replies | |
| 11/29 | image: Use the correct checks for CRC32common/ common/ lib/ +2 more | +31 | 2 replies | |
| 12/29 | image: Drop IMAGE_BOOT_GET_CMDLINEcommon/ include/ | +1 | 2 replies | |
| 13/29 | image: Drop IMAGE_OF_BOARD_SETUPcommon/ include/ | +2 | 2 replies | |
| 14/29 | image: Drop IMAGE_OF_SYSTEM_SETUPcommon/ include/ | +1 | 2 replies | |
| 15/29 | image: Drop IMAGE_ENABLE_IGNOREcommon/ include/ | +1 | 2 replies | |
| 16/29 | efi: Correct dependency on FIT_SIGNATURElib/ | +1 | 1 reply | |
| 19/29 | image: Tidy up fit_unsupported_reset()common/ include/ | +8 | 1 reply | |
| 20/29 | image: Drop unnecessary #ifdefs from image.hinclude/ include/ lib/ | +8 | 1 reply | |
| 21/29 | image: Drop #ifdefs for fit_print_contents()common/ | +6 | 1 reply | |
| 22/29 | image: Drop most #ifdefs in image-board.ccommon/ include/ | +55 | 1 reply | |
| 23/29 | image: Reduce variable scope in boot_get_ramdisk()common/ | +11 | 1 reply | |
| 24/29 | image: Split up boot_get_ramdisk()common/ | +86 | 1 reply | |
| 25/29 | image: Remove #ifdefs from select_ramdisk()common/ | +72 | 2 replies | |
| 26/29 | image: Remove some #ifdefs from image-fit and image-fit-sigcommon/ common/ common/ | +16 | 1 reply | |
| 27/29 | image: Reduce variable scope in boot_get_fdt()common/ | +11 | 1 reply | |
| 28/29 | image: Split up boot_get_fdt()common/ | +126 | 1 reply |
Reviews trailers per patch
15 of 26 patches have a Reviewed-by or Acked-by.
| Patch | Alexandru Gagniuc |
|---|---|
| 1/29 | R-b |
| 2/29 | R-b |
| 3/29 | R-b R-b |
| 4/29 | R-b |
| 5/29 | R-b |
| 6/29 | R-b |
| 7/29 | R-b |
| 8/29 | R-b |
| 9/29 | R-b |
| 10/29 | R-b |
| 11/29 | R-b |
| 12/29 | R-b |
| 13/29 | R-b |
| 14/29 | R-b |
| 15/29 | R-b |
| 16/29 | |
| 19/29 | |
| 20/29 | |
| 21/29 | |
| 22/29 | |
| 23/29 | |
| 24/29 | |
| 25/29 | |
| 26/29 | |
| 27/29 | |
| 28/29 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v5 00/29] image: Reduce #ifdefs and ad-hoc defines in image code (Part B)
Much of the image-handling code predates the introduction of Kconfig and has quite a few #ifdefs in it. It also uses its own IMAGE_... defines to help reduce the #ifdefs, which is unnecessary now that we can use IS_ENABLED() et al.
The image code is also where quite a bit of code is shared with the host tools. At present this uses a lot of checks of USE_HOSTCC.
This series introduces more 'tools' Kconfig options and a way to use CONFIG_IS_ENABLED() to check them. This works in a similar way to SPL, so
CONFIG_IS_ENABLED(FIT)
will evaluate to true on the host build (USE_HOSTCC) if CONFIG_TOOLS_FIT is enabled. This allows quite a bit of clean-up of the image.h header file and many of the image C files.
The 'tools' Kconfig options should help to solve a more general problem in that we mostly want the host tools to build with all features enabled, no matter which features the 'target' build actually uses. This is a pain to arrange at present, but with 'host' Kconfigs, we can just define them all to y.
There are cases where the host tools do not have features which are present on the target, for example environment and physical addressing. To help with this, some of the core image code is split out into image-board.c and image-host.c files.
Even with these changes, some #ifdefs remain (down from about 100 to about 40 in common/image*). But the code is somewhat easier to follow and there are fewer build paths.
Note: The original version of this series met with resistance and resulted in another series that went in first. That did make some improvements but the fundamental problem of sharing code with tools remains. It seems like a good time to get this one in, before further refactoring happens. It was a significant effort to rebase this series on -next and I hope not to do it again.
This series is available at u-boot-dm/host-working
Changes in v5:
- Add a new patch to rename host_build() to tools_build()
- Add new patch to bring back SPL_ versions of SHA
- Avoid preprocessor in a few more places
- Drop I_WANT_MD5
- Drop changes to tools/Makefile since they already use TOOLS_ Kconfigs
- Drop rd_load since it is not used
- Fix up tools/Makefile to have the correct condition
- Rebase to next
- Update commit message
- Update commit message to indicate that the code is in a separate file
- Use TOOLS_ instead of HOST_
Changes in v2:
- Add SPL_ Kconfigs also, since otherwise hashing algorithms drop from SPL
- All patches rebased to -next
- Consider selecting a raw FDT to be success
- Correct comment about USE_HOSTCC being undefined in CONFIG_VAL()
- Correct logic for the non-FIT case
- Drop unnecessary setting of rd_len, etc.
- Fix up comment to put an underscore after every CONFIG
Simon Glass (29):
compiler: Rename host_build() to tools_build()
kconfig: Add tools support to CONFIG_IS_ENABLED()
image: Add Kconfig options for FIT in the tools build
spl: cypto: Bring back SPL_ versions of SHA
hash: Use Kconfig to enable hashing in host tools and SPL
hash: Drop some #ifdefs in hash.c
image: Drop IMAGE_ENABLE_FIT
image: Drop IMAGE_ENABLE_OF_LIBFDT
image: Use Kconfig to enable CONFIG_FIT_VERBOSE on host
image: Use Kconfig to enable FIT_RSASSA_PSS on host
image: Use the correct checks for CRC32
image: Drop IMAGE_BOOT_GET_CMDLINE
image: Drop IMAGE_OF_BOARD_SETUP
image: Drop IMAGE_OF_SYSTEM_SETUP
image: Drop IMAGE_ENABLE_IGNORE
efi: Correct dependency on FIT_SIGNATURE
image: Drop IMAGE_ENABLE_SIGN/VERIFY defines
image: Drop IMAGE_ENABLE_EN/DECRYPT defines
image: Tidy up fit_unsupported_reset()
image: Drop unnecessary #ifdefs from image.h
image: Drop #ifdefs for fit_print_contents()
image: Drop most #ifdefs in image-board.c
image: Reduce variable scope in boot_get_ramdisk()
image: Split up boot_get_ramdisk()
image: Remove #ifdefs from select_ramdisk()
image: Remove some #ifdefs from image-fit and image-fit-sig
image: Reduce variable scope in boot_get_fdt()
image: Split up boot_get_fdt()
image: Remove #ifdefs from select_fdt()
arch/arc/lib/bootm.c | 2 +- arch/arm/lib/bootm.c | 4 +- arch/arm/mach-imx/hab.c | 2 +- arch/microblaze/lib/bootm.c | 2 +- arch/nds32/lib/bootm.c | 4 +- arch/riscv/lib/bootm.c | 4 +- board/synopsys/hsdk/hsdk.c | 2 +- common/Kconfig.boot | 10 + common/bootm.c | 14 +- common/bootm_os.c | 8 + common/hash.c | 108 +++++----- common/image-board.c | 359 +++++++++++++++++---------------- common/image-cipher.c | 6 +- common/image-fdt.c | 275 +++++++++++++------------ common/image-fit-sig.c | 7 +- common/image-fit.c | 36 ++-- common/image.c | 14 +- common/spl/Kconfig | 13 +- include/compiler.h | 5 +- include/fdt_support.h | 2 +- include/image.h | 127 ++---------- include/linux/kconfig.h | 13 +- include/u-boot/aes.h | 8 +- include/u-boot/hash-checksum.h | 5 +- include/u-boot/rsa.h | 2 - lib/Kconfig | 66 +++++- lib/Makefile | 4 +- lib/efi_loader/Kconfig | 2 +- lib/hash-checksum.c | 2 +- lib/lmb.c | 2 +- lib/rsa/rsa-sign.c | 5 +- lib/rsa/rsa-verify.c | 16 +- tools/Kconfig | 92 +++++++++ tools/Makefile | 2 +- tools/image-host.c | 6 +- 35 files changed, 675 insertions(+), 554 deletions(-)
Signature · 1 line
2.33.0.685.g46640cef36-goog