[U-Boot] [PATCH v3 0/10] image: Reduce code duplication and refactor

Simon Glass sjg at chromium.org
Fri May 17 01:53:18 CEST 2013


In creating a new feature[*] I found that the image code includes quite
a bit of duplication in places. In particular the code to load a kernel,
FDT and ramdisk is all fairly similar, but subtly different.

This series introduces a new function fit_image_load() which loads an image
from a FIT and supports the various features. For the bootstage updates,
these are standardised so that each file has its own range and the events
within that range have corresponding numbers. This means that the boot
progress numbers will change slightly with this series.

The image.c file is still very long. Rather than perpetuate the #ifdefs
in the code I have split out the image.c code that is dependent on
CONFIG_OF_LIBFDT into image-fdt.c.

Several architectures have their own way of setting up a ramdisk and FDT
for booting. An attempt is made here to unify these by providing a function
image_setup_linux() to handle the overall task, and image_setup_fdt() to set
up the FDT.

For ARM, the bootm code is a maze of #ifdefs, which means that many boards
compile the code differently and it takes longer to detect breakages. To get
around this, some defines are added to ARM's bootm.h to permit the use of
if() instead of #ifdef, making use of the compiler's dead code elimination.

Also this series introduces a very basic test of image loading using sandbox.
Some patches add bootm support for sandbox, and also a 'sb save' command to
save memory to a host file (used to check that the bootm actually worked).

A test program for sandbox is added as a basic sanity check of image loading
as performed by bootm.

* The new feature is support for FIT booting on x86, available in patchwork
starting here:

http://patchwork.ozlabs.org/patch/211526/

Changes in v3:
- Rebase without verified boot patches

Changes in v2:
- Add workaround for ELDK-4.2 to avoid cast warning
- Put quotes around error when selected FIT config cannot be found
- Correct definition of IMAGE_ENABLE_BEST_MATCH
- Fix checkpatch checks about parenthesis alignment
- Rebase on previous patches
- Add workaround for ELDK-4.2 to avoid cast warning

Simon Glass (10):
  bootstage: Introduce sub-IDs for use with image loading
  mkimage: Add map_sysmem() and IH_ARCH_DEFAULT to simplfy building
  image: Introduce fit_image_load() to load images from FITs
  image: Use fit_image_load() to load ramdisk
  image: Use fit_image_load() to load FDT
  sandbox: Adjust bootm command to work with sandbox
  image: Use fit_image_load() to load kernel
  sandbox: image: Adjust FIT image printing to work with sandbox
  bootstage: Remove unused entries related to kernel/ramdisk/fdt load
  sandbox: image: Create a test for loading FIT images

 common/cmd_bootm.c     | 170 +++-----------------
 common/image-fdt.c     | 207 ++++--------------------
 common/image-fit.c     | 310 +++++++++++++++++++++++++-----------
 common/image.c         | 122 ++------------
 include/bootstage.h    |  51 +++---
 include/image.h        | 105 +++++++++++-
 test/image/test-fit.py | 422 +++++++++++++++++++++++++++++++++++++++++++++++++
 tools/mkimage.h        |  12 ++
 8 files changed, 846 insertions(+), 553 deletions(-)
 create mode 100755 test/image/test-fit.py

-- 
1.8.2.1



More information about the U-Boot mailing list