2009-06-29 15:37:40 +02:00
|
|
|
all: build-all
|
2009-07-31 14:18:32 +02:00
|
|
|
# Dummy command so that make thinks it has done something
|
|
|
|
@true
|
2009-06-29 15:37:40 +02:00
|
|
|
|
|
|
|
include ../../config-host.mak
|
2009-07-27 21:59:36 +02:00
|
|
|
include $(SRC_PATH)/rules.mak
|
2009-06-29 15:37:40 +02:00
|
|
|
|
2009-12-21 10:06:55 +01:00
|
|
|
$(call set-vpath, $(SRC_PATH)/pc-bios/optionrom)
|
|
|
|
|
2009-10-06 21:11:13 +02:00
|
|
|
.PHONY : all clean build-all
|
2009-06-29 15:37:40 +02:00
|
|
|
|
2016-08-09 22:50:40 +02:00
|
|
|
# Compiling with no optimization creates ROMs that are too large
|
2016-08-30 14:30:11 +02:00
|
|
|
ifeq ($(lastword $(filter -O%, -O0 $(CFLAGS))),-O0)
|
2016-08-09 22:50:40 +02:00
|
|
|
override CFLAGS += -O2
|
|
|
|
endif
|
2017-05-31 14:37:15 +02:00
|
|
|
override CFLAGS += -march=i486
|
2016-08-09 22:50:40 +02:00
|
|
|
|
2016-05-23 20:11:33 +02:00
|
|
|
# Drop -fstack-protector and the like
|
|
|
|
QEMU_CFLAGS := $(filter -W%, $(QEMU_CFLAGS)) $(CFLAGS_NOPIE) -ffreestanding
|
2016-08-08 10:57:35 +02:00
|
|
|
QEMU_CFLAGS += $(call cc-option, $(QEMU_CFLAGS), -fno-stack-protector)
|
2016-05-23 20:11:33 +02:00
|
|
|
QEMU_CFLAGS += $(call cc-option, $(QEMU_CFLAGS), -m16)
|
|
|
|
ifeq ($(filter -m16, $(QEMU_CFLAGS)),)
|
|
|
|
# Attempt to work around compilers that lack -m16 (GCC <= 4.8, clang <= ??)
|
|
|
|
# On GCC we add -fno-toplevel-reorder to keep the order of asm blocks with
|
|
|
|
# respect to the rest of the code. clang does not have -fno-toplevel-reorder,
|
|
|
|
# but it places all asm blocks at the beginning and we're relying on it for
|
|
|
|
# the option ROM header. So just force clang not to use the integrated
|
|
|
|
# assembler, which doesn't support .code16gcc.
|
|
|
|
QEMU_CFLAGS += $(call cc-option, $(QEMU_CFLAGS), -fno-toplevel-reorder)
|
|
|
|
QEMU_CFLAGS += $(call cc-option, $(QEMU_CFLAGS), -no-integrated-as)
|
|
|
|
QEMU_CFLAGS += -m32 -include $(SRC_PATH)/pc-bios/optionrom/code16gcc.h
|
|
|
|
endif
|
|
|
|
|
|
|
|
QEMU_INCLUDES += -I$(SRC_PATH)
|
|
|
|
|
|
|
|
Wa = -Wa,
|
|
|
|
ASFLAGS += -32
|
2016-07-20 21:36:49 +02:00
|
|
|
QEMU_CFLAGS += $(call cc-c-option, $(QEMU_CFLAGS), $(Wa)-32)
|
2016-05-23 20:11:33 +02:00
|
|
|
|
2019-01-18 13:01:41 +01:00
|
|
|
build-all: multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin
|
2009-06-29 15:37:40 +02:00
|
|
|
|
2012-01-30 11:27:33 +01:00
|
|
|
# suppress auto-removal of intermediate files
|
|
|
|
.SECONDARY:
|
|
|
|
|
2016-05-23 20:11:33 +02:00
|
|
|
|
2016-07-08 06:49:36 +02:00
|
|
|
%.o: %.S
|
2016-10-04 18:27:21 +02:00
|
|
|
$(call quiet-command,$(CPP) $(QEMU_INCLUDES) $(QEMU_DGFLAGS) -c -o - $< | $(AS) $(ASFLAGS) -o $@,"AS","$(TARGET_DIR)$@")
|
2016-05-23 20:11:33 +02:00
|
|
|
|
2019-01-18 13:01:41 +01:00
|
|
|
pvh.img: pvh.o pvh_main.o
|
|
|
|
$(call quiet-command,$(LD) $(LDFLAGS_NOPIE) -m $(LD_I386_EMULATION) -T $(SRC_PATH)/pc-bios/optionrom/flat.lds -s -o $@ $^,"BUILD","$(TARGET_DIR)$@")
|
|
|
|
|
2009-06-29 15:37:40 +02:00
|
|
|
%.img: %.o
|
2016-10-04 18:27:21 +02:00
|
|
|
$(call quiet-command,$(LD) $(LDFLAGS_NOPIE) -m $(LD_I386_EMULATION) -T $(SRC_PATH)/pc-bios/optionrom/flat.lds -s -o $@ $<,"BUILD","$(TARGET_DIR)$@")
|
2009-06-29 15:37:40 +02:00
|
|
|
|
2009-07-11 15:48:29 +02:00
|
|
|
%.raw: %.img
|
2016-10-04 18:27:21 +02:00
|
|
|
$(call quiet-command,$(OBJCOPY) -O binary -j .text $< $@,"BUILD","$(TARGET_DIR)$@")
|
2009-07-11 15:48:29 +02:00
|
|
|
|
|
|
|
%.bin: %.raw
|
2016-10-04 18:27:21 +02:00
|
|
|
$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/signrom.py $< $@,"SIGN","$(TARGET_DIR)$@")
|
2009-06-29 15:37:40 +02:00
|
|
|
|
|
|
|
clean:
|
2009-10-06 21:11:11 +02:00
|
|
|
rm -f *.o *.d *.raw *.img *.bin *~
|