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. This series depends on the verified boot series since it builds on the clean-up in that. You can get this series from: http://git.denx.de/u-boot-x86.git branch name 'image'. * The new feature is support for FIT booting on x86, will get back to this later. Simon Glass (22): sandbox: Allow -c argument to provide a command list sandbox: Support 'source' command fs: Add support for saving data to filesystems sandbox: fs: Add support for saving files to host filesystem image: Split libfdt code into image-fdt.c image: Add device tree setup to image library arm: Refactor bootm to reduce #ifdefs arm: Use image_setup_linux() instead of local code powerpc: Use image_setup_linux() instead of local code m68k: Use image_setup_linux() instead of local code sparc: Use image_setup_linux() instead of local code 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 WIP: sandbox: config: Remove boot command arch/arm/include/asm/bootm.h | 54 +++- arch/arm/include/asm/u-boot-arm.h | 2 - arch/arm/lib/Makefile | 1 + arch/arm/lib/bootm-fdt.c | 52 +++ arch/arm/lib/bootm.c | 145 +------- arch/m68k/lib/bootm.c | 15 +- arch/powerpc/lib/bootm.c | 84 +----- arch/sandbox/cpu/start.c | 2 +- arch/sparc/lib/bootm.c | 13 +- common/Makefile | 1 + common/cmd_bootm.c | 182 ++-------- common/cmd_sandbox.c | 18 +- common/cmd_source.c | 11 +- common/image-fdt.c | 512 +++++++++++++++++++++++++ common/image-fit.c | 293 +++++++++++----- common/image.c | 738 ++++--------------------------------- fs/fs.c | 75 ++++ fs/sandbox/sandboxfs.c | 33 ++ include/bootstage.h | 51 ++-- include/common.h | 9 + include/configs/sandbox.h | 1 - include/fdt_support.h | 2 - include/fs.h | 2 + include/image.h | 145 +++++++- include/lmb.h | 2 - include/sandboxfs.h | 1 + test/image/test-fit.py | 422 +++++++++++++++++++++ tools/mkimage.h | 12 + 28 files changed, 1674 insertions(+), 1204 deletions(-) create mode 100644 arch/arm/lib/bootm-fdt.c create mode 100644 common/image-fdt.c create mode 100755 test/image/test-fit.py -- 1.7.7.3 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot