Skip to contentSkip to conversation

Make board config available to build system

RFC New Grant Likely 3 participants 8 messages Sep 5, 2007 – Sep 6, 2007 Kbuild

lore
Share & tools
lore
#0 lore raw

cover Make board config available to build system

This series extracts the u-boot configuration from the config header files and makes it usable by the build system. The obvious application for this is to allow conditional compiliation of files without wrapping every file with a large #if defined() block (which results in shorter build times).

This is another step towards using a kconfig style build system. This step just enables make and gcc to have the same configuration data. Next step I think is to allow boards to supply a Kconfig style config file instead of a header file (and in this case, do the opposite of this patch; generate the header file based on the .config file). Until all boards are ported over, both methods can be supported based on what kind of config file (either .h or .config) is present.

Word of warning: I've most certainly broken stuff in this version. If there is suppport for this direction, then I'll make sure I get it sorted out for real.

Cheers,
g.

--
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.

#1 lore raw

PATCH 1/2 Import config.h values into include/config.mk

From: Grant Likely <[email protected]>

Use cpp and sed to postprocess config.h and import the defined values into include/config.mk. This is to support conditional compile of modules

---

 Makefile                    |    4 ++++
 mkconfig                    |    7 +++++++
 tools/scripts/define2mk.sed |   24 ++++++++++++++++++++++++
 3 files changed, 35 insertions(+), 0 deletions(-)
Makefile +4 -0
index 0477cd3..75fc4d7 100644
@@ -362,6 +362,10 @@ unconfig:
 	@rm -f $(obj)include/config.h $(obj)include/config.mk \
 		$(obj)board/*/config.tmp $(obj)board/*/*/config.tmp
 
+# Helper target for populating include/config.mk
+.populate.config.mk:
+	@${CPP} ${CFLAGS} -dM include/common.h | sed -n -f tools/scripts/define2mk.sed >> $(obj)include/config.mk
+
 #========================================================================
 # PowerPC
 #========================================================================
mkconfig +7 -0
index c3e4cea..eff7d2a 100755
@@ -84,4 +84,11 @@ fi
 echo "/* Automatically generated - do not edit */" >>config.h
 echo "#include <configs/$1.h>" >>config.h
 
+#
+# Import the board config into config.mk
+#
+
+cd ..
+make .populate.config.mk
+
 exit 0
tools/scripts/define2mk.sed new file +24 -0
new file mode 100644
index 0000000..0a74e2e
@@ -0,0 +1,24 @@
+#
+# Sed script to parse CPP macros and generate output usable by make
+#
+
+# Only process values prefixed with #define CONFIG_ or CFG_
+/^#define \(CONFIG_\|CFG_\)[A-Za-z0-9_]\+/ {
+	# Strip the #define prefix
+	s/#define *//;
+	# Change to form CONFIG_*=VALUE
+	s/ \+/=/;
+	# Drop trailing spaces
+	s/ *$//;
+	# drop quoted string values
+	s/="\(.*\)"$/=\1/;
+	# Concatenate string values
+	s/" *"//g;
+	# Wrap unknown with quotes
+	s/=\(.*\?[^0-9].*\)$/=\"\1\"/;
+	# Change empty properties and '1' properties to "y"
+	s/=$/=y/;
+	s/=1$/=y/;
+	# print the line
+	p
+}
#2 lore raw

PATCH 1/2 Import config.h values into include/config.mk

Quoted 3 lines · In message <[email protected]> you…

Use cpp and sed to postprocess config.h and import the defined values into include/config.mk. This is to support conditional compile of modules

Just a few comments....

tools/scripts/define2mk.sed line 2

Quoted 2 lines
tools/scripts/define2mk.sed new file +2 -0
+#
+# Sed script to parse CPP macros and generate output usable by make

This will NOT work!

tools/scripts/define2mk.sed line 6

Quoted 3 lines
tools/scripts/define2mk.sed new file +3 -0
+
+# Only process values prefixed with #define CONFIG_ or CFG_
+/^#define \(CONFIG_\|CFG_\)[A-Za-z0-9_]\+/ {

Optional white space between ^ and # and between # and define. White space after define may be any sequence of space and TAB chars.

tools/scripts/define2mk.sed line 8

Quoted 2 lines
tools/scripts/define2mk.sed new file +2 -0
+	# Strip the #define prefix
+	s/#define *//;

Ditto.

tools/scripts/define2mk.sed line 10

Quoted 2 lines
tools/scripts/define2mk.sed new file +2 -0
+	# Change to form CONFIG_*=VALUE
+	s/ \+/=/;

One or more spaces or tabs...

tools/scripts/define2mk.sed line 12

Quoted 2 lines
tools/scripts/define2mk.sed new file +2 -0
+	# Drop trailing spaces
+	s/ *$//;

or tabs...

tools/scripts/define2mk.sed line 14

Quoted 2 lines
tools/scripts/define2mk.sed new file +2 -0
+	# drop quoted string values
+	s/="\(.*\)"$/=\1/;

What about embedded escaped " chars?

tools/scripts/define2mk.sed line 17

Quoted 3 lines
tools/scripts/define2mk.sed new file +3 -0
+	# Concatenate string values
+	s/" *"//g;
+	# Wrap unknown with quotes

Ditto.

tools/scripts/define2mk.sed line 22

Quoted 5 lines
tools/scripts/define2mk.sed new file +5 -0
+	s/=\(.*\?[^0-9].*\)$/=\"\1\"/;
+	# Change empty properties and '1' properties to "y"
+	s/=$/=y/;
+	s/=1$/=y/;
+	# print the line

What about #defines between #if 0 / #endif pairs? Or

/*
#define CONFIG_FOO
*/

etc.

Parsing C preprocessor code is not that simple, I guess...

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
I have a theory that it's impossible to prove anything, but  I  can't
prove it.
#3 lore raw

PATCH 1/2 Import config.h values into include/config.mk

Quoted 7 lines · In message <[email protected]> you wrote:

Just a few comments....

tools/scripts/define2mk.sed line 2

Quoted 2 lines
tools/scripts/define2mk.sed new file +2 -0
+#
+# Sed script to parse CPP macros and generate output usable by make

This will NOT work!

Please ignore me.

Best regards,

Wolfgang Denk

Signature · 8 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
If a person (a) is poorly, (b) receives treatment  intended  to  make
him  better, and (c) gets better, then no power of reasoning known to
medical science can convince him  that  it  may  not  have  been  the
treatment that restored his health.
- Sir Peter Medawar, The Art of the Soluble
#4 lore raw

PATCH 1/2 Import config.h values into include/config.mk

Quoted 10 lines · Wolfgang Denk
Quoted 7 lines · In message <[email protected]> you wrote:

Just a few comments....

tools/scripts/define2mk.sed line 2

Quoted 2 lines
tools/scripts/define2mk.sed new file +2 -0
+#
+# Sed script to parse CPP macros and generate output usable by make

This will NOT work!

Please ignore me.

I could never ignore you Wolfgang. :-)

g.

Signature · 4 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely at secretlab.ca
(403) 399-0195
#5 lore raw

PATCH 1/2 Import config.h values into include/config.mk

In reply to Wolfgang Denk
Quoted 11 lines · Wolfgang Denk
Quoted 3 lines · In message <[email protected]> you…

Use cpp and sed to postprocess config.h and import the defined values into include/config.mk. This is to support conditional compile of modules

Just a few comments....

tools/scripts/define2mk.sed line 2

Quoted 2 lines
tools/scripts/define2mk.sed new file +2 -0
+#
+# Sed script to parse CPP macros and generate output usable by make

This will NOT work!

It WILL (but perhaps I should change the comment)! :-) See below.

Quoted 7 lines

tools/scripts/define2mk.sed line 6

Quoted 4 lines
tools/scripts/define2mk.sed new file +3 -0
+
+# Only process values prefixed with #define CONFIG_ or CFG_
+/^#define \(CONFIG_\|CFG_\)[A-Za-z0-9_]\+/ {

Optional white space between ^ and # and between # and define. White space after define may be any sequence of space and TAB chars.

cpp scrubs this for me (see below)

Quoted 5 lines

tools/scripts/define2mk.sed line 8

Quoted 3 lines
tools/scripts/define2mk.sed new file +2 -0
+     # Strip the #define prefix
+     s/#define *//;

Ditto.

cpp again (and again, see below)

Quoted 5 lines

tools/scripts/define2mk.sed line 10

Quoted 3 lines
tools/scripts/define2mk.sed new file +2 -0
+     # Change to form CONFIG_*=VALUE
+     s/ \+/=/;

One or more spaces or tabs...

cpp... (are you detecting a pattern yet?) :-)

Quoted 5 lines

tools/scripts/define2mk.sed line 12

Quoted 3 lines
tools/scripts/define2mk.sed new file +2 -0
+     # Drop trailing spaces
+     s/ *$//;

or tabs...

cpp...

Quoted 5 lines

tools/scripts/define2mk.sed line 14

Quoted 3 lines
tools/scripts/define2mk.sed new file +2 -0
+     # drop quoted string values
+     s/="\(.*\)"$/=\1/;

What about embedded escaped " chars?

Okay, I do need to comment on this one. The only (sane) possibility for embedded " chars is within a string. All embedded double quotes inside a string will *already* be escaped. (if not, the compile will break anyway)

Quoted 6 lines

tools/scripts/define2mk.sed line 17

Quoted 4 lines
tools/scripts/define2mk.sed new file +3 -0
+     # Concatenate string values
+     s/" *"//g;
+     # Wrap unknown with quotes

Ditto.

This should be safe also.

Quoted 8 lines

tools/scripts/define2mk.sed line 22

Quoted 6 lines
tools/scripts/define2mk.sed new file +5 -0
+     s/=\(.*\?[^0-9].*\)$/=\"\1\"/;
+     # Change empty properties and '1' properties to "y"
+     s/=$/=y/;
+     s/=1$/=y/;
+     # print the line

What about #defines between #if 0 / #endif pairs? Or

cpp...

Quoted 6 lines

/*
#define CONFIG_FOO
*/

etc.

cpp...

Quoted 3 lines

Parsing C preprocessor code is not that simple, I guess...

Indeed! I'm not even attempting this. Instead, I run common.h through '$(CROSS_COMPILE}cpp -dM' and parse the output of that. By letting cpp do the heavy lifting, all I need to parse is what 'cpp -dM' produces with is scrubbed for formatting.

Signature · 4 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely at secretlab.ca
(403) 399-0195
#6 lore raw

PATCH 2/2 Enable conditional compile for common/

In reply to Grant Likely

From: Grant Likely <[email protected]>

---

 common/Makefile          |  139 ++++++++++++++++++++++++++++++++++++++--------
 common/bedbug.c          |    5 --
 common/cmd_autoscript.c  |    7 --
 common/cmd_bdinfo.c      |    2 -
 common/cmd_bedbug.c      |    3 -
 common/cmd_bmp.c         |    4 -
 common/cmd_cache.c       |    4 -
 common/cmd_console.c     |    4 -
 common/cmd_date.c        |    4 -
 common/cmd_dcr.c         |    4 -
 common/cmd_display.c     |    4 -
 common/cmd_doc.c         |    5 --
 common/cmd_dtt.c         |    4 -
 common/cmd_eeprom.c      |    6 --
 common/cmd_elf.c         |    4 -
 common/cmd_ext2.c        |    4 -
 common/cmd_fat.c         |    8 ---
 common/cmd_fdc.c         |    4 -
 common/cmd_fdos.c        |    4 -
 common/cmd_fdt.c         |    4 -
 common/cmd_flash.c       |    4 -
 common/cmd_i2c.c         |    5 --
 common/cmd_ide.c         |    4 -
 common/cmd_immap.c       |    7 --
 common/cmd_itest.c       |    3 -
 common/cmd_jffs2.c       |    7 --
 common/cmd_log.c         |    4 -
 common/cmd_mac.c         |    3 -
 common/cmd_mfsl.c        |    4 -
 common/cmd_mii.c         |    4 -
 common/cmd_misc.c        |    4 -
 common/cmd_mmc.c         |    5 --
 common/cmd_nand.c        |   10 ---
 common/cmd_net.c         |    4 -
 common/cmd_pci.c         |    9 ---
 common/cmd_portio.c      |    4 -
 common/cmd_reginfo.c     |   10 ---
 common/cmd_reiser.c      |    4 -
 common/cmd_sata.c        |    3 -
 common/cmd_scsi.c        |    4 -
 common/cmd_spi.c         |    4 -
 common/cmd_universe.c    |    4 -
 common/cmd_usb.c         |   10 ---
 common/cmd_vfd.c         |    4 -
 common/docecc.c          |    4 -
 common/env_dataflash.c   |    3 -
 common/env_eeprom.c      |    5 --
 common/env_flash.c       |    5 --
 common/env_nand.c        |    4 -
 common/env_nowhere.c     |    5 --
 common/env_nvram.c       |    4 -
 common/fdt_support.c     |    5 --
 common/hush.c            |    2 -
 common/lcd.c             |    4 -
 common/lynxkdi.c         |    4 -
 common/miiphybb.c        |    5 --
 common/miiphyutil.c      |    4 -
 common/serial.c          |    4 -
 common/soft_i2c.c        |    5 --
 common/soft_spi.c        |    4 -
 common/usb.c             |    7 --
 common/usb_kbd.c         |    5 --
 common/usb_storage.c     |    8 ---
 config.mk                |    1 
 include/configs/pf5200.h |    2 -
 65 files changed, 118 insertions(+), 319 deletions(-)
common/Makefile +115 -24
index ef7d097..d8c4713 100644
@@ -27,31 +27,122 @@ LIB	= $(obj)libcommon.a
 
 AOBJS	=
 
-COBJS	= main.o ACEX1K.o altera.o bedbug.o circbuf.o cmd_autoscript.o \
-	  cmd_bdinfo.o cmd_bedbug.o cmd_bmp.o cmd_boot.o cmd_bootm.o \
-	  cmd_cache.o cmd_console.o \
-	  cmd_date.o cmd_dcr.o cmd_diag.o cmd_display.o cmd_doc.o cmd_dtt.o \
-	  cmd_eeprom.o cmd_elf.o cmd_ext2.o \
-	  cmd_fat.o cmd_fdc.o cmd_fdt.o cmd_fdos.o cmd_flash.o cmd_fpga.o \
-	  cmd_i2c.o cmd_ide.o cmd_immap.o cmd_itest.o cmd_jffs2.o \
-	  cmd_load.o cmd_log.o \
-	  cmd_mem.o cmd_mii.o cmd_misc.o cmd_mmc.o \
-	  cmd_nand.o cmd_net.o cmd_nvedit.o \
-	  cmd_pci.o cmd_pcmcia.o cmd_portio.o \
-	  cmd_reginfo.o cmd_reiser.o cmd_sata.o cmd_scsi.o cmd_spi.o \
-	  cmd_universe.o cmd_usb.o cmd_vfd.o \
-	  command.o console.o cyclon2.o devices.o dlmalloc.o docecc.o \
-	  environment.o env_common.o \
-	  env_nand.o env_dataflash.o env_flash.o env_eeprom.o \
-	  env_nvram.o env_nowhere.o \
-	  exports.o \
-	  fdt_support.o flash.o fpga.o ft_build.o \
-	  hush.o kgdb.o lcd.o lists.o lynxkdi.o \
-	  memsize.o miiphybb.o miiphyutil.o \
-	  s_record.o serial.o soft_i2c.o soft_spi.o spartan2.o spartan3.o \
-	  usb.o usb_kbd.o usb_storage.o \
-	  virtex2.o xilinx.o crc16.o xyzModem.o cmd_mac.o cmd_mfsl.o
+COBJS-y += main.o ACEX1K.o circbuf.o cmd_boot.o cmd_bootm.o
+COBJS-y += cmd_load.o cmd_mem.o
+COBJS-$(CONFIG_CMD_BEDBUG)	+= bedbug.o
+COBJS-$(CONFIG_AUTOSCRIPT)	+= cmd_autoscript.o
+COBJS-$(CONFIG_CMD_AUTOSCRIPT)	+= cmd_autoscript.o
+COBJS-$(CONFIG_CMD_BDI)		+= cmd_bdinfo.o
+COBJS-$(CONFIG_CMD_BEDBUG)	+= cmd_bedbug.o
+COBJS-$(CONFIG_CMD_BMP)		+= cmd_bmp.o
+COBJS-$(CONFIG_CMD_CACHE)	+= cmd_cache.o
+COBJS-$(CONFIG_CMD_CONSOLE)	+= cmd_console.o
+COBJS-$(CONFIG_CMD_DATE)	+= cmd_date.o
+COBJS-$(CONFIG_4xx)		+= cmd_dcr.o
+COBJS-$(CONFIG_CMD_GETSETDCR)	+= cmd_diag.o
+COBJS-$(CONFIG_CMD_DISPLAY)	+= cmd_display.o
+COBJS-$(CONFIG_CMD_DOC)		+= cmd_doc.o docecc.o
+COBJS-$(CONFIG_CMD_DTT)		+= cmd_dtt.o
 
+ifeq ($(CONFIG_CMD_EEPROM),y)
+COBJS-y				+= cmd_eeprom.o
+else
+COBJS-$(CONFIG_ENV_IN_EEPROM)	+= cmd_eeprom.o
+endif
+
+COBJS-$(CONFIG_CMD_ELF)		+= cmd_elf.o
+COBJS-$(CONFIG_CMD_EXT2)	+= cmd_ext2.o
+COBJS-$(CONFIG_CMD_FAT)		+= cmd_fat.o
+
+ifeq ($(CONFIG_CMD_FDC),y)
+COBJS-$(CONFIG_CMD_FDC)		+= cmd_fdc.o
+else
+COBJS-$(CONFIG_CMD_FDOS)	+= cmd_fdc.o
+endif
+
+COBJS-$(CONFIG_OF_LIBFDT)	+= cmd_fdt.o fdt_support.o
+COBJS-$(CONFIG_OF_FLAT_TREE)	+= ft_build.o
+COBJS-$(CONFIG_CMD_FDOS)	+= cmd_fdos.o
+COBJS-$(CONFIG_CMD_FLASH)	+= cmd_flash.o
+COBJS-$(CONFIG_CMD_I2C)		+= cmd_i2c.o
+COBJS-$(CONFIG_CMD_IDE)		+= cmd_ide.o
+
+ifeq ($(CONFIG_CMD_IMMAP),y)
+COBJS-$(CONFIG_8xx)		+= cmd_immap.o
+COBJS-$(CONFIG_8260)		+= cmd_immap.o
+endif
+
+COBJS-$(CONFIG_CMD_ITEST)	+= cmd_itest.o
+COBJS-$(CONFIG_CMD_JFFS2)	+= cmd_jffs2.o
+COBJS-$(CONFIG_LOGBUFFER)	+= cmd_log.o
+COBJS-$(CONFIG_CMD_MISC)	+= cmd_misc.o
+COBJS-$(CONFIG_CMD_MMC)		+= cmd_mmc.o
+
+ifneq ($(CFG_NAND_LEGACY),y)
+COBJS-$(CONFIG_CMD_NAND)	+= cmd_nand.o
+endif
+
+COBJS-$(CONFIG_CMD_NET)		+= cmd_net.o
+COBJS-y				+= cmd_nvedit.o
+ifeq ($(CONFIG_PCI),y)
+COBJS-$(CONFIG_CMD_PCI)		+= cmd_pci.o
+endif
+COBJS-y				+= cmd_pcmcia.o
+COBJS-$(CONFIG_CMD_PORTIO)	+= cmd_portio.o
+COBJS-$(CONFIG_CMD_REGINFO)	+= cmd_reginfo.o
+COBJS-$(CONFIG_CMD_REISER)	+= cmd_reiser.o
+COBJS-$(CFG_SATA_SUPPORTED)	+= cmd_sata.o
+COBJS-$(CONFIG_CMD_SCSI)	+= cmd_scsi.o
+COBJS-$(CONFIG_CMD_SPI)		+= cmd_spi.o
+COBJS-$(CONFIG_CMD_UNIVERSE)	+= cmd_universe.o
+COBJS-$(CONFIG_CMD_USB)		+= cmd_usb.o usb.o
+COBJS-$(CONFIG_CMD_VFD)		+= cmd_vfd.o
+COBJS-y				+= command.o
+COBJS-y				+= console.o
+COBJS-y				+= cyclon2.o
+COBJS-y				+= devices.o
+COBJS-y				+= dlmalloc.o
+COBJS-y				+= environment.o
+COBJS-y				+= env_common.o
+COBJS-$(CFG_ENV_IS_IN_NAND)	+= env_nand.o
+COBJS-$(CFG_ENV_IS_IN_DATAFLASH)+= env_dataflash.o
+COBJS-$(CFG_ENV_IS_IN_FLASH)	+= env_flash.o
+COBJS-$(CFG_ENV_IS_IN_EEPROM)	+= env_eeprom.o
+COBJS-$(CFG_ENV_IS_IN_NVRAM)	+= env_nvram.o
+COBJS-$(CFG_ENV_IS_NOWHERE)	+= env_nowhere.o
+COBJS-y				+= exports.o
+COBJS-y				+= flash.o
+COBJS-$(CFG_HUSH_PARSER)	+= hush.o
+COBJS-y				+= kgdb.o
+COBJS-$(CONFIG_LCD)		+= lcd.o
+COBJS-y				+= lists.o
+COBJS-$(CONFIG_LYNXKDI)		+= lynxkdi.o
+COBJS-y				+= memsize.o
+COBJS-$(CONFIG_BITBANGMII)	+= miiphybb.o
+
+ifeq ($(CONFIG_MII),y)
+COBJS-y				+= miiphyutil.o
+else
+COBJS-$(CONFIG_CMD_MII)		+= miiphyutil.o cmd_mii.o
+endif
+
+COBJS-y += s_record.o
+COBJS-$(CONFIG_SERIAL_MULTI)	+= serial.o
+COBJS-$(CONFIG_SOFT_I2C)	+= soft_i2c.o
+COBJS-$(CONFIG_SOFT_SPI)	+= soft_spi.o
+COBJS-$(CONFIG_USB_KEYBOARD)	+= usb_kbd.o
+COBJS-$(CONFIG_USB_STORAGE)	+= usb_storage.o
+COBJS-y				+= crc16.o
+COBJS-y				+= xyzModem.o
+COBJS-$(CFG_ID_EEPROM)		+= cmd_mac.o
+COBJS-$(CONFIG_CMD_MFSL)	+= cmd_mfsl.o
+
+# FPGA support
+COBJS-y				+= fpga.o cmd_fpga.o
+COBJS-y				+= altera.o
+COBJS-y				+= xilinx.o spartan2.o spartan3.o virtex2.o
+
+COBJS	:= $(COBJS-y)
 SRCS	:= $(AOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(AOBJS) $(COBJS))
 
common/bedbug.c +0 -5
index 3bf1fc3..3e76c62 100644
@@ -1,9 +1,6 @@
 /* $Id$ */
 
 #include <common.h>
-
-#if defined(CONFIG_CMD_BEDBUG)
-
 #include <linux/ctype.h>
 #include <bedbug/bedbug.h>
 #include <bedbug/ppc.h>
@@ -1252,5 +1249,3 @@ int find_next_address (unsigned char *nextaddr, int step_over,
  * warranties of merchantability and fitness for a particular
  * purpose.
  */
-
-#endif
common/cmd_autoscript.c +0 -7
index a6038a6..7929d6f 100644
@@ -47,8 +47,6 @@
 #include <hush.h>
 #endif
 
-#if defined(CONFIG_AUTOSCRIPT) || defined(CONFIG_CMD_AUTOSCRIPT)
-
 extern image_header_t header;		/* from cmd_bootm.c */
 int
 autoscript (ulong addr)
@@ -149,8 +147,6 @@ autoscript (ulong addr)
 	return rcode;
 }
 
-#endif
-
 /**************************************************/
 #if defined(CONFIG_CMD_AUTOSCRIPT)
 int
@@ -170,7 +166,6 @@ do_autoscript (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 	return rcode;
 }
 
-#if defined(CONFIG_CMD_AUTOSCRIPT)
 U_BOOT_CMD(
 	autoscr, 2, 0,	do_autoscript,
 	"autoscr - run script from memory\n",
@@ -178,5 +173,3 @@ U_BOOT_CMD(
 	" - A valid autoscr header must be present\n"
 );
 #endif
-
-#endif
common/cmd_bdinfo.c +0 -2
index ef15a00..d059983 100644
@@ -30,7 +30,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#if defined(CONFIG_CMD_BDI)
 static void print_num(const char *, ulong);
 
 #ifndef CONFIG_ARM	/* PowerPC and other */
@@ -350,4 +349,3 @@ U_BOOT_CMD(
 	"bdinfo  - print Board Info structure\n",
 	NULL
 );
-#endif
common/cmd_bedbug.c +0 -3
index 1c3547a..94f7e08 100644
@@ -13,8 +13,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#if defined(CONFIG_CMD_BEDBUG)
-
 #ifndef MAX
 #define MAX(a,b) ((a) > (b) ? (a) : (b))
 #endif
@@ -413,7 +411,6 @@ int do_bedbug_rdump (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
 U_BOOT_CMD (rdump, 1, 1, do_bedbug_rdump,
 	    "rdump   - Show registers.\n", " - Show registers.\n");
 /* ====================================================================== */
-#endif
 
 
 /*
common/cmd_bmp.c +0 -4
index 241aa83..907f9a2 100644
@@ -31,8 +31,6 @@
 #include <asm/byteorder.h>
 #include <malloc.h>
 
-#if defined(CONFIG_CMD_BMP)
-
 static int bmp_info (ulong addr);
 static int bmp_display (ulong addr, int x, int y);
 
@@ -187,5 +185,3 @@ static int bmp_display(ulong addr, int x, int y)
 # error bmp_display() requires CONFIG_LCD or CONFIG_VIDEO
 #endif
 }
-
-#endif /* defined(CONFIG_CMD_BMP) */
common/cmd_cache.c +0 -4
index 675d43f..99b92bd 100644
@@ -27,8 +27,6 @@
 #include <common.h>
 #include <command.h>
 
-#if defined(CONFIG_CMD_CACHE)
-
 static int on_off (const char *);
 
 int do_icache ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
@@ -108,5 +106,3 @@ U_BOOT_CMD(
 	"[on, off]\n"
 	"    - enable or disable data (writethrough) cache\n"
 );
-
-#endif
common/cmd_console.c +0 -4
index 5e0f990..50ddb01 100644
@@ -28,8 +28,6 @@
 #include <command.h>
 #include <devices.h>
 
-#if defined(CONFIG_CMD_CONSOLE)
-
 extern void _do_coninfo (void);
 int do_coninfo (cmd_tbl_t * cmd, int flag, int argc, char *argv[])
 {
@@ -67,5 +65,3 @@ U_BOOT_CMD(
 	"coninfo - print console devices and information\n",
 	""
 );
-
-#endif
common/cmd_date.c +0 -4
index 4a42534..7511598 100644
@@ -31,8 +31,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#if defined(CONFIG_CMD_DATE)
-
 const char *weekdays[] = {
 	"Sun", "Mon", "Tues", "Wednes", "Thurs", "Fri", "Satur",
 };
@@ -210,5 +208,3 @@ U_BOOT_CMD(
 	"  - with numeric argument: set the system date & time\n"
 	"  - with 'reset' argument: reset the RTC\n"
 );
-
-#endif
common/cmd_dcr.c +0 -4
index 12fa9db..a053343 100644
@@ -29,8 +29,6 @@
 #include <config.h>
 #include <command.h>
 
-#if defined(CONFIG_4xx) && defined(CONFIG_CMD_SETGETDCR)
-
 unsigned long get_dcr (unsigned short);
 unsigned long set_dcr (unsigned short, unsigned long);
 
@@ -245,5 +243,3 @@ U_BOOT_CMD(
 	"setidcr - Set a register value via indirect DCR addressing\n",
 	"adr_dcrn[.dat_dcrn] offset value - write offset to adr_dcrn, write value to dat_dcrn.\n"
 );
-
-#endif
common/cmd_display.c +0 -4
index d19f412..a29345c 100644
@@ -24,8 +24,6 @@
 #include <common.h>
 #include <command.h>
 
-#if defined(CONFIG_CMD_DISPLAY)
-
 #undef DEBUG_DISP
 
 #define DISP_SIZE	8
@@ -78,5 +76,3 @@ U_BOOT_CMD(
 	"    - with <string> argument: display <string> on dot matrix display\n"
 	"    - without arguments: clear dot matrix display\n"
 );
-
-#endif
common/cmd_doc.c +0 -5
index d6d3aff..3d717c0 100644
@@ -11,9 +11,6 @@
 #include <command.h>
 #include <malloc.h>
 #include <asm/io.h>
-
-#if defined(CONFIG_CMD_DOC)
-
 #include <linux/mtd/nftl.h>
 #include <linux/mtd/doc2000.h>
 
@@ -1607,5 +1604,3 @@ void doc_probe(unsigned long physadr)
 		puts ("No DiskOnChip found\n");
 	}
 }
-
-#endif
common/cmd_dtt.c +0 -4
index 8da95bf..2d8f2d4 100644
@@ -25,8 +25,6 @@
 #include <config.h>
 #include <command.h>
 
-#if defined(CONFIG_CMD_DTT)
-
 #include <dtt.h>
 #include <i2c.h>
 
@@ -60,5 +58,3 @@ U_BOOT_CMD(
 	  "dtt     - Digital Thermometer and Themostat\n",
 	  "        - Read temperature from digital thermometer and thermostat.\n"
 );
-
-#endif
common/cmd_eeprom.c +0 -6
index e5000e9..2dfb249 100644
@@ -42,8 +42,6 @@
 #include <command.h>
 #include <i2c.h>
 
-#if defined(CFG_ENV_IS_IN_EEPROM) || defined(CONFIG_CMD_EEPROM)
-
 extern void eeprom_init  (void);
 extern int  eeprom_read  (unsigned dev_addr, unsigned offset,
 			  uchar *buffer, unsigned cnt);
@@ -52,7 +50,6 @@ extern int  eeprom_write (unsigned dev_addr, unsigned offset,
 #if defined(CFG_EEPROM_WREN)
 extern int eeprom_write_enable (unsigned dev_addr, int state);
 #endif
-#endif
 
 
 #if defined(CFG_EEPROM_X40430)
@@ -121,8 +118,6 @@ int do_eeprom ( cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
  *   0x00000nxx for EEPROM address selectors and page number at n.
  */
 
-#if defined(CFG_ENV_IS_IN_EEPROM) || defined(CONFIG_CMD_EEPROM)
-
 #ifndef CONFIG_SPI
 #if !defined(CFG_I2C_EEPROM_ADDR_LEN) || CFG_I2C_EEPROM_ADDR_LEN < 1 || CFG_I2C_EEPROM_ADDR_LEN > 2
 #error CFG_I2C_EEPROM_ADDR_LEN must be 1 or 2
@@ -397,7 +392,6 @@ eeprom_probe (unsigned dev_addr, unsigned offset)
 
 	return (i2c_probe (chip));
 }
-#endif
 
 /*-----------------------------------------------------------------------
  * Set default values
common/cmd_elf.c +0 -4
index 63a5593..2eb7453 100644
@@ -23,8 +23,6 @@
 DECLARE_GLOBAL_DATA_PTR;
 #endif
 
-#if defined(CONFIG_CMD_ELF)
-
 #ifndef MAX
 #define MAX(a,b) ((a) > (b) ? (a) : (b))
 #endif
@@ -323,5 +321,3 @@ U_BOOT_CMD(
 	"bootvx  - Boot vxWorks from an ELF image\n",
 	" [address] - load address of vxWorks ELF image.\n"
 );
-
-#endif
common/cmd_ext2.c +0 -4
index 8bd2b47..f569406 100644
@@ -34,8 +34,6 @@
  */
 #include <common.h>
 #include <part.h>
-
-#if defined(CONFIG_CMD_EXT2)
 #include <config.h>
 #include <command.h>
 #include <image.h>
@@ -259,5 +257,3 @@ U_BOOT_CMD(
 	"    - load binary file 'filename' from 'dev' on 'interface'\n"
 	"      to address 'addr' from ext2 filesystem\n"
 );
-
-#endif
common/cmd_fat.c +1 -7
index 54f0f9f..60fda78 100644
@@ -30,13 +30,9 @@
 #include <net.h>
 #include <ata.h>
 #include <part.h>
-
-#if defined(CONFIG_CMD_FAT)
-
-#undef	DEBUG
-
 #include <fat.h>
 
+#undef	DEBUG
 
 int do_fat_fsload (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
@@ -323,5 +319,3 @@ void hexdump (int cnt, unsigned char *data)
 	}
 }
 #endif	/* NOT_IMPLEMENTED_YET */
-
-#endif
common/cmd_fdc.c +0 -4
index 7349412..e29b501 100644
@@ -51,9 +51,6 @@
 /*#include <rtc.h> */
 /*#endif */
 
-#if defined(CONFIG_CMD_FDC) || defined(CONFIG_CMD_FDOS)
-
-
 typedef struct {
 	int						flags;		/* connected drives ect */
 	unsigned long blnr;			/* Logical block nr */
@@ -893,4 +890,3 @@ U_BOOT_CMD(
 	"fdcboot - boot from floppy device\n",
 	"loadAddr drive\n"
 );
-#endif
common/cmd_fdos.c +0 -4
index f9da98d..b3dbd19 100644
@@ -31,8 +31,6 @@
 #include <command.h>
 #include <fdc.h>
 
-#if defined(CONFIG_CMD_FDOS)
-
 /*-----------------------------------------------------------------------------
  * do_fdosboot --
  *-----------------------------------------------------------------------------
@@ -153,5 +151,3 @@ U_BOOT_CMD(
 	"fdosls  - list files in a directory\n",
 	"[directory]\n"
 );
-
-#endif
common/cmd_fdt.c +0 -4
index 571b8f1..0003a7a 100644
@@ -29,8 +29,6 @@
 #include <linux/ctype.h>
 #include <linux/types.h>
 
-#ifdef CONFIG_OF_LIBFDT
-
 #include <asm/global_data.h>
 #include <fdt.h>
 #include <libfdt.h>
@@ -692,5 +690,3 @@ U_BOOT_CMD(
 	"          fdt print /cpus \"#address-cells\"\n"
 	"          fdt set   /cpus \"#address-cells\" \"[00 00 00 01]\"\n"
 );
-
-#endif /* CONFIG_OF_LIBFDT */
common/cmd_flash.c +0 -4
index 11c8857..f56443e 100644
@@ -31,8 +31,6 @@
 #include <dataflash.h>
 #endif
 
-#if defined(CONFIG_CMD_FLASH)
-
 #if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
 #include <jffs2/jffs2.h>
 
@@ -731,5 +729,3 @@ U_BOOT_CMD(
 #undef	TMP_ERASE
 #undef	TMP_PROT_ON
 #undef	TMP_PROT_OFF
-
-#endif
common/cmd_i2c.c +0 -5
index a684a58..10cab46 100644
@@ -86,9 +86,6 @@
 #include <i2c.h>
 #include <asm/byteorder.h>
 
-#if defined(CONFIG_CMD_I2C)
-
-
 /* Display values from last command.
  * Memory modify remembered values are different from display memory.
  */
@@ -1024,5 +1021,3 @@ U_BOOT_CMD(
 	"      (valid chip values 50..57)\n"
 );
 #endif
-
-#endif
common/cmd_ide.c +0 -4
index bb064ea..fccf666 100644
@@ -72,8 +72,6 @@ DECLARE_GLOBAL_DATA_PTR;
 # define SYNC		/* nothing */
 #endif
 
-#if defined(CONFIG_CMD_IDE)
-
 #ifdef CONFIG_IDE_8xx_DIRECT
 /* Timings for IDE Interface
  *
@@ -2085,5 +2083,3 @@ U_BOOT_CMD(
 	"diskboot- boot from IDE device\n",
 	"loadAddr dev:part\n"
 );
-
-#endif
common/cmd_immap.c +0 -7
index ae95758..ba12c5f 100644
@@ -27,10 +27,6 @@
 
 #include <common.h>
 #include <command.h>
-
-#if defined(CONFIG_CMD_IMMAP) && \
-    (defined(CONFIG_8xx) || defined(CONFIG_8260))
-
 #if defined(CONFIG_8xx)
 #include <asm/8xx_immap.h>
 #include <commproc.h>
@@ -718,6 +714,3 @@ U_BOOT_CMD(
 	"mccinfo - print MCC registers\n",
 	NULL
 );
-
-
-#endif
common/cmd_itest.c +0 -3
index 8e20517..ce98872 100644
@@ -32,8 +32,6 @@
 #include <config.h>
 #include <command.h>
 
-#if defined(CONFIG_CMD_ITEST)
-
 #define EQ	0
 #define NE	1
 #define LT	2
@@ -197,4 +195,3 @@ U_BOOT_CMD(
 	"itest\t- return true/false on integer compare\n",
 	"[.b, .w, .l, .s] [*]value1 <op> [*]value2\n"
 );
-#endif
common/cmd_jffs2.c +0 -7
index 513a226..6adc93f 100644
@@ -93,9 +93,6 @@
 #include <jffs2/jffs2.h>
 #include <linux/list.h>
 #include <linux/ctype.h>
-
-#if defined(CONFIG_CMD_JFFS2)
-
 #include <cramfs/cramfs_fs.h>
 
 #if defined(CONFIG_CMD_NAND)
@@ -2189,7 +2186,3 @@ U_BOOT_CMD(
 	"<ro-flag>  := when set to 'ro' makes partition read-only (not used, passed to kernel)\n"
 );
 #endif /* #ifdef CONFIG_JFFS2_CMDLINE */
-
-/***************************************************/
-
-#endif
common/cmd_log.c +0 -4
index fba8bd8..e593dbe 100644
@@ -48,8 +48,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#if defined(CONFIG_LOGBUFFER)
-
 /* Local prototypes */
 static void logbuff_putc (const char c);
 static void logbuff_puts (const char *s);
@@ -287,5 +285,3 @@ static int logbuff_printk(const char *line)
 	}
 	return i;
 }
-
-#endif /* (CONFIG_LOGBUFFER) */
common/cmd_mac.c +0 -3
index 0add432..3e4ad51 100644
@@ -24,8 +24,6 @@
 #include <common.h>
 #include <command.h>
 
-#ifdef CFG_ID_EEPROM
-
 extern int do_mac(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
 
 U_BOOT_CMD(
@@ -63,4 +61,3 @@ U_BOOT_CMD(
 	"mac 7\n"
 	"    - program the MAC address for port 7\n"
 );
-#endif /* CFG_ID_EEPROM */
common/cmd_mfsl.c +0 -4
index 8d4c1a3..5ce3aae 100644
@@ -29,8 +29,6 @@
 #include <common.h>
 #include <config.h>
 #include <command.h>
-
-#if defined(CONFIG_CMD_MFSL)
 #include <asm/asm.h>
 
 int do_frd (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
@@ -413,5 +411,3 @@ U_BOOT_CMD (rspr, 3, 1, do_rspr,
 		" 0 - MSR - Machine status register\n"
 		" 1 - EAR - Exception address register\n"
 		" 2 - ESR - Exception status register\n");
-
-#endif
common/cmd_mii.c +0 -4
index 72e11d5..b876841 100644
@@ -27,8 +27,6 @@
 
 #include <common.h>
 #include <command.h>
-
-#if defined(CONFIG_CMD_MII)
 #include <miiphy.h>
 
 #ifdef CONFIG_TERSE_MII
@@ -594,5 +592,3 @@ U_BOOT_CMD(
 );
 
 #endif /* CONFIG_TERSE_MII */
-
-#endif
common/cmd_misc.c +0 -4
index c0c6b8f..126b538 100644
@@ -27,8 +27,6 @@
 #include <common.h>
 #include <command.h>
 
-#if defined(CONFIG_CMD_MISC)
-
 int do_sleep (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
 	ulong start = get_timer(0);
@@ -68,5 +66,3 @@ U_BOOT_CMD(
 	"N\n"
 	"    - delay execution for N seconds (N is _decimal_ !!!)\n"
 );
-
-#endif
common/cmd_mmc.c +0 -5
index 069c6d0..25c9702 100644
@@ -23,9 +23,6 @@
 
 #include <common.h>
 #include <command.h>
-
-#if defined(CONFIG_CMD_MMC)
-
 #include <mmc.h>
 
 int do_mmc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
@@ -42,5 +39,3 @@ U_BOOT_CMD(
 	"mmcinit - init mmc card\n",
 	NULL
 );
-
-#endif
common/cmd_nand.c +0 -10
index 254a775..96512c4 100644
@@ -17,10 +17,6 @@
  * New NAND support
  *
  */
-#include <common.h>
-
-#if defined(CONFIG_CMD_NAND)
-
 #include <command.h>
 #include <watchdog.h>
 #include <malloc.h>
@@ -633,8 +629,6 @@ U_BOOT_CMD(nboot, 4, 1, do_nandboot,
 	"nboot   - boot from NAND device\n",
 	"[.jffs2] [partition] | [[[loadAddr] dev] offset]\n");
 
-#endif
-
 #else /* CFG_NAND_LEGACY */
 /*
  *
@@ -653,7 +647,6 @@ U_BOOT_CMD(nboot, 4, 1, do_nandboot,
 # define show_boot_progress(arg)
 #endif
 
-#if defined(CONFIG_CMD_NAND)
 #include <linux/mtd/nand_legacy.h>
 #if 0
 #include <linux/mtd/nand_ids.h>
@@ -1017,7 +1010,4 @@ U_BOOT_CMD(
 	"nboot   - boot from NAND device\n",
 	"loadAddr dev\n"
 );
-
-#endif
-
 #endif /* CFG_NAND_LEGACY */
common/cmd_net.c +0 -4
index 0715fbc..21682c0 100644
@@ -28,8 +28,6 @@
 #include <command.h>
 #include <net.h>
 
-#if defined(CONFIG_CMD_NET)
-
 extern int do_bootm (cmd_tbl_t *, int, int, char *[]);
 
 static int netboot_common (proto_t, cmd_tbl_t *, int , char *[]);
@@ -343,5 +341,3 @@ U_BOOT_CMD(
 	"[NTP server IP]\n"
 );
 #endif
-
-#endif
common/cmd_pci.c +0 -9
index 8be6da9..82d9717 100644
@@ -30,16 +30,11 @@
  */
 
 #include <common.h>
-
-#ifdef CONFIG_PCI
-
 #include <command.h>
 #include <asm/processor.h>
 #include <asm/io.h>
 #include <pci.h>
 
-#if defined(CONFIG_CMD_PCI)
-
 extern int cmd_get_data_size(char* arg, int default_size);
 
 unsigned char	ShortPCIListing = 1;
@@ -564,7 +559,3 @@ U_BOOT_CMD(
 	"pci write[.b, .w, .l] b.d.f address value\n"
 	"    - write to CFG address\n"
 );
-
-#endif
-
-#endif /* CONFIG_PCI */
common/cmd_portio.c +0 -4
index bfe33e3..a06cac0 100644
@@ -30,8 +30,6 @@
 #include <common.h>
 #include <command.h>
 
-#if defined(CONFIG_CMD_PORTIO)
-
 extern int cmd_get_data_size (char *arg, int default_size);
 
 /* Display values from last command.
@@ -165,5 +163,3 @@ U_BOOT_CMD(
 	"[.b, .w, .l] port\n"
 	"    - read datum from IO port\n"
 );
-
-#endif
common/cmd_reginfo.c +0 -10
index 17e9cd9..f7a5719 100644
@@ -33,8 +33,6 @@
 #include <mpc5xxx.h>
 #endif
 
-#if defined(CONFIG_CMD_REGINFO)
-
 int do_reginfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
 #if defined(CONFIG_8xx)
@@ -335,17 +333,9 @@ int do_reginfo (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 	return 0;
 }
 
-#endif
-
-
  /**************************************************/
 
-#if ( defined(CONFIG_8xx)   || defined(CONFIG_405GP) || \
-      defined(CONFIG_405EP) || defined(CONFIG_MPC5200)  ) && \
-    defined(CONFIG_CMD_REGINFO)
-
 U_BOOT_CMD(
  	reginfo,	2,	1,	do_reginfo,
 	"reginfo - print register information\n",
 );
-#endif
common/cmd_reiser.c +0 -4
index 1ba3929..b7395d7 100644
@@ -27,8 +27,6 @@
  * Reiserfs support
  */
 #include <common.h>
-
-#if defined(CONFIG_CMD_REISER)
 #include <config.h>
 #include <command.h>
 #include <image.h>
@@ -239,5 +237,3 @@ U_BOOT_CMD(
 	"    - load binary file 'filename' from 'dev' on 'interface'\n"
 	"      to address 'addr' from dos filesystem\n"
 );
-
-#endif
common/cmd_sata.c +0 -3
index bd4c11f..e28a32f 100644
@@ -34,7 +34,6 @@
 #include <ide.h>
 #include <ata.h>
 
-#ifdef CFG_SATA_SUPPORTED
 /*For debug prints set macro DEBUG_SATA to 1 */
 #define DEBUG_SATA 0
 /*Macro for SATA library specific declarations */
@@ -708,5 +707,3 @@ U_BOOT_CMD (sata, 5, 1, do_sata,
 	    "sata dev device\n"
 	    "sata read  addr blk# cnt\n"
 	    "sata write  addr blk# cnt\n", "cmd for init,rw and dev-info\n");
-
-#endif
common/cmd_scsi.c +0 -4
index f563931..3e9fd8a 100644
@@ -34,8 +34,6 @@
 #include <image.h>
 #include <pci.h>
 
-#if defined(CONFIG_CMD_SCSI)
-
 #ifdef CONFIG_SCSI_SYM53C8XX
 #define SCSI_VEND_ID	0x1000
 #ifndef CONFIG_SCSI_DEV_ID
@@ -608,5 +606,3 @@ U_BOOT_CMD(
 	"scsiboot- boot from SCSI device\n",
 	"loadAddr dev:part\n"
 );
-
-#endif
common/cmd_spi.c +0 -4
index 3118d27..7604422 100644
@@ -29,8 +29,6 @@
 #include <command.h>
 #include <spi.h>
 
-#if defined(CONFIG_CMD_SPI)
-
 /*-----------------------------------------------------------------------
  * Definitions
  */
@@ -139,5 +137,3 @@ U_BOOT_CMD(
 	"<bit_len> - Number of bits to send (base 10)\n"
 	"<dout>    - Hexadecimal string that gets sent\n"
 );
-
-#endif
common/cmd_universe.c +0 -4
index 8bf0b1f..ea97782 100644
@@ -28,8 +28,6 @@
 
 #include <universe.h>
 
-#if defined(CONFIG_CMD_UNIVERSE)
-
 #define PCI_VENDOR PCI_VENDOR_ID_TUNDRA
 #define PCI_DEVICE PCI_DEVICE_ID_TUNDRA_CA91C042
 
@@ -386,5 +384,3 @@ U_BOOT_CMD(
 	"                                      02 -> D16 Data Width\n"
 	"                                      03 -> D32 Data Width\n"
 );
-
-#endif
common/cmd_usb.c +0 -10
index 45e07f1..c6b17c2 100644
@@ -29,9 +29,6 @@
 #include <command.h>
 #include <asm/byteorder.h>
 #include <part.h>
-
-#if defined(CONFIG_CMD_USB)
-
 #include <usb.h>
 
 #ifdef CONFIG_USB_STORAGE
@@ -608,12 +605,6 @@ int do_usb (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 	return 1;
 }
 
-
-#endif
-
-
-#if defined(CONFIG_CMD_USB)
-
 #ifdef CONFIG_USB_STORAGE
 U_BOOT_CMD(
 	usb,	5,	1,	do_usb,
@@ -645,4 +636,3 @@ U_BOOT_CMD(
 	"usb  info [dev] - show available USB devices\n"
 );
 #endif
-#endif
common/cmd_vfd.c +0 -4
index 29c349d..719215e 100644
@@ -34,9 +34,6 @@
  */
 #include <common.h>
 #include <command.h>
-
-#if defined(CONFIG_CMD_VFD)
-
 #include <vfd_logo.h>
 #define VFD_TEST_LOGO_BMPNR 0
 #define VFD_REMOTE_LOGO_BMPNR 1
@@ -103,4 +100,3 @@ int trab_vfd (ulong bitmap)
 	transfer_pic(3, addr, VFD_LOGO_HEIGHT, VFD_LOGO_WIDTH);
 	return 0;
 }
-#endif	/* CONFIG_VFD */
common/docecc.c +0 -4
index 5daa6fc..3412aff 100644
@@ -31,8 +31,6 @@
 #undef ECC_DEBUG
 #undef PSYCHO_DEBUG
 
-#if defined(CONFIG_CMD_DOC)
-
 #include <linux/mtd/doc2000.h>
 
 /* need to undef it (from asm/termbits.h) */
@@ -513,5 +511,3 @@ int doc_decode_ecc(unsigned char sector[SECTOR_SIZE], unsigned char ecc1[6])
     free(Index_of);
     return nb_errors;
 }
-
-#endif
common/env_dataflash.c +0 -3
index 93fff29..17d45fd 100644
@@ -18,9 +18,6 @@
  *
  */
 #include <common.h>
-
-#if defined(CFG_ENV_IS_IN_DATAFLASH) /* Environment is in DataFlash */
-
 #include <command.h>
 #include <environment.h>
 #include <linux/stddef.h>
common/env_eeprom.c +0 -5
index 2adc129..76e9d92 100644
@@ -25,9 +25,6 @@
  */
 
 #include <common.h>
-
-#if defined(CFG_ENV_IS_IN_EEPROM) /* Environment is in EEPROM */
-
 #include <command.h>
 #include <environment.h>
 #include <linux/stddef.h>
@@ -110,5 +107,3 @@ int env_init(void)
 
 	return (0);
 }
-
-#endif /* CFG_ENV_IS_IN_EEPROM */
common/env_flash.c +0 -5
index eccfb62..4e56c89 100644
@@ -27,9 +27,6 @@
 /* #define DEBUG */
 
 #include <common.h>
-
-#if defined(CFG_ENV_IS_IN_FLASH) /* Environment is in Flash */
-
 #include <command.h>
 #include <environment.h>
 #include <linux/stddef.h>
@@ -381,5 +378,3 @@ void env_relocate_spec (void)
 	memcpy (env_ptr, (void*)flash_addr, CFG_ENV_SIZE);
 #endif /* ! ENV_IS_EMBEDDED || CFG_ENV_ADDR_REDUND */
 }
-
-#endif /* CFG_ENV_IS_IN_FLASH */
common/env_nand.c +0 -4
index 38a07f8..724e2d1 100644
@@ -30,9 +30,6 @@
 /* #define DEBUG */
 
 #include <common.h>
-
-#if defined(CFG_ENV_IS_IN_NAND) /* Environment is in Nand Flash */
-
 #include <command.h>
 #include <environment.h>
 #include <linux/stddef.h>
@@ -302,4 +299,3 @@ static void use_default()
 }
 #endif
 
-#endif /* CFG_ENV_IS_IN_NAND */
common/env_nowhere.c +0 -5
index 17ecc77..78e8f8e 100644
@@ -25,9 +25,6 @@
  */
 
 #include <common.h>
-
-#if defined(CFG_ENV_IS_NOWHERE) /* Environment is nowhere */
-
 #include <command.h>
 #include <environment.h>
 #include <linux/stddef.h>
@@ -61,5 +58,3 @@ int  env_init(void)
 
 	return (0);
 }
-
-#endif /* CFG_ENV_IS_NOWHERE) */
common/env_nvram.c +0 -4
index 7c18896..2039bac 100644
@@ -44,8 +44,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#ifdef CFG_ENV_IS_IN_NVRAM /* Environment is in NVRAM */
-
 #include <command.h>
 #include <environment.h>
 #include <linux/stddef.h>
@@ -159,5 +157,3 @@ int env_init (void)
 #endif
 	return (0);
 }
-
-#endif /* CFG_ENV_IS_IN_NVRAM */
common/fdt_support.c +0 -5
index 175d59e..040e1c6 100644
@@ -24,9 +24,6 @@
 #include <common.h>
 #include <linux/ctype.h>
 #include <linux/types.h>
-
-#ifdef CONFIG_OF_LIBFDT
-
 #include <asm/global_data.h>
 #include <fdt.h>
 #include <libfdt.h>
@@ -347,5 +344,3 @@ int fdt_bd_t(void *fdt)
 	return 0;
 }
 #endif /* ifdef CONFIG_OF_HAS_BD_T */
-
-#endif /* CONFIG_OF_LIBFDT */
common/hush.c +0 -2
index 582635c..096dd59 100644
@@ -97,7 +97,6 @@
 /*cmd_boot.c*/
 extern int do_bootd (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);      /* do_bootd */
 #endif
-#ifdef CFG_HUSH_PARSER
 #ifndef __U_BOOT__
 #include <ctype.h>     /* isalpha, isdigit */
 #include <unistd.h>    /* getpid */
@@ -3585,5 +3584,4 @@ static char * make_string(char ** inp)
 	return str;
 }
 
-#endif /* CFG_HUSH_PARSER */
 /****************************************************************************/
common/lcd.c +0 -4
index 914dc2e..2765c0a 100644
@@ -50,8 +50,6 @@
 #include <lcdvideo.h>
 #endif
 
-#ifdef CONFIG_LCD
-
 /************************************************************************/
 /* ** FONT DATA								*/
 /************************************************************************/
@@ -774,5 +772,3 @@ static void *lcd_logo (void)
 
 /************************************************************************/
 /************************************************************************/
-
-#endif /* CONFIG_LCD */
common/lynxkdi.c +0 -4
index 76a271b..1d867d8 100644
@@ -16,8 +16,6 @@
 #include <common.h>
 #include <asm/processor.h>
 #include <image.h>
-
-#if defined(CONFIG_LYNXKDI)
 #include <lynxkdi.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -66,5 +64,3 @@ void lynxkdi_boot ( image_header_t *hdr )
 #else
 #error "Lynx KDI support not implemented for configured CPU"
 #endif
-
-#endif	/* CONFIG_LYNXKDI */
common/miiphybb.c +0 -5
index 537c15d..6446012 100644
@@ -30,9 +30,6 @@
 #include <ioports.h>
 #include <ppc_asm.tmpl>
 
-#ifdef CONFIG_BITBANGMII
-
-
 /*****************************************************************************
  *
  * Utility to send the preamble, address, and register (common to read
@@ -236,5 +233,3 @@ int bb_miiphy_write (char *devname, unsigned char addr,
 
 	return 0;
 }
-
-#endif /* CONFIG_BITBANGMII */
common/miiphyutil.c +0 -4
index c69501f..dc4f6ff 100644
@@ -28,8 +28,6 @@
 
 #include <common.h>
 #include <miiphy.h>
-
-#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII)
 #include <asm/types.h>
 #include <linux/list.h>
 #include <malloc.h>
@@ -469,5 +467,3 @@ int miiphy_link (char *devname, unsigned char addr)
 	}
 }
 #endif
-
-#endif /* CONFIG_MII */
common/serial.c +0 -4
index 13e9f30..e5af3d5 100644
@@ -27,8 +27,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#if defined(CONFIG_SERIAL_MULTI)
-
 static struct serial_device *serial_devices = NULL;
 static struct serial_device *serial_current = NULL;
 
@@ -227,5 +225,3 @@ void serial_puts (const char *s)
 
 	serial_current->puts (s);
 }
-
-#endif /* CONFIG_SERIAL_MULTI */
common/soft_i2c.c +0 -5
index c5d7e20..6bfc010 100644
@@ -41,8 +41,6 @@
 #endif
 #include <i2c.h>
 
-#if defined(CONFIG_SOFT_I2C)
-
 /* #define	DEBUG_I2C	*/
 
 #ifdef DEBUG_I2C
@@ -422,6 +420,3 @@ void i2c_reg_write(uchar i2c_addr, uchar reg, uchar val)
 {
 	i2c_write(i2c_addr, reg, 1, &val, 1);
 }
-
-
-#endif	/* CONFIG_SOFT_I2C */
common/soft_spi.c +0 -4
index e425061..5a1f1b2 100644
@@ -27,8 +27,6 @@
 #include <common.h>
 #include <spi.h>
 
-#if defined(CONFIG_SOFT_SPI)
-
 /*-----------------------------------------------------------------------
  * Definitions
  */
@@ -131,5 +129,3 @@ int  spi_xfer(spi_chipsel_type chipsel, int bitlen, uchar *dout, uchar *din)
 
 	return(0);
 }
-
-#endif	/* CONFIG_SOFT_SPI */
common/usb.c +0 -7
index 933afa9..bd067ef 100644
@@ -48,9 +48,6 @@
 #include <command.h>
 #include <asm/processor.h>
 #include <linux/ctype.h>
-
-#if defined(CONFIG_CMD_USB)
-
 #include <usb.h>
 #ifdef CONFIG_4xx
 #include <405gp_pci.h>
@@ -1246,7 +1243,3 @@ int usb_hub_probe(struct usb_device *dev, int ifnum)
 	ret=usb_hub_configure(dev);
 	return ret;
 }
-
-#endif
-
-/* EOF */
common/usb_kbd.c +0 -5
index aec558a..ae01534 100644
@@ -26,9 +26,6 @@
  */
 #include <common.h>
 #include <devices.h>
-
-#ifdef CONFIG_USB_KEYBOARD
-
 #include <usb.h>
 
 #undef USB_KBD_DEBUG
@@ -728,5 +725,3 @@ static int usb_kbd_get_hid_desc(struct usb_device *dev)
 
 
 #endif
-
-#endif /* CONFIG_USB_KEYBOARD */
common/usb_storage.c +0 -8
index 0f79f36..3c06efe 100644
@@ -53,14 +53,9 @@
 #include <common.h>
 #include <command.h>
 #include <asm/processor.h>
-
-
-#if defined(CONFIG_CMD_USB)
 #include <part.h>
 #include <usb.h>
 
-#ifdef CONFIG_USB_STORAGE
-
 #undef USB_STOR_DEBUG
 #undef BBB_COMDAT_TRACE
 #undef BBB_XPORT_TRACE
@@ -1247,6 +1242,3 @@ int usb_stor_get_info(struct usb_device *dev,struct us_data *ss,block_dev_desc_t
 	USB_STOR_PRINTF("partype: %d\n",dev_desc->part_type);
 	return 1;
 }
-
-#endif /* CONFIG_USB_STORAGE */
-#endif
config.mk +1 -0
index 582df32..4b2ac8b 100644
@@ -90,6 +90,7 @@ endif
 ifdef	BOARD
 sinclude $(TOPDIR)/board/$(BOARDDIR)/config.mk	# include board specific rules
 endif
+sinclude $(TOPDIR)/include/config.mk	# include generated board config
 
 #########################################################################
 
include/configs/pf5200.h +1 -1
index 18d0c87..470b607 100644
@@ -203,7 +203,7 @@
  * Environment settings
  */
 #if 1				/* test-only */
-#define CFG_ENV_IS_IN_FLASH	0
+#define CFG_ENV_IS_IN_FLASH	1
 #define CFG_ENV_SIZE		0x10000
 #define CFG_ENV_SECT_SIZE	0x10000
 #define CONFIG_ENV_OVERWRITE	1
#7 lore raw

cover Make board config available to build system

In reply to Grant Likely
Quoted 13 lines · On Wed, 05 Sep 2007 08:00:10 -0600 Grant Likely <[email protected]>…

This series extracts the u-boot configuration from the config header files and makes it usable by the build system. The obvious application for this is to allow conditional compiliation of files without wrapping every file with a large #if defined() block (which results in shorter build times).

This is another step towards using a kconfig style build system. This step just enables make and gcc to have the same configuration data. Next step I think is to allow boards to supply a Kconfig style config file instead of a header file (and in this case, do the opposite of this patch; generate the header file based on the .config file). Until all boards are ported over, both methods can be supported based on what kind of config file (either .h or .config) is present.

Quoted 3 lines

Word of warning: I've most certainly broken stuff in this version. If there is suppport for this direction, then I'll make sure I get it sorted out for real.

total ack. and to the gitignore patch, of course.

Kim