2009-08-12 17:00:51 +02:00
|
|
|
#######################################################################
|
|
|
|
# Take care of subdirectories
|
|
|
|
subdirs-y += boot
|
2010-01-30 10:47:18 +01:00
|
|
|
# subdirs-y += init
|
2009-08-12 17:00:51 +02:00
|
|
|
subdirs-y += lib
|
|
|
|
subdirs-y += smp
|
|
|
|
|
2009-08-25 14:18:05 +02:00
|
|
|
obj-$(CONFIG_HAVE_OPTION_TABLE) += ../../option_table.o
|
2009-08-12 17:00:51 +02:00
|
|
|
|
|
|
|
ifdef POST_EVALUATION
|
2009-08-13 17:29:01 +02:00
|
|
|
|
2009-08-12 17:00:51 +02:00
|
|
|
#######################################################################
|
|
|
|
# Build the final rom image
|
2009-12-23 13:52:56 +01:00
|
|
|
$(obj)/coreboot.rom: $(obj)/coreboot.pre $(obj)/coreboot_ram $(CBFSTOOL)
|
|
|
|
cp $(obj)/coreboot.pre $@
|
2009-08-25 21:38:46 +02:00
|
|
|
if [ -f fallback/coreboot_apc ]; \
|
2009-08-12 17:00:51 +02:00
|
|
|
then \
|
2010-02-09 20:35:16 +01:00
|
|
|
$(CBFSTOOL) $@ add-stage fallback/coreboot_apc $(CONFIG_CBFS_PREFIX)/coreboot_apc $(CBFS_COMPRESS_FLAG); \
|
2009-08-12 17:00:51 +02:00
|
|
|
fi
|
2010-02-09 20:35:16 +01:00
|
|
|
$(CBFSTOOL) $@ add-stage $(obj)/coreboot_ram $(CONFIG_CBFS_PREFIX)/coreboot_ram $(CBFS_COMPRESS_FLAG)
|
2009-08-12 17:00:51 +02:00
|
|
|
ifeq ($(CONFIG_PAYLOAD_NONE),y)
|
2009-08-25 17:03:20 +02:00
|
|
|
@printf " PAYLOAD none (as specified by user)\n"
|
2009-08-12 17:00:51 +02:00
|
|
|
else
|
2009-10-28 00:14:54 +01:00
|
|
|
@printf " PAYLOAD $(CONFIG_FALLBACK_PAYLOAD_FILE) $(CBFS_PAYLOAD_COMPRESS_FLAG)\n"
|
2010-02-09 20:35:16 +01:00
|
|
|
$(CBFSTOOL) $(obj)/coreboot.rom add-payload $(CONFIG_FALLBACK_PAYLOAD_FILE) $(CONFIG_CBFS_PREFIX)/payload $(CBFS_PAYLOAD_COMPRESS_FLAG)
|
2009-10-23 14:14:15 +02:00
|
|
|
endif
|
2009-08-17 16:46:13 +02:00
|
|
|
ifeq ($(CONFIG_VGA_BIOS),y)
|
2009-08-25 17:03:20 +02:00
|
|
|
@printf " VGABIOS $(CONFIG_FALLBACK_VGA_BIOS_FILE) $(CONFIG_FALLBACK_VGA_BIOS_ID)\n"
|
2009-10-28 16:30:11 +01:00
|
|
|
$(CBFSTOOL) $(obj)/coreboot.rom add $(CONFIG_FALLBACK_VGA_BIOS_FILE) "pci$(CONFIG_FALLBACK_VGA_BIOS_ID).rom" optionrom
|
2009-08-17 16:46:13 +02:00
|
|
|
endif
|
2009-10-28 18:10:51 +01:00
|
|
|
@printf " CBFSPRINT $(subst $(obj)/,,$(@))\n\n"
|
2009-10-28 16:30:11 +01:00
|
|
|
$(CBFSTOOL) $(obj)/coreboot.rom print
|
2009-08-12 17:00:51 +02:00
|
|
|
|
|
|
|
#######################################################################
|
|
|
|
# i386 specific tools
|
|
|
|
|
2009-12-23 13:52:56 +01:00
|
|
|
$(obj)/option_table.h $(obj)/option_table.c $(obj)/arch/i386/../../option_table.c: $(obj)/build_opt_tbl $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout
|
2009-10-28 18:10:51 +01:00
|
|
|
@printf " OPTION $(subst $(obj)/,,$(@))\n"
|
2009-08-25 21:38:46 +02:00
|
|
|
$(obj)/build_opt_tbl --config $(top)/src/mainboard/$(MAINBOARDDIR)/cmos.layout --header $(obj)/option_table.h --option $(obj)/option_table.c
|
2009-08-12 17:00:51 +02:00
|
|
|
|
2009-09-24 18:56:08 +02:00
|
|
|
$(obj)/build_opt_tbl: $(top)/util/options/build_opt_tbl.c $(top)/src/include/pc80/mc146818rtc.h $(top)/src/include/boot/coreboot_tables.h $(obj)/config.h
|
2009-10-28 18:10:51 +01:00
|
|
|
@printf " HOSTCC $(subst $(obj)/,,$(@))\n"
|
2009-08-25 21:38:46 +02:00
|
|
|
$(HOSTCC) $(HOSTCFLAGS) -include $(obj)/config.h $< -o $@
|
2009-08-12 17:00:51 +02:00
|
|
|
|
|
|
|
#######################################################################
|
|
|
|
# Build the coreboot_ram (stage 2)
|
|
|
|
|
2010-02-10 12:56:21 +01:00
|
|
|
$(obj)/coreboot_ram: $(obj)/coreboot_ram.o $(src)/arch/i386/coreboot_ram.ld #ldoptions
|
2009-10-28 18:10:51 +01:00
|
|
|
@printf " CC $(subst $(obj)/,,$(@))\n"
|
2010-02-10 12:56:21 +01:00
|
|
|
$(CC) -nostdlib -nostartfiles -static -o $@ -L$(obj) -T $(src)/arch/i386/coreboot_ram.ld $(obj)/coreboot_ram.o
|
2009-08-25 21:38:46 +02:00
|
|
|
$(NM) -n $(obj)/coreboot_ram | sort > $(obj)/coreboot_ram.map
|
2009-08-12 17:00:51 +02:00
|
|
|
|
|
|
|
$(obj)/coreboot_ram.o: $(obj)/arch/i386/lib/c_start.o $(drivers) $(obj)/coreboot.a $(LIBGCC_FILE_NAME)
|
2009-10-28 18:10:51 +01:00
|
|
|
@printf " CC $(subst $(obj)/,,$(@))\n"
|
2009-08-25 21:38:46 +02:00
|
|
|
$(CC) -nostdlib -r -o $@ $(obj)/arch/i386/lib/c_start.o $(drivers) -Wl,-\( $(obj)/coreboot.a $(LIBGCC_FILE_NAME) -Wl,-\)
|
2009-08-12 17:00:51 +02:00
|
|
|
|
|
|
|
$(obj)/coreboot.a: $(objs)
|
2009-10-28 18:10:51 +01:00
|
|
|
@printf " AR $(subst $(obj)/,,$(@))\n"
|
2009-08-25 21:38:46 +02:00
|
|
|
rm -f $(obj)/coreboot.a
|
|
|
|
$(AR) cr $(obj)/coreboot.a $(objs)
|
2009-08-12 17:00:51 +02:00
|
|
|
|
|
|
|
#######################################################################
|
|
|
|
# done
|
|
|
|
|
2010-02-03 18:56:37 +01:00
|
|
|
# crt0s should be set by now
|
|
|
|
ifeq ($(crt0s),)
|
|
|
|
$(error crt0s are empty. If your board still uses crt0-y and ldscript-y: It shouldn't, we moved away from that in r5065)
|
|
|
|
endif
|
2010-02-09 13:21:10 +01:00
|
|
|
|
|
|
|
OPTION_TABLE_H:=
|
|
|
|
ifeq ($(CONFIG_HAVE_OPTION_TABLE),y)
|
|
|
|
OPTION_TABLE_H:=$(obj)/option_table.h
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(CONFIG_ROMCC),y)
|
|
|
|
ROMCCFLAGS ?= -mcpu=p2 -O2
|
|
|
|
|
|
|
|
$(obj)/mainboard/$(MAINBOARDDIR)/failover.inc: $(obj)/romcc $(src)/arch/i386/lib/failover.c
|
|
|
|
$(obj)/romcc $(ROMCCFLAGS) --label-prefix=failover $(INCLUDES) $(src)/arch/i386/lib/failover.c -o $@
|
|
|
|
|
|
|
|
$(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc: $(src)/mainboard/$(MAINBOARDDIR)/romstage.c $(obj)/romcc $(OPTION_TABLE_H) $(obj)/build.h
|
2010-02-11 04:21:29 +01:00
|
|
|
$(obj)/romcc $(ROMCCFLAGS) -include $(obj)/build.h $(INCLUDES) $< -o $@
|
2010-02-09 13:21:10 +01:00
|
|
|
|
|
|
|
else
|
2010-02-11 09:44:20 +01:00
|
|
|
|
|
|
|
$(obj)/mainboard/$(MAINBOARDDIR)/ap_romstage.o: $(src)/mainboard/$(MAINBOARDDIR)/ap_romstage.c $(obj)/option_table.h
|
|
|
|
$(CC) $(CFLAGS) $(CPPFLAGS) $(DEBUG_CFLAGS) -I$(src) -I. -c -S $(src)/mainboard/$(MAINBOARDDIR)/ap_romstage.c -o $@
|
|
|
|
|
2010-02-09 13:21:10 +01:00
|
|
|
$(obj)/mainboard/$(MAINBOARDDIR)/romstage.inc: $(src)/mainboard/$(MAINBOARDDIR)/romstage.c $(OPTION_TABLE_H) $(obj)/build.h
|
2010-02-12 00:00:10 +01:00
|
|
|
$(CC) $(CFLAGS) $(CPPFLAGS) $(DEBUG_CFLAGS) -include $(obj)/build.h -I$(src) -I. -c -S $< -o $@.tmp1
|
|
|
|
sed -e 's/\.rodata/.rom.data/g' -e 's/\.text/.section .rom.text/g' $@.tmp1 > $@.tmp
|
2010-02-10 19:08:22 +01:00
|
|
|
mv $@.tmp $@
|
2010-02-12 00:00:10 +01:00
|
|
|
rm -f $@.tmp1
|
2010-02-09 13:21:10 +01:00
|
|
|
endif
|
2009-08-12 17:00:51 +02:00
|
|
|
endif
|
2009-12-23 13:52:56 +01:00
|
|
|
|
|
|
|
ifeq ($(CONFIG_TINY_BOOTBLOCK),y)
|
|
|
|
include $(src)/arch/i386/Makefile.tinybootblock.inc
|
|
|
|
else
|
|
|
|
include $(src)/arch/i386/Makefile.bigbootblock.inc
|
|
|
|
endif
|