From aa34fbc087f246cbd83223bed499ca62694787d8 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 22 Feb 2016 22:55:45 -0700 Subject: fdt: Allow libfdt to be used in SPL Add an option to enable libfdt in SPL. This can be useful when decoding FIT files in SPL. We need to make sure this option is not enabled in SPL by this change. Also this option needs to be enabled in host builds. Si add a new IMAGE_USE_LIBFDT #define which can be used in files that are built on the host but must also build for U-Boot and SPL. Signed-off-by: Simon Glass --- common/Makefile | 4 ++-- common/bootm.c | 4 ++-- common/image.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'common') diff --git a/common/Makefile b/common/Makefile index 87231c642e..c96442bf95 100644 --- a/common/Makefile +++ b/common/Makefile @@ -56,7 +56,7 @@ obj-$(CONFIG_ENV_IS_IN_UBI) += env_ubi.o obj-$(CONFIG_ENV_IS_NOWHERE) += env_nowhere.o obj-$(CONFIG_CMD_BEDBUG) += bedbug.o -obj-$(CONFIG_OF_LIBFDT) += fdt_support.o +obj-$(CONFIG_$(SPL_)OF_LIBFDT) += fdt_support.o obj-$(CONFIG_MII) += miiphyutil.o obj-$(CONFIG_CMD_MII) += miiphyutil.o @@ -131,7 +131,7 @@ obj-y += malloc_simple.o endif obj-y += image.o obj-$(CONFIG_ANDROID_BOOT_IMAGE) += image-android.o -obj-$(CONFIG_OF_LIBFDT) += image-fdt.o +obj-$(CONFIG_$(SPL_)OF_LIBFDT) += image-fdt.o obj-$(CONFIG_$(SPL_)FIT) += image-fit.o obj-$(CONFIG_$(SPL_)FIT_SIGNATURE) += image-sig.o obj-$(CONFIG_IO_TRACE) += iotrace.o diff --git a/common/bootm.c b/common/bootm.c index ff566819cb..c965326db4 100644 --- a/common/bootm.c +++ b/common/bootm.c @@ -234,7 +234,7 @@ int bootm_find_images(int flag, int argc, char * const argv[]) return 1; } -#if defined(CONFIG_OF_LIBFDT) +#if IMAGE_ENABLE_OF_LIBFDT /* find flattened device tree */ ret = boot_get_fdt(flag, argc, argv, IH_ARCH_DEFAULT, &images, &images.ft_addr, &images.ft_len); @@ -644,7 +644,7 @@ int do_bootm_states(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[], } } #endif -#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_LMB) +#if IMAGE_ENABLE_OF_LIBFDT && defined(CONFIG_LMB) if (!ret && (states & BOOTM_STATE_FDT)) { boot_fdt_add_mem_rsv_regions(&images->lmb, images->ft_addr); ret = boot_relocate_fdt(&images->lmb, &images->ft_addr, diff --git a/common/image.c b/common/image.c index 12102ab768..7d3a54397c 100644 --- a/common/image.c +++ b/common/image.c @@ -29,7 +29,7 @@ #include #include -#if IMAGE_ENABLE_FIT || defined(CONFIG_OF_LIBFDT) +#if IMAGE_ENABLE_FIT || IMAGE_ENABLE_OF_LIBFDT #include #include #endif @@ -762,7 +762,7 @@ int genimg_get_format(const void *img_addr) if (image_check_magic(hdr)) return IMAGE_FORMAT_LEGACY; #endif -#if IMAGE_ENABLE_FIT || defined(CONFIG_OF_LIBFDT) +#if IMAGE_ENABLE_FIT || IMAGE_ENABLE_OF_LIBFDT if (fdt_check_header(img_addr) == 0) return IMAGE_FORMAT_FIT; #endif -- cgit v1.2.1