2 # This file and its contents are supplied under the terms of the
3 # Common Development and Distribution License ("CDDL"), version 1.0.
4 # You may only use this file in accordance with the terms of version
7 # A full copy of the text of the CDDL should have accompanied this
8 # source. A copy of the CDDL is also available via the Internet at
9 # http://www.illumos.org/license/CDDL.
13 # Copyright 2015 Toomas Soome <tsoome@me.com>
14 # Copyright 2016 RackTop Systems.
19 include $(SRC
)/Makefile.master
20 include $(SRC
)/boot
/Makefile.version
22 AS
= $(GNU_ROOT
)/bin
/gas
23 LD
= $(GNU_ROOT
)/bin
/gld
24 CC
= $(GNUC_ROOT
)/bin
/gcc
25 OBJCOPY
= $(GNU_ROOT
)/bin
/gobjcopy
31 BOOT_COMCONSOLE_PORT
= 0x3f8
32 BOOT_COMCONSOLE_SPEED
= 9600
40 CFLAGS
= -nostdinc
-DBOOTPROG
=\"gptzfsboot
\" \
43 -DLOADER_MBR_SUPPORT
-DLOADER_GPT_SUPPORT \
44 -DSIOPRT
=${BOOT_COMCONSOLE_PORT} \
45 -DSIOFMT
=${B2SIOFMT} \
46 -DSIOSPD
=${BOOT_COMCONSOLE_SPEED} \
47 -I..
/..
/..
/..
/include \
48 -I..
/..
/..
/..
/lib
/libstand \
49 -I..
/..
/..
/..
/lib
/libz \
53 -I..
/..
/..
/cddl
/boot
/zfs \
57 -Wall
-Waggregate-return
-Wbad-function-cast
-Wcast-align \
58 -Wmissing-declarations
-Wmissing-prototypes
-Wnested-externs \
59 -Wpointer-arith
-Wshadow
-Wwrite-strings \
60 -Winline
-Wno-unknown-pragmas
62 CFLAGS
+= --param max-inline-insns-single
=100
63 CFLAGS
+= -fno-reorder-functions
65 LD_FLAGS
=-static
-N
--gc-sections
66 CCASFLAGS
=-Wa
,--divide
67 LIBSTAND
= ..
/..
/libstand
/$(MACH
)/libstand.a
68 LIBZFSBOOT
= ..
/..
/zfs
/$(MACH
)/libzfsboot.a
70 include ..
/Makefile.inc
76 install: all $(ROOTBOOTPROG
)
78 OBJS
= multiboot.o zfsboot.o sio.o cons.o panic.o devopen.o \
79 part.o biosmem.o smbios.o biosdisk.o devicename.o disk.o bcache.o \
82 smbios.o
:= CPPFLAGS
+= -DSMBIOS_SERIAL_NUMBERS
83 smbios.o
:= CPPFLAGS
+= -DSMBIOS_LITTLE_ENDIAN_UUID
85 CLEANFILES
= gptzfsboot
$(OBJS
)
87 gptzfsboot
: gptldr.bin gptzfsboot.bin
${BTXKERN}
88 $(BTXLD
) -E
${ORG2} -f bin
-b
${BTXKERN} -V
${BOOT_VERSION} -l \
89 gptldr.bin
-o
$@ gptzfsboot.bin
91 CLEANFILES
+= gptldr.bin gptldr.out gptldr.o
93 gptldr.bin
: gptldr.out
94 ${OBJCOPY} -S
-O binary gptldr.out
$@
97 ${LD} ${LD_FLAGS} -e start
-Ttext
${ORG1} -o
$@ gptldr.o
99 CLEANFILES
+= gptzfsboot.bin gptzfsboot.out
101 gptzfsboot.bin
: gptzfsboot.out
102 ${OBJCOPY} -S
-O binary gptzfsboot.out
$@
104 gptzfsboot.out
: ${BTXCRT} ${OBJS} ${LIBZFSBOOT} ${LIBSTAND}
105 ${LD} ${LD_FLAGS} -Ttext
${ORG2} -o
$@
${BTXCRT} ${OBJS} \
106 ${LIBZFSBOOT} ${LIBSTAND}
110 $(SYMLINK
) ..
/..
/..
/i386
/include machine
114 $(SYMLINK
) ..
/..
/..
/x86
/include x86
119 $(COMPILE.c
) -o
$@
$<
121 %.o
: ..
/..
/common
/%.c
122 $(COMPILE.c
) -o
$@
$<
124 biosdisk.o
: ..
/libi386
/biosdisk.c
125 $(CC
) $(CFLAGS
) $(CPPFLAGS
) -Dalloca
=__builtin_alloca
-c
-o
$@ ..
/libi386
/$*.c
127 biosmem.o
: ..
/libi386
/biosmem.c
128 $(CC
) $(CFLAGS
) $(CPPFLAGS
) -c
-o
$@ ..
/libi386
/$*.c
130 smbios.o
: ..
/libi386
/smbios.c
131 $(CC
) $(CFLAGS
) $(CPPFLAGS
) -c
-o
$@ ..
/libi386
/$*.c
133 devicename.o
: ..
/libi386
/devicename.c
134 $(CC
) $(CFLAGS
) $(CPPFLAGS
) -c
-o
$@ ..
/libi386
/$*.c
136 time.o
: ..
/libi386
/time.c
137 $(CC
) $(CFLAGS
) $(CPPFLAGS
) -c
-o
$@ ..
/libi386
/$*.c
139 multiboot.o
: ..
/..
/common
/multiboot.S
140 $(CC
) $(CFLAGS
) $(CCASFLAGS
) -c
-o
$@ ..
/..
/common
/$*.S
143 $(CC
) $(CFLAGS
) $(CCASFLAGS
) -c
-o
$@
$<
148 $(RM
) $(CLEANFILES
) machine x86