2009-06-29 17:37:40 +04:00
|
|
|
all: build-all
|
2009-07-31 16:18:32 +04:00
|
|
|
# Dummy command so that make thinks it has done something
|
|
|
|
@true
|
2009-06-29 17:37:40 +04:00
|
|
|
|
|
|
|
include ../../config-host.mak
|
2009-07-27 23:59:36 +04:00
|
|
|
include $(SRC_PATH)/rules.mak
|
2009-06-29 17:37:40 +04:00
|
|
|
|
2009-12-21 12:06:55 +03:00
|
|
|
$(call set-vpath, $(SRC_PATH)/pc-bios/optionrom)
|
|
|
|
|
2009-10-06 23:11:13 +04:00
|
|
|
.PHONY : all clean build-all
|
2009-06-29 17:37:40 +04:00
|
|
|
|
2016-08-09 23:50:40 +03:00
|
|
|
# Compiling with no optimization creates ROMs that are too large
|
2016-08-30 15:30:11 +03:00
|
|
|
ifeq ($(lastword $(filter -O%, -O0 $(CFLAGS))),-O0)
|
2016-08-09 23:50:40 +03:00
|
|
|
override CFLAGS += -O2
|
|
|
|
endif
|
2017-05-31 15:37:15 +03:00
|
|
|
override CFLAGS += -march=i486
|
2016-08-09 23:50:40 +03:00
|
|
|
|
2016-05-23 21:11:33 +03:00
|
|
|
# Drop -fstack-protector and the like
|
|
|
|
QEMU_CFLAGS := $(filter -W%, $(QEMU_CFLAGS)) $(CFLAGS_NOPIE) -ffreestanding
|
2016-08-08 11:57:35 +03:00
|
|
|
QEMU_CFLAGS += $(call cc-option, $(QEMU_CFLAGS), -fno-stack-protector)
|
2016-05-23 21:11:33 +03: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 22:36:49 +03:00
|
|
|
QEMU_CFLAGS += $(call cc-c-option, $(QEMU_CFLAGS), $(Wa)-32)
|
2016-05-23 21:11:33 +03:00
|
|
|
|
2019-01-18 15:01:41 +03:00
|
|
|
build-all: multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin
|
2009-06-29 17:37:40 +04:00
|
|
|
|
2012-01-30 14:27:33 +04:00
|
|
|
# suppress auto-removal of intermediate files
|
|
|
|
.SECONDARY:
|
|
|
|
|
2016-05-23 21:11:33 +03:00
|
|
|
|
2016-07-08 07:49:36 +03:00
|
|
|
%.o: %.S
|
2016-10-04 19:27:21 +03:00
|
|
|
$(call quiet-command,$(CPP) $(QEMU_INCLUDES) $(QEMU_DGFLAGS) -c -o - $< | $(AS) $(ASFLAGS) -o $@,"AS","$(TARGET_DIR)$@")
|
2016-05-23 21:11:33 +03:00
|
|
|
|
2019-01-18 15:01:41 +03: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 17:37:40 +04:00
|
|
|
%.img: %.o
|
2016-10-04 19:27:21 +03: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 17:37:40 +04:00
|
|
|
|
2009-07-11 17:48:29 +04:00
|
|
|
%.raw: %.img
|
2016-10-04 19:27:21 +03:00
|
|
|
$(call quiet-command,$(OBJCOPY) -O binary -j .text $< $@,"BUILD","$(TARGET_DIR)$@")
|
2009-07-11 17:48:29 +04:00
|
|
|
|
|
|
|
%.bin: %.raw
|
2016-10-04 19:27:21 +03:00
|
|
|
$(call quiet-command,$(PYTHON) $(SRC_PATH)/scripts/signrom.py $< $@,"SIGN","$(TARGET_DIR)$@")
|
2009-06-29 17:37:40 +04:00
|
|
|
|
|
|
|
clean:
|
2009-10-06 23:11:11 +04:00
|
|
|
rm -f *.o *.d *.raw *.img *.bin *~
|