* move post_code() to a seperate file
* statically link linuxbios.initram for now (depends on printk, post_code
  and die)
* greatly simplify all makefiles by creating a global Rules.make
* use $(dir $@) in Makefiles instead of absolute paths for mkdir.. 
* clean up Makefiles by calling components' code locally instead of in the
  Makefile. (Remember: one day, no code per mainboard)
* unconditionally create .xcompile in case it changed
* add NM to xcompile
* create $(obj)/linuxbios.map with all symbols of all stages

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>

Index: southbridge/amd/cs5536/Makefile
===================================================================
--- southbridge/amd/cs5536/Makefile	(revision 462)
+++ southbridge/amd/cs5536/Makefile	(working copy)
@@ -23,10 +23,6 @@
 
 STAGE2_CHIPSET_OBJ += $(obj)/southbridge/amd/cs5536/cs5536.o
 
-$(obj)/southbridge/amd/cs5536/%.o: $(src)/southbridge/amd/cs5536/%.c \
-				   $(obj)/statictree.h
-	$(Q)mkdir -p $(obj)/southbridge/amd/cs5536/
-	$(Q)printf "  CC      $(subst $(shell pwd)/,,$(@))\n"
-	$(Q)$(CC) $(INITCFLAGS) -c $< -o $@
+STAGE0_CHIPSET_OBJ += $(obj)/southbridge/amd/cs5536/stage1.o
 
 endif
Index: southbridge/intel/i82371eb/Makefile
===================================================================
--- southbridge/intel/i82371eb/Makefile	(revision 462)
+++ southbridge/intel/i82371eb/Makefile	(working copy)
@@ -22,10 +22,4 @@
 
 STAGE2_CHIPSET_OBJ += $(obj)/southbridge/intel/i82371eb/i82371eb.o
 
-$(obj)/southbridge/intel/i82371eb/%.o: $(src)/southbridge/intel/i82371eb/%.c \
-				       $(obj)/statictree.h
-	$(Q)mkdir -p $(obj)/southbridge/intel/i82371eb/
-	$(Q)printf "  CC      $(subst $(shell pwd)/,,$(@))\n"
-	$(Q)$(CC) $(INITCFLAGS) -c $< -o $@
-
 endif
Index: include/post_code.h
===================================================================
--- include/post_code.h	(revision 462)
+++ include/post_code.h	(working copy)
@@ -18,5 +18,7 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
+void post_code(u8 value);
+
 #define POST_START_OF_MAIN                              0x01
 
Index: superio/winbond/w83627hf/Makefile
===================================================================
--- superio/winbond/w83627hf/Makefile	(revision 462)
+++ superio/winbond/w83627hf/Makefile	(working copy)
@@ -21,12 +21,10 @@
 
 ifeq ($(CONFIG_SUPERIO_WINBOND_W83627HF),y)
 
+STAGE0_CHIPSET_OBJ += $(obj)/superio/winbond/w83627hf/stage1.o
+STAGE0_CHIPSET_OBJ += $(obj)/device/pnp_raw.o
+
 # Always add to variables, as there could be more than one Super I/O.
 STAGE2_CHIPSET_OBJ += $(obj)/superio/winbond/w83627hf/superio.o
 
-$(obj)/superio/winbond/w83627hf/%.o: $(src)/superio/winbond/w83627hf/%.c $(obj)/statictree.h
-	$(Q)mkdir -p $(obj)/superio/winbond/w83627hf/
-	$(Q)printf "  CC      $(subst $(shell pwd)/,,$(@))\n"
-	$(Q)$(CC) $(INITCFLAGS) -c $< -o $@
-
 endif
Index: mainboard/adl/msm800sev/Makefile
===================================================================
--- mainboard/adl/msm800sev/Makefile	(revision 462)
+++ mainboard/adl/msm800sev/Makefile	(working copy)
@@ -19,12 +19,10 @@
 ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 ##
 
-STAGE0_MAINBOARD_OBJ := $(obj)/superio/winbond/w83627hf/stage1.o \
-		$(obj)/device/pnp_raw.o \
-		$(obj)/southbridge/amd/cs5536/stage1.o\
-		$(obj)/arch/x86/geodelx/stage1.o \
-		$(obj)/mainboard/$(MAINBOARDDIR)/stage1.o
+STAGE0_MAINBOARD_OBJ := $(obj)/mainboard/$(MAINBOARDDIR)/stage1.o
 
+STAGE2_MAINBOARD_OBJ =
+
 $(obj)/linuxbios.vpd:
 	$(Q)printf "  BUILD   DUMMY VPD\n"
 	$(Q)dd if=/dev/zero of=$(obj)/linuxbios.vpd bs=256 count=1 $(SILENT)
@@ -34,48 +32,21 @@
 		$(obj)/southbridge/amd/cs5536/smbus_initram.o \
 		$(obj)/arch/x86/geodelx/geodelx.o
 
+# These are possibly not permanent
+INITRAM_OBJ := $(INITRAM_OBJ) $(obj)/lib/console.o
+INITRAM_OBJ := $(INITRAM_OBJ) $(obj)/lib/vtxprintf.o
+INITRAM_OBJ := $(INITRAM_OBJ) $(obj)/lib/uart8250.o
+INITRAM_OBJ := $(INITRAM_OBJ) $(obj)/arch/x86/post_code.o
+
+
 $(obj)/linuxbios.initram: $(obj)/stage0.init $(obj)/stage0.o $(INITRAM_OBJ) 
 	$(Q)# initram links against stage0
 	$(Q)printf "  LD      $(subst $(shell pwd)/,,$(@))\n"
-	$(Q)$(LD) -R $(obj)/stage0.o -Ttext 0x80000 $(INITRAM_OBJ) \
+	$(Q)$(LD) -Ttext 0x80000 $(INITRAM_OBJ) \
 		--entry=main -o $(obj)/linuxbios.initram.o
 	$(Q)printf "  OBJCOPY $(subst $(shell pwd)/,,$(@))\n"
 	$(Q)$(OBJCOPY) -O binary $(obj)/linuxbios.initram.o \
 		$(obj)/linuxbios.initram
+	$(Q)printf "  NM      $(subst $(shell pwd)/,,$(@))\n"
+	$(Q)$(NM) $(obj)/linuxbios.initram.o | sort -u > $(obj)/linuxbios.initram.map
 
-#
-# Miscellaneous important targets.
-#
-
-$(obj)/mainboard/$(MAINBOARDDIR)/statictree.o: $(obj)/mainboard/$(MAINBOARDDIR)/statictree.c $(obj)/statictree.h
-	$(Q)printf "  CC      $(subst $(shell pwd)/,,$(@))\n"
-	$(Q)$(CC) $(INITCFLAGS) $(LINUXBIOSINCLUDE) -c -o $@ $<
-
-$(obj)/mainboard/$(MAINBOARDDIR)/statictree.c: $(src)/mainboard/$(MAINBOARDDIR)/dts $(obj)/util/dtc/dtc
-	$(Q)printf "  DTC     $(subst $(shell pwd)/,,$(@))\n"
-	$(Q)$(obj)/util/dtc/dtc -O lb mainboard/$(MAINBOARDDIR)/dts > $@
-
-$(obj)/statictree.h: $(src)/mainboard/$(MAINBOARDDIR)/dts $(obj)/util/dtc/dtc
-	$(Q)printf "  DTC     $(subst $(shell pwd)/,,$(@))\n"
-	$(Q)$(obj)/util/dtc/dtc -O lbh mainboard/$(MAINBOARDDIR)/dts > $@
-
-$(obj)/mainboard/$(MAINBOARDDIR)/option_table.c: $(obj)/util/options/build_opt_tbl $(src)/mainboard/$(MAINBOARDDIR)/cmos.layout
-	$(Q)printf "  OPTIONS $(subst $(shell pwd)/,,$(@))\n"
-	$(Q)mkdir -p $(obj)/mainboard/$(MAINBOARDDIR)
-	$(Q)$(obj)/util/options/build_opt_tbl -b \
-		--config $(src)/mainboard/$(MAINBOARDDIR)/cmos.layout \
-		--option $(obj)/mainboard/$(MAINBOARDDIR)/option_table.c 
-
-$(obj)/option_table: $(obj)/mainboard/$(MAINBOARDDIR)/option_table.o
-	$(Q)printf "  OBJCOPY $(subst $(shell pwd)/,,$(@))\n"
-	$(Q)$(OBJCOPY) -O binary $< $@ 
-
-STAGE2_MAINBOARD_OBJ =
-
-STAGE2_CHIPSET_OBJ =  		$(obj)/arch/x86/geodelx/cpu.o
-
-$(obj)/mainboard/$(MAINBOARDDIR)/%.o: $(src)/mainboard/$(MAINBOARDDIR)/%.c
-	$(Q)mkdir -p $(obj)/mainboard/$(MAINBOARDDIR)
-	$(Q)printf "  CC      $(subst $(shell pwd)/,,$(@))\n"
-	$(Q)$(CC) $(INITCFLAGS) -c $< -o $@
-
Index: mainboard/amd/norwich/Makefile
===================================================================
--- mainboard/amd/norwich/Makefile	(revision 462)
+++ mainboard/amd/norwich/Makefile	(working copy)
@@ -18,62 +18,34 @@
 ## along with this program; if not, write to the Free Software
 ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 ##
-STAGE0_MAINBOARD_OBJ :=\
-		$(obj)/southbridge/amd/cs5536/stage1.o\
-		$(obj)/arch/x86/geodelx/stage1.o \
-		$(obj)/mainboard/$(MAINBOARDDIR)/stage1.o
 
-$(obj)/linuxbios.vpd:
-	$(Q)printf "  BUILD   DUMMY VPD\n"
-	$(Q)dd if=/dev/zero of=$(obj)/linuxbios.vpd bs=256 count=1 $(SILENT)
+STAGE0_MAINBOARD_OBJ := $(obj)/mainboard/$(MAINBOARDDIR)/stage1.o
 
 INITRAM_OBJ =   $(obj)/mainboard/$(MAINBOARDDIR)/initram.o \
 		$(obj)/northbridge/amd/geodelx/raminit.o \
 		$(obj)/southbridge/amd/cs5536/smbus_initram.o \
 		$(obj)/arch/x86/geodelx/geodelx.o
 
-$(obj)/linuxbios.initram: $(obj)/stage0.init $(obj)/stage0.o $(INITRAM_OBJ)
+STAGE2_MAINBOARD_OBJ = 
+
+# These are possibly not permanent
+INITRAM_OBJ := $(INITRAM_OBJ) $(obj)/lib/console.o
+INITRAM_OBJ := $(INITRAM_OBJ) $(obj)/lib/vtxprintf.o
+INITRAM_OBJ := $(INITRAM_OBJ) $(obj)/lib/uart8250.o
+INITRAM_OBJ := $(INITRAM_OBJ) $(obj)/arch/x86/post_code.o
+
+$(obj)/linuxbios.vpd:
+	$(Q)printf "  BUILD   DUMMY VPD\n"
+	$(Q)dd if=/dev/zero of=$(obj)/linuxbios.vpd bs=256 count=1 $(SILENT)
+
+$(obj)/linuxbios.initram $(obj)/linuxbios.initram.map: $(obj)/stage0.init $(obj)/stage0.o $(INITRAM_OBJ)
 	$(Q)# initram links against stage0
 	$(Q)printf "  LD      $(subst $(shell pwd)/,,$(@))\n"
-	$(Q)$(LD) -R $(obj)/stage0.o -Ttext 0x80000 $(INITRAM_OBJ) \
+	$(Q)$(LD) -Ttext 0x80000 $(INITRAM_OBJ) \
 		--entry=main -o $(obj)/linuxbios.initram.o
 	$(Q)printf "  OBJCOPY $(subst $(shell pwd)/,,$(@))\n"
 	$(Q)$(OBJCOPY) -O binary $(obj)/linuxbios.initram.o \
 		$(obj)/linuxbios.initram
+	$(Q)printf "  NM      $(subst $(shell pwd)/,,$(@))\n"
+	$(Q)$(NM) $(obj)/linuxbios.initram.o | sort -u > $(obj)/linuxbios.initram.map
 
-#
-# Miscellaneous important targets.
-#
-
-$(obj)/mainboard/$(MAINBOARDDIR)/statictree.o: $(obj)/mainboard/$(MAINBOARDDIR)/statictree.c $(obj)/statictree.h
-	$(Q)printf "  CC      $(subst $(shell pwd)/,,$(@))\n"
-	$(Q)$(CC) $(INITCFLAGS) $(LINUXBIOSINCLUDE) -c -o $@ $<
-
-$(obj)/mainboard/$(MAINBOARDDIR)/statictree.c: $(src)/mainboard/$(MAINBOARDDIR)/dts $(obj)/util/dtc/dtc
-	$(Q)printf "  DTC     $(subst $(shell pwd)/,,$(@))\n"
-	$(Q)$(obj)/util/dtc/dtc -O lb mainboard/$(MAINBOARDDIR)/dts > $@
-
-$(obj)/statictree.h: $(src)/mainboard/$(MAINBOARDDIR)/dts $(obj)/util/dtc/dtc
-	$(Q)printf "  DTC     $(subst $(shell pwd)/,,$(@))\n"
-	$(Q)$(obj)/util/dtc/dtc -O lbh mainboard/$(MAINBOARDDIR)/dts > $@
-
-$(obj)/mainboard/$(MAINBOARDDIR)/option_table.c: $(obj)/util/options/build_opt_tbl $(src)/mainboard/$(MAINBOARDDIR)/cmos.layout
-	$(Q)printf "  OPTIONS $(subst $(shell pwd)/,,$(@))\n"
-	$(Q)mkdir -p $(obj)/mainboard/$(MAINBOARDDIR)
-	$(Q)$(obj)/util/options/build_opt_tbl -b \
-		--config $(src)/mainboard/$(MAINBOARDDIR)/cmos.layout \
-		--option $(obj)/mainboard/$(MAINBOARDDIR)/option_table.c 
-
-$(obj)/option_table: $(obj)/mainboard/$(MAINBOARDDIR)/option_table.o
-	$(Q)printf "  OBJCOPY $(subst $(shell pwd)/,,$(@))\n"
-	$(Q)$(OBJCOPY) -O binary $< $@ 
-
-STAGE2_MAINBOARD_OBJ = 
-
-STAGE2_CHIPSET_OBJ =  		$(obj)/arch/x86/geodelx/cpu.o
-
-$(obj)/mainboard/$(MAINBOARDDIR)/%.o: $(src)/mainboard/$(MAINBOARDDIR)/%.c
-	$(Q)mkdir -p $(obj)/mainboard/$(MAINBOARDDIR)
-	$(Q)printf "  CC      $(subst $(shell pwd)/,,$(@))\n"
-	$(Q)$(CC) $(INITCFLAGS) -c $< -o $@
-
Index: mainboard/artecgroup/dbe61/Makefile
===================================================================
--- mainboard/artecgroup/dbe61/Makefile	(revision 462)
+++ mainboard/artecgroup/dbe61/Makefile	(working copy)
@@ -18,11 +18,11 @@
 ## along with this program; if not, write to the Free Software
 ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 ##
-STAGE0_MAINBOARD_OBJ := \
-		$(obj)/southbridge/amd/cs5536/stage1.o\
-		$(obj)/arch/x86/geodelx/stage1.o \
-		$(obj)/mainboard/$(MAINBOARDDIR)/stage1.o
 
+STAGE0_MAINBOARD_OBJ := $(obj)/mainboard/$(MAINBOARDDIR)/stage1.o
+
+STAGE2_MAINBOARD_OBJ = 
+
 $(obj)/linuxbios.vpd:
 	$(Q)printf "  BUILD   DUMMY VPD\n"
 	$(Q)dd if=/dev/zero of=$(obj)/linuxbios.vpd bs=256 count=1 $(SILENT)
@@ -30,48 +30,20 @@
 INITRAM_OBJ =   $(obj)/mainboard/$(MAINBOARDDIR)/initram.o \
 		$(obj)/arch/x86/geodelx/geodelx.o
 
+# These are possibly not permanent
+INITRAM_OBJ := $(INITRAM_OBJ) $(obj)/lib/console.o
+INITRAM_OBJ := $(INITRAM_OBJ) $(obj)/lib/vtxprintf.o
+INITRAM_OBJ := $(INITRAM_OBJ) $(obj)/lib/uart8250.o
+INITRAM_OBJ := $(INITRAM_OBJ) $(obj)/arch/x86/post_code.o
+
 $(obj)/linuxbios.initram: $(obj)/stage0.init $(obj)/stage0.o $(INITRAM_OBJ)
 	$(Q)# initram links against stage0
 	$(Q)printf "  LD      $(subst $(shell pwd)/,,$(@))\n"
-	$(Q)$(LD) -R $(obj)/stage0.o -Ttext 0x80000 $(INITRAM_OBJ) \
+	$(Q)$(LD) -Ttext 0x80000 $(INITRAM_OBJ) \
 		--entry=main -o $(obj)/linuxbios.initram.o
 	$(Q)printf "  OBJCOPY $(subst $(shell pwd)/,,$(@))\n"
 	$(Q)$(OBJCOPY) -O binary $(obj)/linuxbios.initram.o \
 		$(obj)/linuxbios.initram
+	$(Q)printf "  NM      $(subst $(shell pwd)/,,$(@))\n"
+	$(Q)$(NM) $(obj)/linuxbios.initram.o | sort -u > $(obj)/linuxbios.initram.map
 
-#
-# Miscellaneous important targets.
-#
-
-$(obj)/mainboard/$(MAINBOARDDIR)/statictree.o: $(obj)/mainboard/$(MAINBOARDDIR)/statictree.c $(obj)/statictree.h
-	$(Q)printf "  CC      $(subst $(shell pwd)/,,$(@))\n"
-	$(Q)$(CC) $(INITCFLAGS) $(LINUXBIOSINCLUDE) -c -o $@ $<
-
-$(obj)/mainboard/$(MAINBOARDDIR)/statictree.c: $(src)/mainboard/$(MAINBOARDDIR)/dts $(obj)/util/dtc/dtc
-	$(Q)printf "  DTC     $(subst $(shell pwd)/,,$(@))\n"
-	$(Q)$(obj)/util/dtc/dtc -O lb mainboard/$(MAINBOARDDIR)/dts > $@
-
-$(obj)/statictree.h: $(src)/mainboard/$(MAINBOARDDIR)/dts $(obj)/util/dtc/dtc
-	$(Q)printf "  DTC     $(subst $(shell pwd)/,,$(@))\n"
-	$(Q)$(obj)/util/dtc/dtc -O lbh mainboard/$(MAINBOARDDIR)/dts > $@
-
-$(obj)/mainboard/$(MAINBOARDDIR)/option_table.c: $(obj)/util/options/build_opt_tbl $(src)/mainboard/$(MAINBOARDDIR)/cmos.layout
-	$(Q)printf "  OPTIONS $(subst $(shell pwd)/,,$(@))\n"
-	$(Q)mkdir -p $(obj)/mainboard/$(MAINBOARDDIR)
-	$(Q)$(obj)/util/options/build_opt_tbl -b \
-		--config $(src)/mainboard/$(MAINBOARDDIR)/cmos.layout \
-		--option $(obj)/mainboard/$(MAINBOARDDIR)/option_table.c 
-
-$(obj)/option_table: $(obj)/mainboard/$(MAINBOARDDIR)/option_table.o
-	$(Q)printf "  OBJCOPY $(subst $(shell pwd)/,,$(@))\n"
-	$(Q)$(OBJCOPY) -O binary $< $@ 
-
-STAGE2_MAINBOARD_OBJ = 
-
-STAGE2_CHIPSET_OBJ =  		$(obj)/arch/x86/geodelx/cpu.o
-
-$(obj)/mainboard/$(MAINBOARDDIR)/%.o: $(src)/mainboard/$(MAINBOARDDIR)/%.c
-	$(Q)mkdir -p $(obj)/mainboard/$(MAINBOARDDIR)
-	$(Q)printf "  CC      $(subst $(shell pwd)/,,$(@))\n"
-	$(Q)$(CC) $(INITCFLAGS) -c $< -o $@
-
Index: mainboard/emulation/qemu-x86/Makefile
===================================================================
--- mainboard/emulation/qemu-x86/Makefile	(revision 462)
+++ mainboard/emulation/qemu-x86/Makefile	(working copy)
@@ -21,6 +21,8 @@
 
 STAGE0_MAINBOARD_OBJ := $(obj)/mainboard/$(MAINBOARDDIR)/stage1.o
 
+STAGE2_MAINBOARD_OBJ = vga.o
+
 #
 # VPD or SIP ROM or... how does NVIDIA call it?
 # Some space to cope with dirty southbridge tricks.
@@ -39,49 +41,19 @@
 #
 
 INITRAM_OBJ = $(obj)/mainboard/$(MAINBOARDDIR)/initram.o
+INITRAM_OBJ := $(INITRAM_OBJ) $(obj)/lib/console.o
+INITRAM_OBJ := $(INITRAM_OBJ) $(obj)/lib/vtxprintf.o
+INITRAM_OBJ := $(INITRAM_OBJ) $(obj)/lib/uart8250.o
+INITRAM_OBJ := $(INITRAM_OBJ) $(obj)/arch/x86/post_code.o
 
 $(obj)/linuxbios.initram: $(obj)/stage0.init $(obj)/stage0.o $(INITRAM_OBJ)
 	$(Q)# initram links against stage0
 	$(Q)printf "  LD      $(subst $(shell pwd)/,,$(@))\n"
-	$(Q)$(LD) -R $(obj)/stage0.o -Ttext 0x80000 $(INITRAM_OBJ) \
+	$(Q)$(LD)  -Ttext 0x80000 $(INITRAM_OBJ) \
 		--entry=main -o $(obj)/linuxbios.initram.o
 	$(Q)printf "  OBJCOPY $(subst $(shell pwd)/,,$(@))\n"
 	$(Q)$(OBJCOPY) -O binary $(obj)/linuxbios.initram.o \
 		$(obj)/linuxbios.initram
+	$(Q)printf "  NM      $(subst $(shell pwd)/,,$(@))\n"
+	$(Q)$(NM) $(obj)/linuxbios.initram.o | sort -u > $(obj)/linuxbios.initram.map
 
-#
-# Miscellaneous important targets.
-#
-
-$(obj)/mainboard/$(MAINBOARDDIR)/statictree.o: $(obj)/mainboard/$(MAINBOARDDIR)/statictree.c $(obj)/statictree.h
-	$(Q)printf "  CC      $(subst $(shell pwd)/,,$(@))\n"
-	$(Q)$(CC) $(INITCFLAGS) $(LINUXBIOSINCLUDE) -c -o $@ $<
-
-$(obj)/statictree.h: $(src)/mainboard/$(MAINBOARDDIR)/dts $(obj)/util/dtc/dtc
-	$(Q)printf "  DTC     $(subst $(shell pwd)/,,$(@))\n"
-	$(Q)$(obj)/util/dtc/dtc -O lbh mainboard/$(MAINBOARDDIR)/dts > $@
-
-$(obj)/mainboard/$(MAINBOARDDIR)/statictree.c: $(src)/mainboard/$(MAINBOARDDIR)/dts $(obj)/util/dtc/dtc $(obj)/statictree.h
-	$(Q)printf "  DTC     $(subst $(shell pwd)/,,$(@))\n"
-	$(Q)$(obj)/util/dtc/dtc -O lb mainboard/$(MAINBOARDDIR)/dts > $@
-
-$(obj)/mainboard/$(MAINBOARDDIR)/option_table.c: $(obj)/util/options/build_opt_tbl $(src)/mainboard/$(MAINBOARDDIR)/cmos.layout
-	$(Q)printf "  OPTIONS $(subst $(shell pwd)/,,$(@))\n"
-	$(Q)mkdir -p $(obj)/mainboard/$(MAINBOARDDIR)
-	$(Q)$(obj)/util/options/build_opt_tbl -b \
-		--config $(src)/mainboard/$(MAINBOARDDIR)/cmos.layout \
-		--option $(obj)/mainboard/$(MAINBOARDDIR)/option_table.c
-
-$(obj)/option_table: $(obj)/mainboard/$(MAINBOARDDIR)/option_table.o
-	$(Q)printf "  OBJCOPY $(subst $(shell pwd)/,,$(@))\n"
-	$(Q)$(OBJCOPY) -O binary $< $@
-
-STAGE2_MAINBOARD_OBJ = vga.o
-
-STAGE2_CHIPSET_OBJ =
-
-$(obj)/mainboard/$(MAINBOARDDIR)/%.o: $(src)/mainboard/$(MAINBOARDDIR)/%.c
-	$(Q)mkdir -p $(obj)/mainboard/$(MAINBOARDDIR)
-	$(Q)printf "  CC      $(subst $(shell pwd)/,,$(@))\n"
-	$(Q)$(CC) $(INITCFLAGS) -c $< -o $@
-
Index: device/Makefile
===================================================================
--- device/Makefile	(revision 462)
+++ device/Makefile	(working copy)
@@ -20,7 +20,7 @@
 ##
 
 $(obj)/device/%.o: $(src)/device/%.c
-	$(Q)mkdir -p $(obj)/device
+	$(Q)mkdir -p $(dir $@)
 	$(Q)printf "  CC      $(subst $(shell pwd)/,,$(@))\n"
 	$(Q)$(CC) $(INITCFLAGS) -c $< -o $@
 
Index: lib/Makefile
===================================================================
--- lib/Makefile	(revision 462)
+++ lib/Makefile	(working copy)
@@ -45,7 +45,7 @@
 endif
 
 $(obj)/lib/%.o: $(src)/lib/%.c
-	$(Q)mkdir -p $(obj)/lib
+	$(Q)mkdir -p $(dir $@)
 	$(Q)printf "  CC      $(subst $(shell pwd)/,,$(@))\n"
 	$(Q)$(CC) $(INITCFLAGS) -c $< -o $@
 
Index: Rules.make
===================================================================
--- Rules.make	(revision 0)
+++ Rules.make	(revision 0)
@@ -0,0 +1,80 @@
+##
+## This file is part of the LinuxBIOS project.
+##
+## Copyright (C) 2006-2007 coresystems GmbH
+## (Written by Stefan Reinauer <stepan@coresystems.de> for coresystems GmbH)
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+##
+
+#
+# Miscellaneous mainboard specific build targets!
+#
+
+$(obj)/mainboard/$(MAINBOARDDIR)/statictree.o: $(obj)/mainboard/$(MAINBOARDDIR)/statictree.c $(obj)/statictree.h
+	$(Q)printf "  CC      $(subst $(shell pwd)/,,$(@))\n"
+	$(Q)$(CC) $(INITCFLAGS) $(LINUXBIOSINCLUDE) -c -o $@ $<
+
+$(obj)/mainboard/$(MAINBOARDDIR)/statictree.c: $(src)/mainboard/$(MAINBOARDDIR)/dts $(obj)/util/dtc/dtc
+	$(Q)printf "  DTC     $(subst $(shell pwd)/,,$(@))\n"
+	$(Q)$(obj)/util/dtc/dtc -O lb mainboard/$(MAINBOARDDIR)/dts > $@
+
+$(obj)/statictree.h: $(src)/mainboard/$(MAINBOARDDIR)/dts $(obj)/util/dtc/dtc
+	$(Q)printf "  DTC     $(subst $(shell pwd)/,,$(@))\n"
+	$(Q)$(obj)/util/dtc/dtc -O lbh mainboard/$(MAINBOARDDIR)/dts > $@
+
+$(obj)/mainboard/$(MAINBOARDDIR)/option_table.c: $(obj)/util/options/build_opt_tbl $(src)/mainboard/$(MAINBOARDDIR)/cmos.layout
+	$(Q)printf "  OPTIONS $(subst $(shell pwd)/,,$(@))\n"
+	$(Q)mkdir -p $(obj)/mainboard/$(MAINBOARDDIR)
+	$(Q)$(obj)/util/options/build_opt_tbl -b \
+		--config $(src)/mainboard/$(MAINBOARDDIR)/cmos.layout \
+		--option $(obj)/mainboard/$(MAINBOARDDIR)/option_table.c 
+
+$(obj)/option_table: $(obj)/mainboard/$(MAINBOARDDIR)/option_table.o
+	$(Q)printf "  OBJCOPY $(subst $(shell pwd)/,,$(@))\n"
+	$(Q)$(OBJCOPY) -O binary $< $@ 
+
+$(obj)/mainboard/$(MAINBOARDDIR)/%.o: $(src)/mainboard/$(MAINBOARDDIR)/%.c
+	$(Q)mkdir -p $(obj)/mainboard/$(MAINBOARDDIR)
+	$(Q)printf "  CC      $(subst $(shell pwd)/,,$(@))\n"
+	$(Q)$(CC) $(INITCFLAGS) -c $< -o $@
+
+#
+# Miscellaneous superio specific build targets!
+#
+
+$(obj)/superio/%.o: $(src)/superio/%.c $(obj)/statictree.h
+	$(Q)mkdir -p $(dir $@)
+	$(Q)printf "  CC      $(subst $(shell pwd)/,,$(@))\n"
+	$(Q)$(CC) $(INITCFLAGS) -c $< -o $@
+
+#
+# Miscellaneous northbridge specific build targets!
+#
+
+$(obj)/northbridge/%.o: $(src)/northbridge/%.c $(obj)/statictree.h
+	$(Q)mkdir -p $(dir $@)
+	$(Q)printf "  CC      $(subst $(shell pwd)/,,$(@))\n"
+	$(Q)$(CC) $(INITCFLAGS) -c $< -o $@
+
+#
+# Miscellaneous southbridge specific build targets!
+#
+
+$(obj)/southbridge/%.o: $(src)/southbridge/%.c $(obj)/statictree.h
+	$(Q)mkdir -p $(dir $@)
+	$(Q)printf "  CC      $(subst $(shell pwd)/,,$(@))\n"
+	$(Q)$(CC) $(INITCFLAGS) -c $< -o $@
+
Index: northbridge/amd/geodelx/Makefile
===================================================================
--- northbridge/amd/geodelx/Makefile	(revision 462)
+++ northbridge/amd/geodelx/Makefile	(working copy)
@@ -24,10 +24,4 @@
 STAGE2_CHIPSET_OBJ += $(obj)/northbridge/amd/geodelx/geodelx.o \
 		      $(obj)/northbridge/amd/geodelx/geodelxinit.o
 
-$(obj)/northbridge/amd/geodelx/%.o: $(src)/northbridge/amd/geodelx/%.c \
-				    $(obj)/statictree.h
-	$(Q)mkdir -p $(obj)/northbridge/amd/geodelx
-	$(Q)printf "  CC      $(subst $(shell pwd)/,,$(@))\n"
-	$(Q)$(CC) $(INITCFLAGS) -c $< -o $@
-
 endif
Index: northbridge/intel/i440bxemulation/Makefile
===================================================================
--- northbridge/intel/i440bxemulation/Makefile	(revision 462)
+++ northbridge/intel/i440bxemulation/Makefile	(working copy)
@@ -23,9 +23,4 @@
 
 STAGE2_CHIPSET_OBJ += $(obj)/northbridge/intel/i440bxemulation/i440bx.o
 
-$(obj)/northbridge/intel/i440bxemulation/%.o: $(src)/northbridge/intel/i440bxemulation/%.c $(obj)/statictree.h
-	$(Q)mkdir -p $(obj)/northbridge/intel/i440bxemulation
-	$(Q)printf "  CC      $(subst $(shell pwd)/,,$(@))\n"
-	$(Q)$(CC) $(INITCFLAGS) -c $< -o $@
-
 endif
Index: Makefile
===================================================================
--- Makefile	(revision 462)
+++ Makefile	(working copy)
@@ -26,7 +26,6 @@
 SUBLEVEL = 0
 
 have_dotconfig := $(wildcard .config)
-have_dotxcompile := $(wildcard .xcompile)
 
 src := $(shell pwd)
 obj := $(shell pwd)/build
@@ -60,6 +59,9 @@
 KERNELVERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)
 export KERNELVERSION
 
+	include $(shell $(src)/util/xcompile/xcompile > $(src)/.xcompile || \
+		{ echo "complete\\ toolchain" && rm -f $(src)/.xcompile && exit 1; }; echo $(src)/.xcompile)
+
 ifeq ($(strip $(have_dotconfig)),)
 
 all:
@@ -85,16 +87,17 @@
 			-include $(obj)/config.h \
 			-include $(obj)/build.h
 
-ifneq ($(strip $(have_dotxcompile)),)
-	include $(src)/.xcompile
-else
-	include $(shell $(src)/util/xcompile/xcompile > $(src)/.xcompile || \
-		{ echo "complete\\ toolchain" && rm -f $(src)/.xcompile && exit 1; }; echo $(src)/.xcompile)
-endif
+#ifneq ($(strip $(have_dotxcompile)),)
+#	include $(src)/.xcompile
+#else
+#	include $(shell $(src)/util/xcompile/xcompile > $(src)/.xcompile || \
+#		{ echo "complete\\ toolchain" && rm -f $(src)/.xcompile && exit 1; }; echo $(src)/.xcompile)
+#endif
 
 CC := $(CC_$(ARCH))
 AS := $(AS_$(ARCH))
 LD := $(LD_$(ARCH))
+NM := $(NM_$(ARCH))
 OBJCOPY := $(OBJCOPY_$(ARCH))
 AR := $(AR_$(ARCH))
 
@@ -111,6 +114,7 @@
 include lib/Makefile
 include device/Makefile
 include mainboard/$(MAINBOARDDIR)/Makefile
+include Rules.make
 include northbridge/*/*/Makefile
 include southbridge/*/*/Makefile
 include superio/*/*/Makefile
Index: util/kconfig/Makefile
===================================================================
--- util/kconfig/Makefile	(revision 462)
+++ util/kconfig/Makefile	(working copy)
@@ -119,57 +119,57 @@
 
 
 $(obj)/util/kconfig/mconf.o: $(src)/util/kconfig/mconf.c
-	$(Q)mkdir -p $(obj)/util/kconfig
+	$(Q)mkdir -p $(dir $@)
 	$(Q)printf "  HOSTCC  $(subst $(shell pwd)/,,$(@))\n"
 	$(Q)$(HOSTCC) $(HOSTCFLAGS) $(INTLCFLAGS) -I$(src)/util/kconfig -c -o $@ $<
 
 $(obj)/util/kconfig/conf.o: $(src)/util/kconfig/conf.c
-	$(Q)mkdir -p $(obj)/util/kconfig
+	$(Q)mkdir -p $(dir $@)
 	$(Q)printf "  HOSTCC  $(subst $(shell pwd)/,,$(@))\n"
 	$(Q)$(HOSTCC) $(HOSTCFLAGS) -I$(src)/util/kconfig -c -o $@ $<
 
 $(obj)/util/kconfig/kconfig_load.o: $(src)/util/kconfig/kconfig_load.c
-	$(Q)mkdir -p $(obj)/util/kconfig
+	$(Q)mkdir -p $(dir $@)
 	$(Q)printf "  HOSTCC  $(subst $(shell pwd)/,,$(@))\n"
 	$(Q)$(HOSTCC) $(HOSTCFLAGS) -I$(obj)/util/kconfig -I$(src)/util/kconfig -c -o $@ $<
 
 $(obj)/util/kconfig/qconf.o: $(src)/util/kconfig/qconf.cc $(obj)/util/kconfig/qconf.moc $(obj)/util/kconfig/lkc_defs.h
-	$(Q)mkdir -p $(obj)/util/kconfig
+	$(Q)mkdir -p $(dir $@)
 	$(Q)printf "  HOSTCXX $(subst $(shell pwd)/,,$(@))\n"
 	$(Q)$(HOSTCXX) $(KC_QT_CFLAGS) -D LKC_DIRECT_LINK \
 		-I$(src)/util/kconfig -I$(obj)/util/kconfig -c -o $@ $<
 
 $(obj)/util/kconfig/gconf.o: $(src)/util/kconfig/gconf.c $(obj)/util/kconfig/lkc_defs.h
-	$(Q)mkdir -p $(obj)/util/kconfig
+	$(Q)mkdir -p $(dir $@)
 	$(Q)printf "  HOSTCC  $(subst $(shell pwd)/,,$(@))\n"
 	$(Q)$(HOSTCC) $(HOSTCFLAGS) `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \
 		-D LKC_DIRECT_LINK -I$(obj) -I$(src)/util/kconfig -c -o $@ $<
 
 $(obj)/util/kconfig/%.moc: $(src)/util/kconfig/%.h
-	$(Q)mkdir -p $(obj)/util/kconfig
+	$(Q)mkdir -p $(dir $@)
 	$(Q)printf "  MOC     $(subst $(shell pwd)/,,$(@))\n"
 	$(Q)$(KC_QT_MOC) -i $< -o $@
 
 $(obj)/util/kconfig/lkc_defs.h: $(src)/util/kconfig/lkc_proto.h
-	$(Q)mkdir -p $(obj)/util/kconfig
+	$(Q)mkdir -p $(dir $@)
 	$(Q)printf "  GEN     $(subst $(shell pwd)/,,$(@))\n"
 	$(Q)sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/'
 
 $(obj)/util/kconfig/zconf.tab.o: $(obj)/util/kconfig/zconf.tab.c $(obj)/util/kconfig/zconf.hash.c $(obj)/util/kconfig/lex.zconf.c
-	$(Q)mkdir -p $(obj)/util/kconfig
+	$(Q)mkdir -p $(dir $@)
 	$(Q)printf "  HOSTCC  $(subst $(shell pwd)/,,$(@))\n"
 	$(Q)$(HOSTCC) $(HOSTCFLAGS) $(INTLCFLAGS) -I$(src)/util/kconfig  -c -o $@ $(obj)/util/kconfig/zconf.tab.c
 
 $(obj)/util/kconfig/lex.zconf.c: $(src)/util/kconfig/lex.zconf.c_shipped
-	$(Q)mkdir -p $(obj)/util/kconfig
+	$(Q)mkdir -p $(dir $@)
 	$(Q)cp $< $@
 
 $(obj)/util/kconfig/zconf.hash.c: $(src)/util/kconfig/zconf.hash.c_shipped
-	$(Q)mkdir -p $(obj)/util/kconfig
+	$(Q)mkdir -p $(dir $@)
 	$(Q)cp $< $@
 
 $(obj)/util/kconfig/zconf.tab.c: $(src)/util/kconfig/zconf.tab.c_shipped
-	$(Q)mkdir -p $(obj)/util/kconfig
+	$(Q)mkdir -p $(dir $@)
 	$(Q)cp $< $@
 
 include $(src)/util/kconfig/lxdialog/Makefile
@@ -242,7 +242,7 @@
 	  echo "*"; \
 	  moc="/usr/bin/moc"; \
 	fi; \
-	mkdir -p $(obj)/util/kconfig; \
+	mkdir -p $(dir $@); \
 	echo "KC_QT_CFLAGS=$$cflags" > $@; \
 	echo "KC_QT_LIBS=$$libs" >> $@; \
 	echo "KC_QT_MOC=$$moc" >> $@
@@ -257,7 +257,7 @@
 $(obj)/util/kconfig/.tmp_gtkcheck:
 	@if `pkg-config --exists gtk+-2.0 gmodule-2.0 libglade-2.0`; then		\
 		if `pkg-config --atleast-version=2.0.0 gtk+-2.0`; then			\
-			mkdir -p $(obj)/util/kconfig;					\
+			mkdir -p $(dir $@);						\
 			touch $@;							\
 		else									\
 			echo "*"; 							\
Index: util/xcompile/xcompile
===================================================================
--- util/xcompile/xcompile	(revision 462)
+++ util/xcompile/xcompile	(working copy)
@@ -61,6 +61,7 @@
 	searchgnu ar >/dev/null && echo "AR_x86 := $(searchgnu ar)"
 	searchgnu as >/dev/null && echo "AS_x86 := $(searchgnu as) --32"
 	searchgnu ld >/dev/null && echo "LD_x86 := $(searchgnu ld) -b elf32-i386 -melf_i386"
+	searchgnu nm >/dev/null && echo "NM_x86 := $(searchgnu nm)"
 	searchgnu objcopy >/dev/null && echo "OBJCOPY_x86 := $(searchgnu objcopy)"
 	;;
 "x86")
@@ -71,6 +72,7 @@
 		searchgnu ar >/dev/null && echo "AR_x86 := $(searchgnu ar)"
 		searchgnu as >/dev/null && echo "AS_x86 := $(searchgnu as)"
 		searchgnu ld >/dev/null && echo "LD_x86 := $(searchgnu ld)"
+		searchgnu nm >/dev/null && echo "NM_x86 := $(searchgnu nm)"
 		searchgnu objcopy >/dev/null && echo "OBJCOPY_x86 := $(searchgnu objcopy)"
 	else
 		CC=`find /opt/local/bin/ -name "i386-elf-gcc-*"`
@@ -82,6 +84,7 @@
 		echo "AR_x86 := i386-elf-ar"
 		echo "AS_x86 := i386-elf-as"
 		echo "LD_x86 := i386-elf-ld"
+		echo "NM_x86 := i386-elf-nm -g "
 		echo "OBJCOPY_x86 := i386-elf-objcopy"
 		echo "INTLCFLAGS  := -I/opt/local/include"
 		echo "INTLLIBS    := -L/opt/local/lib -lintl"
@@ -94,6 +97,7 @@
 	echo "AR_x86 := i386-linux-ar"
 	echo "AS_x86 := i386-linux-as"
 	echo "LD_x86 := i386-linux-ld"
+	echo "NM_x86 := i386-linux-nm"
 	echo "OBJCOPY_x86 := i386-linux-objcopy"
 	;;
 esac
Index: util/dtc/Makefile
===================================================================
--- util/dtc/Makefile	(revision 462)
+++ util/dtc/Makefile	(working copy)
@@ -13,7 +13,7 @@
 #all: $(TARGETS)
 
 $(obj)/util/dtc/dtc: $(patsubst %,$(obj)/util/dtc/%,$(DTC_OBJS))
-	$(Q)mkdir -p $(obj)/util/dtc/
+	$(Q)mkdir -p $(dir $@)
 	$(Q)printf "  HOSTCC  $(subst $(shell pwd)/,,$(@))\n"
 	$(Q)$(HOSTCC) -o $@ $^
 
@@ -21,7 +21,7 @@
 	$(Q)$(HOSTCC) -o $@ $^
 
 $(obj)/util/dtc/dtc-parser.tab.c $(obj)/util/dtc/dtc-parser.tab.h: $(src)/util/dtc/dtc-parser.y
-	$(Q)mkdir -p $(obj)/util/dtc
+	$(Q)mkdir -p $(dir $@)
 	$(Q)printf "  BISON   $(subst $(shell pwd)/,,$(@))\n"
 	$(Q)cd $(obj)/util/dtc; $(BISON) -d $< > $(obj)/util/dtc/dtc.bison.out 2>&1
 
@@ -29,7 +29,7 @@
 	$(Q)cd $(obj)/util/dtc; $(LEX) $<
 
 $(obj)/util/dtc/%.o: $(src)/util/dtc/%.c
-	$(Q)mkdir -p $(obj)/util/dtc/
+	$(Q)mkdir -p $(dir $@)
 	$(Q)printf "  HOSTCC  $(subst $(shell pwd)/,,$(@))\n"
 	$(Q)$(HOSTCC) -I$(src)/util/dtc $(HOSTCFLAGS) -o $@ -c $< 
 
Index: util/x86emu/x86emu/x86emui.h
===================================================================
--- util/x86emu/x86emu/x86emui.h	(revision 462)
+++ util/x86emu/x86emu/x86emui.h	(working copy)
@@ -75,7 +75,7 @@
 #include <xf86_ansic.h>
 #else
 //#include <stdio.h>
-#include <stdlib.h>
+//#include <stdlib.h>
 #include <string.h>
 #endif                                                                                           
 /*--------------------------- Inline Functions ----------------------------*/
Index: util/x86emu/Makefile
===================================================================
--- util/x86emu/Makefile	(revision 462)
+++ util/x86emu/Makefile	(working copy)
@@ -36,18 +36,12 @@
 	$(Q)rm -f $@ # otherwise we always add to the archive
 	$(Q)$(AR) qcs $@ $(LIBX86EMU_OBJS)
 
-$(obj)/util/x86emu/x86emu/%.o: $(src)/util/x86emu/x86emu/%.c
-	$(Q)mkdir -p $(obj)/util/x86emu/x86emu/
-	$(Q)printf "  CC      $(subst $(shell pwd)/,,$(@))\n"
-	$(Q)$(CC) $(INITCFLAGS) -I$(src)/util/x86emu/include -c $< -o $@
+#
+# This rule is also valid for all subdirectories
+#
 
-$(obj)/util/x86emu/pcbios/%.o: $(src)/util/x86emu/pcbios/%.c
-	$(Q)mkdir -p $(obj)/util/x86emu/pcbios
-	$(Q)printf "  CC      $(subst $(shell pwd)/,,$(@))\n"
-	$(Q)$(CC) $(INITCFLAGS) -I$(src)/util/x86emu/include -c $< -o $@
-
 $(obj)/util/x86emu/%.o: $(src)/util/x86emu/%.c
-	$(Q)mkdir -p $(obj)/util/x86emu
+	$(Q)mkdir -p $(dir $@)
 	$(Q)printf "  CC      $(subst $(shell pwd)/,,$(@))\n"
 	$(Q)$(CC) $(INITCFLAGS) -I$(src)/util/x86emu/include -c $< -o $@
 
Index: arch/x86/post_code.c
===================================================================
--- arch/x86/post_code.c	(revision 0)
+++ arch/x86/post_code.c	(revision 0)
@@ -0,0 +1,28 @@
+/*
+ * This file is part of the LinuxBIOS project.
+ *
+ * Copyright (C) 2007 Stefan Reinauer <stepan@coresystems.de>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+ */
+
+#include <types.h>
+#include <io.h>
+
+void post_code(u8 value)
+{
+	outb(value, 0x80);
+}
+
+
Index: arch/x86/stage1.c
===================================================================
--- arch/x86/stage1.c	(revision 462)
+++ arch/x86/stage1.c	(working copy)
@@ -25,6 +25,7 @@
 #include <tables.h>
 #include <lib.h>
 #include <mc146818rtc.h>
+#include <post_code.h>
 
 #define UNCOMPRESS_AREA 0x60000
 
@@ -35,11 +36,6 @@
 void hardware_stage1(void);
 void disable_car(void);
 
-void post_code(u8 value)
-{
-	outb(value, 0x80);
-}
-
 static void stop_ap(void)
 {
 	// nothing yet
Index: arch/x86/Makefile
===================================================================
--- arch/x86/Makefile	(revision 462)
+++ arch/x86/Makefile	(working copy)
@@ -58,7 +58,7 @@
 COMPRESSFLAG := -C nrv2b
 endif
 
-$(obj)/linuxbios.rom: $(obj)/linuxbios.bootblock $(obj)/util/lar/lar lzma nrv2b $(obj)/linuxbios.initram $(obj)/linuxbios.stage2 $(obj)/option_table
+$(obj)/linuxbios.rom $(obj)/linuxbios.map: $(obj)/linuxbios.bootblock $(obj)/util/lar/lar lzma nrv2b $(obj)/linuxbios.initram $(obj)/linuxbios.stage2 $(obj)/option_table
 	$(Q)rm -rf $(obj)/lar.tmp
 	$(Q)mkdir $(obj)/lar.tmp
 	$(Q)mkdir $(obj)/lar.tmp/normal
@@ -86,7 +86,16 @@
 	$(Q)# Run "qemu -L build/ -serial stdio -hda /dev/zero".
 	$(Q)printf "  CP      $(subst $(shell pwd)/,,$(obj)/bios.bin)\n"
 	$(Q)cp $@ $(obj)/bios.bin
+	$(Q)echo "LinuxBIOS ROM Image:" > $(obj)/linuxbios.map
+	$(Q)$(obj)/util/lar/lar -l $(obj)/linuxbios.rom >> $(obj)/linuxbios.map
+	$(Q)(echo; echo "Stage 0/1 Map:") >> $(obj)/linuxbios.map
+	$(Q)cat $(obj)/stage0.init.map >> $(obj)/linuxbios.map
+	$(Q)(echo; echo "Stage Initram Map:") >> $(obj)/linuxbios.map
+	$(Q)cat $(obj)/linuxbios.initram.map >> $(obj)/linuxbios.map
+	$(Q)(echo; echo "Stage 2 Map:") >> $(obj)/linuxbios.map
+	$(Q)cat $(obj)/linuxbios.stage2.map >> $(obj)/linuxbios.map
 
+
 $(obj)/linuxbios.bootblock: $(obj)/linuxbios.vpd $(obj)/stage0.init
 	$(Q)printf "  BUILD   $(subst $(shell pwd)/,,$(@))\n"
 	$(Q)cat $^ > $@
@@ -100,13 +109,14 @@
 STAGE0_LIB_OBJ       = uart8250.o mem.o elfboot.o lar.o delay.o vtxprintf.o \
 		       vsprintf.o console.o $(DECOMPRESSORS)
 STAGE0_ARCH_X86_OBJ  = stage1.o serial.o archelfboot.o speaker.o \
-		       udelay_io.o mc146818rtc.o
+		       udelay_io.o mc146818rtc.o post_code.o
 
 ifeq ($(CONFIG_CPU_I586),y)
 	STAGE0_CAR_OBJ = stage0_i586.o
 else
 ifeq ($(CONFIG_CPU_AMD_GEODELX),y)
 	STAGE0_CAR_OBJ = geodelx/stage0.o
+	STAGE0_ARCH_X86_OBJ += geodelx/stage1.o
 else
 	STAGE0_CAR_OBJ = stage0_i586.o
 endif
@@ -116,7 +126,7 @@
 STAGE0_OBJ := $(patsubst %,$(obj)/lib/%,$(STAGE0_LIB_OBJ)) \
 	      $(patsubst %,$(obj)/arch/x86/%,$(STAGE0_ARCH_X86_OBJ)) \
 	      $(patsubst %,$(obj)/arch/x86/%,$(STAGE0_CAR_OBJ)) \
-		$(STAGE0_MAINBOARD_OBJ)
+	      $(STAGE0_MAINBOARD_OBJ) $(STAGE0_CHIPSET_OBJ)
 
 $(obj)/stage0.o $(obj)/stage0.init: $(STAGE0_OBJ)
 	$(Q)# We need to be careful. If stage0.o gets bigger than
@@ -136,8 +146,11 @@
 	$(Q)printf "  TEST    $(subst $(shell pwd)/,,$(@))\n"
 	$(Q)test `wc -c < $(obj)/stage0.init` -gt 16128 && \
 		printf "Error. Bootblock got too big.\n" || true
+	$(Q)printf "  NM      $(subst $(shell pwd)/,,$(@))\n"
+	$(Q)$(NM) $(obj)/stage0.o |sort -u > $(obj)/stage0.init.map
 
 
+
 #
 # This is the rest of LinuxBIOS (v2: linuxbios_ram.rom).
 # Is this maybe platform independent, except for the "drivers"?
@@ -172,29 +185,24 @@
 STAGE2_OBJ += $(obj)/util/x86emu/libx86emu.a $(LIBGCC_FILE_NAME)
 endif
 
-$(obj)/linuxbios.stage2: $(obj)/stage0.init $(STAGE2_OBJ)
+$(obj)/linuxbios.stage2 $(obj)/linuxbios.stage2.map: $(obj)/stage0.init $(STAGE2_OBJ)
 	$(Q)# leave a .o with full symbols in it for debugging.
 	$(Q)printf "  LD      $(subst $(shell pwd)/,,$(@))\n"
 	$(Q)$(LD) -R $(obj)/stage0.o -Ttext 0x1000 --entry=stage2 \
 		  -o $(obj)/linuxbios.stage2.o $(STAGE2_OBJ)
 	$(Q)printf "  OBJCOPY $(subst $(shell pwd)/,,$(@))\n"
 	$(Q)$(OBJCOPY) -O binary $(obj)/linuxbios.stage2.o $(obj)/linuxbios.stage2
+	$(Q)$(NM) $(obj)/linuxbios.stage2.o |sort -u > $(obj)/linuxbios.stage2.map
 
-
 #
 # Build rules.
 #
 
 $(obj)/arch/x86/%.o: $(src)/arch/x86/%.c
-	$(Q)mkdir -p $(obj)/arch/x86
+	$(Q)mkdir -p $(dir $@)
 	$(Q)printf "  CC      $(subst $(shell pwd)/,,$(@))\n"
 	$(Q)$(CC) $(INITCFLAGS) -c $< -o $@
-
-$(obj)/mainboard/$(MAINBOARDDIR)/%.o: $(src)/mainboard/$(MAINBOARDDIR)/%.c
-	$(Q)mkdir -p $(obj)/mainboard/$(MAINBOARDDIR)
-	$(Q)printf "  CC      $(subst $(shell pwd)/,,$(@))\n"
-	$(Q)$(CC) $(INITCFLAGS) -c $< -o $@
-
+	
 # Building asm stub.
 $(obj)/arch/x86/stage0%.o: $(src)/arch/x86/stage0%.S
 	$(Q)printf "  CC      $(subst $(shell pwd)/,,$(@))\n"
@@ -205,7 +213,7 @@
 	$(Q)$(AS) $(obj)/arch/x86/stage0_asm.s -o $@
 
 $(obj)/arch/x86/geodelx/stage0.o: $(src)/arch/x86/geodelx/stage0.S
-	$(Q)mkdir -p $(obj)/arch/x86/geodelx
+	$(Q)mkdir -p $(dir $@)
 	$(Q)printf "  CC      $(subst $(shell pwd)/,,$(@))\n"
 	$(Q)$(CC) -E $(LINUXBIOSINCLUDE) $< \
 		-o $(obj)/arch/x86/stage0_asm.s -DBOOTBLK=0x1f00 \
