summaryrefslogtreecommitdiff
path: root/src/arch/i386/Makefile.bigbootblock.inc
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/i386/Makefile.bigbootblock.inc')
-rw-r--r--src/arch/i386/Makefile.bigbootblock.inc35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/arch/i386/Makefile.bigbootblock.inc b/src/arch/i386/Makefile.bigbootblock.inc
new file mode 100644
index 0000000000..06af5d2b64
--- /dev/null
+++ b/src/arch/i386/Makefile.bigbootblock.inc
@@ -0,0 +1,35 @@
+ifdef POST_EVALUATION
+
+#######################################################################
+# Build the final rom image
+
+$(obj)/coreboot.pre: $(obj)/coreboot.bootblock $(CBFSTOOL)
+ rm -f $@
+ $(CBFSTOOL) $@ create $(CONFIG_COREBOOT_ROMSIZE_KB)K $(obj)/coreboot.bootblock
+
+#######################################################################
+# Build the bootblock
+
+$(obj)/coreboot.bootblock: $(obj)/coreboot
+ @printf " OBJCOPY $(subst $(obj)/,,$(@))\n"
+ $(OBJCOPY) -O binary $< $@
+
+$(obj)/ldscript.ld: $(ldscripts) $(obj)/ldoptions
+ printf 'INCLUDE "ldoptions"\n' > $@
+ printf '$(foreach ldscript,$(ldscripts),INCLUDE "$(ldscript:$(obj)/%=%)"\n)' >> $@
+
+$(obj)/crt0_includes.h: $(crt0s)
+ printf '$(foreach crt0,config.h $(crt0s),#include "$(crt0:$(obj)/%=%)"\n)' > $@
+
+$(obj)/mainboard/$(MAINBOARDDIR)/crt0.o: $(obj)/mainboard/$(MAINBOARDDIR)/crt0.s
+ $(CC) -I$(obj) -Wa,-acdlns -c -o $@ $< > $(dir $@)/crt0.disasm
+
+$(obj)/mainboard/$(MAINBOARDDIR)/crt0.s: $(src)/arch/i386/init/crt0.S.lb $(obj)/crt0_includes.h
+ $(CC) -x assembler-with-cpp -DASSEMBLY -E -I$(src)/include -I$(src)/arch/i386/include -I$(obj) -include $(obj)/config.h -I. -I$(src) $< > $@.new && mv $@.new $@
+
+$(obj)/coreboot: $(initobjs) $(obj)/ldscript.ld
+ @printf " LINK $(subst $(obj)/,,$(@))\n"
+ $(CC) -nostdlib -nostartfiles -static -o $@ -L$(obj) -T $(obj)/ldscript.ld $(initobjs)
+ $(NM) -n $(obj)/coreboot | sort > $(obj)/coreboot.map
+
+endif