]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
fdt: Allow libfdt to be used in SPL
authorSimon Glass <sjg@chromium.org>
Tue, 23 Feb 2016 05:55:45 +0000 (22:55 -0700)
committerTom Rini <trini@konsulko.com>
Mon, 14 Mar 2016 23:18:26 +0000 (19:18 -0400)
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 <sjg@chromium.org>
common/Makefile
common/bootm.c
common/image.c
include/common.h
include/image.h
lib/Kconfig
lib/Makefile

index 87231c642e4020f84af3ceecaae4e4ed522d459b..c96442bf9553ec191ab6c006f6efb7c0e1040a61 100644 (file)
@@ -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
index ff566819cb7302ea520898d07a5885d3e28b4f62..c965326db4169de9a1254282029751ecedc266e0 100644 (file)
@@ -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,
index 12102ab768b7a8f55e7c903c8c8fa83279e6469e..7d3a54397c0fd5fe17c7f2a83665c6c924abafeb 100644 (file)
@@ -29,7 +29,7 @@
 #include <image.h>
 #include <mapmem.h>
 
-#if IMAGE_ENABLE_FIT || defined(CONFIG_OF_LIBFDT)
+#if IMAGE_ENABLE_FIT || IMAGE_ENABLE_OF_LIBFDT
 #include <libfdt.h>
 #include <fdt_support.h>
 #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
index 1563d649f01cd869c35fef7f2c2a160f42ee969c..3e1a4c98b718523c7e94b95d05f7649bfed1a5b9 100644 (file)
@@ -596,12 +596,8 @@ void       upmconfig     (unsigned int, unsigned int *, unsigned int);
 ulong  get_tbclk     (void);
 void   reset_misc    (void);
 void   reset_cpu     (ulong addr);
-#if defined (CONFIG_OF_LIBFDT) && defined (CONFIG_OF_BOARD_SETUP)
 void ft_cpu_setup(void *blob, bd_t *bd);
-#ifdef CONFIG_PCI
 void ft_pci_setup(void *blob, bd_t *bd);
-#endif
-#endif
 
 void smp_set_core_boot_addr(unsigned long addr, int corenr);
 void smp_kick_all_cpus(void);
@@ -660,10 +656,8 @@ int get_serial_clock(void);
 #if defined(CONFIG_MPC85xx)
 typedef MPC85xx_SYS_INFO sys_info_t;
 void   get_sys_info  ( sys_info_t * );
-#  if defined(CONFIG_OF_LIBFDT)
-       void ft_fixup_cpu(void *, u64);
-       void ft_fixup_num_cores(void *);
-#  endif
+void ft_fixup_cpu(void *, u64);
+void ft_fixup_num_cores(void *);
 #endif
 #if defined(CONFIG_MPC86xx)
 typedef MPC86xx_SYS_INFO sys_info_t;
index 02ca43bb89e865d30a9bc88d6ec64ddf55057efd..b2fb3d90e0ce0fee1367456849f67705ced7d293 100644 (file)
@@ -26,7 +26,8 @@ struct lmb;
 #include <sys/types.h>
 
 /* new uImage format support enabled on host */
-#define IMAGE_ENABLE_FIT               1
+#define IMAGE_ENABLE_FIT       1
+#define IMAGE_ENABLE_OF_LIBFDT 1
 #define CONFIG_FIT_VERBOSE     1 /* enable fit_format_{error,warning}() */
 
 #define IMAGE_ENABLE_IGNORE    0
@@ -42,7 +43,8 @@ struct lmb;
 #define IMAGE_ENABLE_IGNORE    1
 #define IMAGE_INDENT_STRING    "   "
 
-#define IMAGE_ENABLE_FIT               CONFIG_IS_ENABLED(FIT)
+#define IMAGE_ENABLE_FIT       CONFIG_IS_ENABLED(FIT)
+#define IMAGE_ENABLE_OF_LIBFDT CONFIG_IS_ENABLED(OF_LIBFDT)
 
 #endif /* USE_HOSTCC */
 
@@ -103,12 +105,6 @@ struct lmb;
 # define IMAGE_ENABLE_RAMDISK_HIGH     0
 #endif
 
-#ifdef CONFIG_OF_LIBFDT
-# define IMAGE_ENABLE_OF_LIBFDT        1
-#else
-# define IMAGE_ENABLE_OF_LIBFDT        0
-#endif
-
 #ifdef CONFIG_SYS_BOOT_GET_CMDLINE
 # define IMAGE_BOOT_GET_CMDLINE                1
 #else
index d22a8e4338a48b5367066b6e2f8990a8d8c8aa66..078ef5c29e49e18a075b5f7c03519a6307470b6a 100644 (file)
@@ -138,6 +138,16 @@ config OF_LIBFDT
          particular compatible nodes. The library operates on a flattened
          version of the device tree.
 
+config SPL_OF_LIBFDT
+       bool "Enable the FDT library for SPL"
+       default y if SPL_OF_CONTROL
+       help
+         This enables the FDT library (libfdt). It provides functions for
+         accessing binary device tree images in memory, such as adding and
+         removing notes and properties, scanning through the tree and finding
+         particular compatible nodes. The library operates on a flattened
+         version of the device tree.
+
 source lib/efi/Kconfig
 
 endmenu
index 1e21bcc4c75ae55ebd20928b38c8f6be520eae36..d49ee62a92c726b4bafb76581825e0a87b3336f6 100644 (file)
@@ -14,8 +14,6 @@ obj-$(CONFIG_LZO) += lzo/
 obj-$(CONFIG_ZLIB) += zlib/
 obj-$(CONFIG_BZIP2) += bzip2/
 obj-$(CONFIG_TIZEN) += tizen/
-obj-$(CONFIG_OF_LIBFDT) += libfdt/
-obj-$(CONFIG_FIT) += libfdt/
 obj-$(CONFIG_FIT) += libfdt/
 obj-$(CONFIG_CMD_DHRYSTONE) += dhry/
 
@@ -50,9 +48,7 @@ obj-$(CONFIG_BITREVERSE) += bitrev.o
 obj-y += list_sort.o
 endif
 
-ifndef CONFIG_SPL_BUILD
-obj-$(CONFIG_OF_LIBFDT) += libfdt/
-endif
+obj-$(CONFIG_$(SPL_)OF_LIBFDT) += libfdt/
 ifdef CONFIG_SPL_OF_CONTROL
 obj-$(CONFIG_OF_LIBFDT) += libfdt/
 endif