2009-08-12 17:00:51 +02:00
|
|
|
#######################################################################
|
|
|
|
# Take care of subdirectories
|
|
|
|
subdirs-y += boot
|
|
|
|
subdirs-y += init
|
|
|
|
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
|
|
|
|
|
|
|
|
$(obj)/coreboot.rom: $(obj)/coreboot.bootblock $(obj)/coreboot_ram $(CBFSTOOL)
|
2009-08-25 21:38:46 +02:00
|
|
|
rm -f $@
|
2009-11-11 22:32:23 +01:00
|
|
|
$(CBFSTOOL) $@ create $(shell expr 1024 \* $(CONFIG_COREBOOT_ROMSIZE_KB)) $(obj)/coreboot.bootblock
|
2009-08-25 21:38:46 +02:00
|
|
|
if [ -f fallback/coreboot_apc ]; \
|
2009-08-12 17:00:51 +02:00
|
|
|
then \
|
2009-08-25 21:38:46 +02:00
|
|
|
$(CBFSTOOL) $@ add-stage fallback/coreboot_apc fallback/coreboot_apc $(CBFS_COMPRESS_FLAG); \
|
2009-08-12 17:00:51 +02:00
|
|
|
fi
|
2009-10-28 00:14:54 +01:00
|
|
|
$(CBFSTOOL) $@ add-stage $(obj)/coreboot_ram fallback/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"
|
2009-10-28 16:30:11 +01:00
|
|
|
$(CBFSTOOL) $(obj)/coreboot.rom add-payload $(CONFIG_FALLBACK_PAYLOAD_FILE) fallback/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
|
|
|
|
|
|
|
|
|
|
|
#######################################################################
|
|
|
|
# Build the bootblock
|
|
|
|
|
2009-08-13 17:29:01 +02:00
|
|
|
$(obj)/coreboot.bootblock: $(obj)/coreboot
|
2009-10-28 18:10:51 +01:00
|
|
|
@printf " OBJCOPY $(subst $(obj)/,,$(@))\n"
|
2009-08-25 21:38:46 +02:00
|
|
|
$(OBJCOPY) -O binary $< $@
|
2009-08-12 17:00:51 +02:00
|
|
|
|
|
|
|
$(obj)/ldscript.ld: $(ldscripts) $(obj)/ldoptions
|
2009-08-25 21:38:46 +02:00
|
|
|
printf 'INCLUDE "ldoptions"\n' > $@
|
2009-11-21 20:54:02 +01:00
|
|
|
printf '$(foreach ldscript,$(ldscripts),INCLUDE "$(ldscript:$(obj)/%=%)"\n)' >> $@
|
2009-08-12 17:00:51 +02:00
|
|
|
|
|
|
|
$(obj)/crt0_includes.h: $(crt0s)
|
2009-11-21 20:54:02 +01:00
|
|
|
printf '$(foreach crt0,config.h $(crt0s),#include "$(crt0:$(obj)/%=%)"\n)' > $@
|
2009-08-12 17:00:51 +02:00
|
|
|
|
|
|
|
$(obj)/mainboard/$(MAINBOARDDIR)/crt0.o: $(obj)/mainboard/$(MAINBOARDDIR)/crt0.s
|
2009-08-25 21:38:46 +02:00
|
|
|
$(CC) -I$(obj) -Wa,-acdlns -c -o $@ $< > $(dir $@)/crt0.disasm
|
2009-08-12 17:00:51 +02:00
|
|
|
|
|
|
|
$(obj)/mainboard/$(MAINBOARDDIR)/crt0.s: $(src)/arch/i386/init/crt0.S.lb $(obj)/crt0_includes.h
|
2009-08-25 21:38:46 +02:00
|
|
|
$(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 $@
|
2009-08-12 17:00:51 +02:00
|
|
|
|
|
|
|
$(obj)/coreboot: $(initobjs) $(obj)/ldscript.ld
|
2009-10-28 18:10:51 +01:00
|
|
|
@printf " LINK $(subst $(obj)/,,$(@))\n"
|
2009-08-25 21:38:46 +02:00
|
|
|
$(CC) -nostdlib -nostartfiles -static -o $@ -L$(obj) -T $(obj)/ldscript.ld $(initobjs)
|
|
|
|
$(NM) -n $(obj)/coreboot | sort > $(obj)/coreboot.map
|
2009-08-12 17:00:51 +02:00
|
|
|
|
|
|
|
#######################################################################
|
|
|
|
# i386 specific tools
|
|
|
|
|
|
|
|
$(obj)/option_table.h $(obj)/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)
|
|
|
|
|
|
|
|
$(obj)/coreboot_ram: $(obj)/coreboot_ram.o $(src)/config/coreboot_ram.ld #ldoptions
|
2009-10-28 18:10:51 +01:00
|
|
|
@printf " CC $(subst $(obj)/,,$(@))\n"
|
2009-08-25 21:38:46 +02:00
|
|
|
$(CC) -nostdlib -nostartfiles -static -o $@ -L$(obj) -T $(src)/config/coreboot_ram.ld $(obj)/coreboot_ram.o
|
|
|
|
$(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
|
|
|
|
|
|
|
|
endif
|