u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 00/29] image: Reduce #ifdefs and ad-hoc defines in image code (Part B)
@ 2021-09-26  1:43 Simon Glass
  2021-09-26  1:43 ` [PATCH v5 01/29] compiler: Rename host_build() to tools_build() Simon Glass
                   ` (25 more replies)
  0 siblings, 26 replies; 90+ messages in thread
From: Simon Glass @ 2021-09-26  1:43 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Alexandru Gagniuc, Andre Przywara, Rasmus Villemoes,
	Robert Marko, Masahiro Yamada, Tom Rini, Simon Glass,
	Alexander Graf, Joe Hershberger, Marek Vasut, Masahiro Yamada

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(-)

-- 
2.33.0.685.g46640cef36-goog


^ permalink raw reply	[flat|nested] 90+ messages in thread

end of thread, other threads:[~2021-12-17 17:40 UTC | newest]

Thread overview: 90+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-26  1:43 [PATCH v5 00/29] image: Reduce #ifdefs and ad-hoc defines in image code (Part B) Simon Glass
2021-09-26  1:43 ` [PATCH v5 01/29] compiler: Rename host_build() to tools_build() Simon Glass
2021-10-05 18:09   ` Alex G.
2021-10-09  1:39   ` Tom Rini
2021-09-26  1:43 ` [PATCH v5 02/29] kconfig: Add tools support to CONFIG_IS_ENABLED() Simon Glass
2021-09-27 16:11   ` Alex G.
2021-09-27 16:50     ` Masahiro Yamada
2021-09-27 20:17       ` Simon Glass
2021-09-27 20:17     ` Simon Glass
2021-10-05 18:11   ` Alex G.
2021-10-07  0:26   ` Tom Rini
2021-10-07  2:49     ` Simon Glass
2021-10-07  2:52       ` Tom Rini
2021-10-07 13:32         ` Simon Glass
2021-10-07 13:42           ` Tom Rini
2021-10-07 18:02             ` Simon Glass
2021-10-07 18:30               ` Tom Rini
2021-10-07 18:50                 ` Simon Glass
2021-10-07 19:32                   ` Alex G.
2021-10-07 19:39                     ` Tom Rini
2021-10-07 20:33                       ` Alex G.
2021-10-07 21:04                         ` Tom Rini
2021-10-07 21:15                           ` Alex G.
2021-10-09  1:39   ` Tom Rini
2021-09-26  1:43 ` [PATCH v5 03/29] image: Add Kconfig options for FIT in the tools build Simon Glass
2021-10-05 18:17   ` Alex G.
2021-10-05 18:17   ` Alex G.
2021-10-09  1:39   ` Tom Rini
2021-09-26  1:43 ` [PATCH v5 04/29] spl: cypto: Bring back SPL_ versions of SHA Simon Glass
2021-10-05 18:19   ` Alex G.
2021-10-09  1:39   ` Tom Rini
2021-09-26  1:43 ` [PATCH v5 05/29] hash: Use Kconfig to enable hashing in host tools and SPL Simon Glass
2021-09-27 15:53   ` Alex G.
2021-09-27 16:06     ` Simon Glass
2021-09-27 16:12       ` Alex G.
2021-10-05 18:21   ` Alex G.
2021-10-09  1:39   ` Tom Rini
2021-09-26  1:43 ` [PATCH v5 06/29] hash: Drop some #ifdefs in hash.c Simon Glass
2021-10-05 18:24   ` Alex G.
2021-10-09  1:39   ` Tom Rini
2021-09-26  1:43 ` [PATCH v5 07/29] image: Drop IMAGE_ENABLE_FIT Simon Glass
2021-10-05 18:26   ` Alex G.
2021-10-09  1:39   ` Tom Rini
2021-09-26  1:43 ` [PATCH v5 08/29] image: Drop IMAGE_ENABLE_OF_LIBFDT Simon Glass
2021-10-05 18:27   ` Alex G.
2021-10-09  1:40   ` Tom Rini
2021-09-26  1:43 ` [PATCH v5 09/29] image: Use Kconfig to enable CONFIG_FIT_VERBOSE on host Simon Glass
2021-10-05 18:29   ` Alex G.
2021-10-09  1:40   ` Tom Rini
2021-09-26  1:43 ` [PATCH v5 10/29] image: Use Kconfig to enable FIT_RSASSA_PSS " Simon Glass
2021-10-05 18:32   ` Alex G.
2021-10-09  1:40   ` Tom Rini
2021-09-26  1:43 ` [PATCH v5 11/29] image: Use the correct checks for CRC32 Simon Glass
2021-10-05 18:34   ` Alex G.
2021-10-09  1:40   ` Tom Rini
2021-09-26  1:43 ` [PATCH v5 12/29] image: Drop IMAGE_BOOT_GET_CMDLINE Simon Glass
2021-10-05 18:36   ` Alex G.
2021-10-09  1:40   ` Tom Rini
2021-09-26  1:43 ` [PATCH v5 13/29] image: Drop IMAGE_OF_BOARD_SETUP Simon Glass
2021-10-05 18:57   ` Alex G.
2021-10-09  1:40   ` Tom Rini
2021-09-26  1:43 ` [PATCH v5 14/29] image: Drop IMAGE_OF_SYSTEM_SETUP Simon Glass
2021-10-05 18:58   ` Alex G.
2021-10-09  1:40   ` Tom Rini
2021-09-26  1:43 ` [PATCH v5 15/29] image: Drop IMAGE_ENABLE_IGNORE Simon Glass
2021-10-05 18:58   ` Alex G.
2021-10-09  1:40   ` Tom Rini
2021-09-26  1:43 ` [PATCH v5 16/29] efi: Correct dependency on FIT_SIGNATURE Simon Glass
2021-10-09  1:40   ` Tom Rini
2021-09-26  1:43 ` [PATCH v5 19/29] image: Tidy up fit_unsupported_reset() Simon Glass
2021-10-09  1:40   ` Tom Rini
2021-09-26  1:43 ` [PATCH v5 20/29] image: Drop unnecessary #ifdefs from image.h Simon Glass
2021-10-09  1:41   ` Tom Rini
2021-09-26  1:43 ` [PATCH v5 21/29] image: Drop #ifdefs for fit_print_contents() Simon Glass
2021-10-09  1:41   ` Tom Rini
2021-09-26  1:43 ` [PATCH v5 22/29] image: Drop most #ifdefs in image-board.c Simon Glass
2021-10-09  1:41   ` Tom Rini
2021-09-26  1:43 ` [PATCH v5 23/29] image: Reduce variable scope in boot_get_ramdisk() Simon Glass
2021-10-09  1:41   ` Tom Rini
2021-09-26  1:43 ` [PATCH v5 24/29] image: Split up boot_get_ramdisk() Simon Glass
2021-10-09  1:41   ` Tom Rini
2021-09-26  1:43 ` [PATCH v5 25/29] image: Remove #ifdefs from select_ramdisk() Simon Glass
2021-10-09  1:41   ` Tom Rini
2021-12-17 17:40     ` Neil Armstrong
2021-09-26  1:43 ` [PATCH v5 26/29] image: Remove some #ifdefs from image-fit and image-fit-sig Simon Glass
2021-10-09  1:41   ` Tom Rini
2021-09-26  1:43 ` [PATCH v5 27/29] image: Reduce variable scope in boot_get_fdt() Simon Glass
2021-10-09  1:41   ` Tom Rini
2021-09-26  1:43 ` [PATCH v5 28/29] image: Split up boot_get_fdt() Simon Glass
2021-10-09  1:41   ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).