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