[U-Boot] [PATCH] lib: Add CONFIG_FDT_IGNORE_FIXUP_MEMORY_NODE

Masahiro Yamada yamada.m at jp.panasonic.com
Wed Apr 9 05:20:43 CEST 2014


Hi Nobuhiro, Tom,


> diff --git a/arch/arm/lib/bootm-fdt.c b/arch/arm/lib/bootm-fdt.c
> index e40691d..8da9dac 100644
> --- a/arch/arm/lib/bootm-fdt.c
> +++ b/arch/arm/lib/bootm-fdt.c
> @@ -18,6 +18,7 @@
>  #include <common.h>
>  #include <fdt_support.h>
>  
> +#ifndef CONFIG_FDT_IGNORE_FIXUP_MEMORY_NODE
>  DECLARE_GLOBAL_DATA_PTR;
>  
>  int arch_fixup_memory_node(void *blob)
> @@ -34,3 +35,4 @@ int arch_fixup_memory_node(void *blob)
>  
>  	return fdt_fixup_memory_banks(blob, start, size, CONFIG_NR_DRAM_BANKS);
>  }
> +#endif  /* CONFIG_FDT_IGNORE_FIXUP_MEMORY_NODE */


I am not happy about defining CONFIG macro to disable some code.

Please do

#ifdef CONFIG_FDT_FIXUP_MEMORY_NODE
   .....
#endif

rather than

#ifndef CONFIG_FDT_IGNORE_FIXUP_MEMORY_NODE
   .....
#endif



We expect most of boards should be fixed-up by U-Boot.
So, add 

 #define CONFIG_FDT_FIXUP_MEMORY_NODE

to include/config_defaults.h

and

#undef  CONFIG_FDT_FIXUP_MEMORY_NODE

only to boards for which you want to skip memory fix-up.




Basically, we should not use CONFIG macros for negation.

CONFIG_SKIP_LOWLEVEL_INIT, CONFIG_SYS_DCACHE_OFF,
are examples of bad macros.


See 

ifndef CONFIG_SKIP_LOWLEVEL_INIT
obj-y	+= lowlevel_init.o
endif

everywhere in Makefiles,
which suggests we had chosen a bad macro name.



Best Regards
Masahiro Yamada



More information about the U-Boot mailing list