Author: stepan Date: 2007-11-23 00:43:06 +0100 (Fri, 23 Nov 2007) New Revision: 517
Modified: LinuxBIOSv3/Rules.make LinuxBIOSv3/mainboard/adl/msm800sev/Makefile LinuxBIOSv3/mainboard/adl/msm800sev/initram.c LinuxBIOSv3/mainboard/amd/norwich/Makefile LinuxBIOSv3/mainboard/amd/norwich/initram.c LinuxBIOSv3/mainboard/artecgroup/dbe61/Makefile LinuxBIOSv3/mainboard/artecgroup/dbe61/initram.c LinuxBIOSv3/mainboard/emulation/qemu-x86/Makefile LinuxBIOSv3/mainboard/emulation/qemu-x86/initram.c Log: Create a global rule for compiling raminit code to keep the mainboard Makefiles clean and simple.
Signed-off-by: Stefan Reinauer stepan@coresystems.de Acked-by: Uwe Hermann uwe@hermann-uwe.de
Modified: LinuxBIOSv3/Rules.make =================================================================== --- LinuxBIOSv3/Rules.make 2007-11-22 22:54:11 UTC (rev 516) +++ LinuxBIOSv3/Rules.make 2007-11-22 23:43:06 UTC (rev 517) @@ -78,3 +78,13 @@ $(Q)printf " CC $(subst $(shell pwd)/,,$(@))\n" $(Q)$(CC) $(INITCFLAGS) -c $< -o $@
+# +# RAM initialization code can not be linked at a specific address, +# hence it has to be executed in place position independently. +# + +$(obj)/%_xip.o: $(src)/%.c + $(Q)mkdir -p $(dir $@) + $(Q)printf " CC $(subst $(shell pwd)/,,$(@)) (XIP)\n" + $(Q)$(CC) $(INITCFLAGS) -D_SHARED -fPIE -c $< -o $@ +
Modified: LinuxBIOSv3/mainboard/adl/msm800sev/Makefile =================================================================== --- LinuxBIOSv3/mainboard/adl/msm800sev/Makefile 2007-11-22 22:54:11 UTC (rev 516) +++ LinuxBIOSv3/mainboard/adl/msm800sev/Makefile 2007-11-22 23:43:06 UTC (rev 517) @@ -32,24 +32,11 @@ $(obj)/southbridge/amd/cs5536/smbus_initram.o \ $(obj)/arch/x86/geodelx/geodelx.o
-# Next Quest: Make a single rule out of those: -$(obj)/mainboard/$(MAINBOARDDIR)/initram.o: $(src)/mainboard/$(MAINBOARDDIR)/initram.c - $(Q)$(CC) $(INITCFLAGS) -D_SHARED -D_MAINOBJECT -fPIE -c $< -o $@ -$(obj)/northbridge/amd/geodelx/raminit.o: $(src)/northbridge/amd/geodelx/raminit.c - $(Q)mkdir -p $(dir $@) - $(Q)$(CC) $(INITCFLAGS) -D_SHARED -fPIE -c $< -o $@ -$(obj)/southbridge/amd/cs5536/smbus_initram.o: $(src)/southbridge/amd/cs5536/smbus_initram.c - $(Q)mkdir -p $(dir $@) - $(Q)$(CC) $(INITCFLAGS) -D_SHARED -fPIE -c $< -o $@ -$(obj)/arch/x86/geodelx/geodelx.o: $(src)/arch/x86/geodelx/geodelx.c - $(Q)mkdir -p $(dir $@) - $(Q)$(CC) $(INITCFLAGS) -D_SHARED -fPIE -c $< -o $@ - -$(obj)/linuxbios.initram $(obj)/linuxbios.initram.map: $(obj)/stage0.init $(obj)/stage0-prefixed.o $(INITRAM_OBJ) +$(obj)/linuxbios.initram $(obj)/linuxbios.initram.map: $(obj)/stage0.init $(obj)/stage0-prefixed.o $(patsubst %.o,%_xip.o,$(INITRAM_OBJ)) $(Q)# initram links against stage0 $(Q)printf " LD $(subst $(shell pwd)/,,$(@))\n" $(Q)$(LD) --entry main -N -R $(obj)/stage0-prefixed.o \ - $(INITRAM_OBJ) -o $(obj)/linuxbios.initram.o + $(patsubst %.o,%_xip.o,$(INITRAM_OBJ)) -o $(obj)/linuxbios.initram.o $(Q)printf " OBJCOPY $(subst $(shell pwd)/,,$(@))\n" $(Q)$(OBJCOPY) -O binary $(obj)/linuxbios.initram.o \ $(obj)/linuxbios.initram
Modified: LinuxBIOSv3/mainboard/adl/msm800sev/initram.c =================================================================== --- LinuxBIOSv3/mainboard/adl/msm800sev/initram.c 2007-11-22 22:54:11 UTC (rev 516) +++ LinuxBIOSv3/mainboard/adl/msm800sev/initram.c 2007-11-22 23:43:06 UTC (rev 517) @@ -18,6 +18,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+#define _MAINOBJECT #include <types.h> #include <lib.h> #include <console.h>
Modified: LinuxBIOSv3/mainboard/amd/norwich/Makefile =================================================================== --- LinuxBIOSv3/mainboard/amd/norwich/Makefile 2007-11-22 22:54:11 UTC (rev 516) +++ LinuxBIOSv3/mainboard/amd/norwich/Makefile 2007-11-22 23:43:06 UTC (rev 517) @@ -26,30 +26,17 @@ $(obj)/southbridge/amd/cs5536/smbus_initram.o \ $(obj)/arch/x86/geodelx/geodelx.o
-# Next Quest: Make a single rule out of those: -$(obj)/mainboard/$(MAINBOARDDIR)/initram.o: $(src)/mainboard/$(MAINBOARDDIR)/initram.c - $(Q)$(CC) $(INITCFLAGS) -D_SHARED -D_MAINOBJECT -fPIE -c $< -o $@ -$(obj)/northbridge/amd/geodelx/raminit.o: $(src)/northbridge/amd/geodelx/raminit.c - $(Q)mkdir -p $(dir $@) - $(Q)$(CC) $(INITCFLAGS) -D_SHARED -fPIE -c $< -o $@ -$(obj)/southbridge/amd/cs5536/smbus_initram.o: $(src)/southbridge/amd/cs5536/smbus_initram.c - $(Q)mkdir -p $(dir $@) - $(Q)$(CC) $(INITCFLAGS) -D_SHARED -fPIE -c $< -o $@ -$(obj)/arch/x86/geodelx/geodelx.o: $(src)/arch/x86/geodelx/geodelx.c - $(Q)mkdir -p $(dir $@) - $(Q)$(CC) $(INITCFLAGS) -D_SHARED -fPIE -c $< -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)
-$(obj)/linuxbios.initram $(obj)/linuxbios.initram.map: $(obj)/stage0.init $(obj)/stage0-prefixed.o $(INITRAM_OBJ) +$(obj)/linuxbios.initram $(obj)/linuxbios.initram.map: $(obj)/stage0.init $(obj)/stage0-prefixed.o $(patsubst %.o,%_xip.o,$(INITRAM_OBJ)) $(Q)# initram links against stage0 $(Q)printf " LD $(subst $(shell pwd)/,,$(@))\n" $(Q)$(LD) --entry main -N -R $(obj)/stage0-prefixed.o \ - $(INITRAM_OBJ) -o $(obj)/linuxbios.initram.o + $(patsubst %.o,%_xip.o,$(INITRAM_OBJ)) -o $(obj)/linuxbios.initram.o $(Q)printf " OBJCOPY $(subst $(shell pwd)/,,$(@))\n" $(Q)$(OBJCOPY) -O binary $(obj)/linuxbios.initram.o \ $(obj)/linuxbios.initram
Modified: LinuxBIOSv3/mainboard/amd/norwich/initram.c =================================================================== --- LinuxBIOSv3/mainboard/amd/norwich/initram.c 2007-11-22 22:54:11 UTC (rev 516) +++ LinuxBIOSv3/mainboard/amd/norwich/initram.c 2007-11-22 23:43:06 UTC (rev 517) @@ -18,6 +18,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+#define _MAINOBJECT + #include <types.h> #include <lib.h> #include <console.h>
Modified: LinuxBIOSv3/mainboard/artecgroup/dbe61/Makefile =================================================================== --- LinuxBIOSv3/mainboard/artecgroup/dbe61/Makefile 2007-11-22 22:54:11 UTC (rev 516) +++ LinuxBIOSv3/mainboard/artecgroup/dbe61/Makefile 2007-11-22 23:43:06 UTC (rev 517) @@ -30,24 +30,11 @@ INITRAM_OBJ = $(obj)/mainboard/$(MAINBOARDDIR)/initram.o \ $(obj)/arch/x86/geodelx/geodelx.o
-# Next Quest: Make a single rule out of those: -$(obj)/mainboard/$(MAINBOARDDIR)/initram.o: $(src)/mainboard/$(MAINBOARDDIR)/initram.c - $(Q)$(CC) $(INITCFLAGS) -D_SHARED -D_MAINOBJECT -fPIE -c $< -o $@ -$(obj)/northbridge/amd/geodelx/raminit.o: $(src)/northbridge/amd/geodelx/raminit.c - $(Q)mkdir -p $(dir $@) - $(Q)$(CC) $(INITCFLAGS) -D_SHARED -fPIE -c $< -o $@ -$(obj)/southbridge/amd/cs5536/smbus_initram.o: $(src)/southbridge/amd/cs5536/smbus_initram.c - $(Q)mkdir -p $(dir $@) - $(Q)$(CC) $(INITCFLAGS) -D_SHARED -fPIE -c $< -o $@ -$(obj)/arch/x86/geodelx/geodelx.o: $(src)/arch/x86/geodelx/geodelx.c - $(Q)mkdir -p $(dir $@) - $(Q)$(CC) $(INITCFLAGS) -D_SHARED -fPIE -c $< -o $@ - -$(obj)/linuxbios.initram $(obj)/linuxbios.initram.map: $(obj)/stage0.init $(obj)/stage0-prefixed.o $(INITRAM_OBJ) +$(obj)/linuxbios.initram $(obj)/linuxbios.initram.map: $(obj)/stage0.init $(obj)/stage0-prefixed.o $(patsubst %.o,%_xip.o,$(INITRAM_OBJ)) $(Q)# initram links against stage0 $(Q)printf " LD $(subst $(shell pwd)/,,$(@))\n" $(Q)$(LD) --entry main -N -R $(obj)/stage0-prefixed.o \ - $(INITRAM_OBJ) -o $(obj)/linuxbios.initram.o + $(patsubst %.o,%_xip.o,$(INITRAM_OBJ)) -o $(obj)/linuxbios.initram.o $(Q)printf " OBJCOPY $(subst $(shell pwd)/,,$(@))\n" $(Q)$(OBJCOPY) -O binary $(obj)/linuxbios.initram.o \ $(obj)/linuxbios.initram
Modified: LinuxBIOSv3/mainboard/artecgroup/dbe61/initram.c =================================================================== --- LinuxBIOSv3/mainboard/artecgroup/dbe61/initram.c 2007-11-22 22:54:11 UTC (rev 516) +++ LinuxBIOSv3/mainboard/artecgroup/dbe61/initram.c 2007-11-22 23:43:06 UTC (rev 517) @@ -18,6 +18,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+#define _MAINOBJECT #include <types.h> #include <lib.h> #include <console.h>
Modified: LinuxBIOSv3/mainboard/emulation/qemu-x86/Makefile =================================================================== --- LinuxBIOSv3/mainboard/emulation/qemu-x86/Makefile 2007-11-22 22:54:11 UTC (rev 516) +++ LinuxBIOSv3/mainboard/emulation/qemu-x86/Makefile 2007-11-22 23:43:06 UTC (rev 517) @@ -42,14 +42,11 @@
INITRAM_OBJ = $(obj)/mainboard/$(MAINBOARDDIR)/initram.o
-$(obj)/mainboard/$(MAINBOARDDIR)/initram.o: $(src)/mainboard/$(MAINBOARDDIR)/initram.c - $(Q)$(CC) $(INITCFLAGS) -D_SHARED -D_MAINOBJECT -fPIE -c $< -o $@ - -$(obj)/linuxbios.initram $(obj)/linuxbios.initram.map: $(obj)/stage0.init $(obj)/stage0-prefixed.o $(INITRAM_OBJ) +$(obj)/linuxbios.initram $(obj)/linuxbios.initram.map: $(obj)/stage0.init $(obj)/stage0-prefixed.o $(patsubst %.o,%_xip.o,$(INITRAM_OBJ)) $(Q)# initram links against stage0 $(Q)printf " LD $(subst $(shell pwd)/,,$(@))\n" $(Q)$(LD) --entry main -N -R $(obj)/stage0-prefixed.o \ - $(INITRAM_OBJ) -o $(obj)/linuxbios.initram.o + $(patsubst %.o,%_xip.o,$(INITRAM_OBJ)) -o $(obj)/linuxbios.initram.o $(Q)printf " OBJCOPY $(subst $(shell pwd)/,,$(@))\n" $(Q)$(OBJCOPY) -O binary $(obj)/linuxbios.initram.o \ $(obj)/linuxbios.initram
Modified: LinuxBIOSv3/mainboard/emulation/qemu-x86/initram.c =================================================================== --- LinuxBIOSv3/mainboard/emulation/qemu-x86/initram.c 2007-11-22 22:54:11 UTC (rev 516) +++ LinuxBIOSv3/mainboard/emulation/qemu-x86/initram.c 2007-11-22 23:43:06 UTC (rev 517) @@ -17,6 +17,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
+#define _MAINOBJECT #include <console.h>
int main(void)