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 \
52 -I..
/..
/..
/cddl
/boot
/zfs \
56 -Wall
-Waggregate-return
-Wbad-function-cast
-Wcast-align \
57 -Wmissing-declarations
-Wmissing-prototypes
-Wnested-externs \
58 -Wpointer-arith
-Wshadow
-Wwrite-strings \
59 -Winline
-Wno-unknown-pragmas
61 CFLAGS
+= --param max-inline-insns-single
=100
62 CFLAGS
+= -fno-reorder-functions
64 LD_FLAGS
=-static
-N
--gc-sections
65 CCASFLAGS
=-Wa
,--divide
66 LIBSTAND
= ..
/..
/libstand
/$(MACH
)/libstand.a
67 LIBZFSBOOT
= ..
/..
/zfs
/$(MACH
)/libzfsboot.a
69 include ..
/Makefile.inc
75 install: all $(ROOTBOOTPROG
)
77 OBJS
= multiboot.o zfsboot.o sio.o cons.o panic.o devopen.o \
78 part.o biosmem.o smbios.o biosdisk.o devicename.o disk.o bcache.o \
81 CLEANFILES
= gptzfsboot
$(OBJS
)
83 gptzfsboot
: gptldr.bin gptzfsboot.bin
${BTXKERN}
84 $(BTXLD
) -E
${ORG2} -f bin
-b
${BTXKERN} -V
${BOOT_VERSION} -l \
85 gptldr.bin
-o
$@ gptzfsboot.bin
87 CLEANFILES
+= gptldr.bin gptldr.out gptldr.o
89 gptldr.bin
: gptldr.out
90 ${OBJCOPY} -S
-O binary gptldr.out
$@
93 ${LD} ${LD_FLAGS} -e start
-Ttext
${ORG1} -o
$@ gptldr.o
95 CLEANFILES
+= gptzfsboot.bin gptzfsboot.out
97 gptzfsboot.bin
: gptzfsboot.out
98 ${OBJCOPY} -S
-O binary gptzfsboot.out
$@
100 gptzfsboot.out
: ${BTXCRT} ${OBJS} ${LIBZFSBOOT} ${LIBSTAND}
101 ${LD} ${LD_FLAGS} -Ttext
${ORG2} -o
$@
${BTXCRT} ${OBJS} \
102 ${LIBZFSBOOT} ${LIBSTAND}
106 $(SYMLINK
) ..
/..
/..
/i386
/include machine
110 $(SYMLINK
) ..
/..
/..
/x86
/include x86
115 $(COMPILE.c
) -o
$@
$<
117 %.o
: ..
/..
/common
/%.c
118 $(COMPILE.c
) -o
$@
$<
120 biosdisk.o
: ..
/libi386
/biosdisk.c
121 $(CC
) $(CFLAGS
) $(CPPFLAGS
) -Dalloca
=__builtin_alloca
-c
-o
$@ ..
/libi386
/$*.c
123 biosmem.o
: ..
/libi386
/biosmem.c
124 $(CC
) $(CFLAGS
) $(CPPFLAGS
) -c
-o
$@ ..
/libi386
/$*.c
126 smbios.o
: ..
/libi386
/smbios.c
127 $(CC
) $(CFLAGS
) $(CPPFLAGS
) \
128 -DSMBIOS_SERIAL_NUMBERS
-DSMBIOS_LITTLE_ENDIAN_UUID \
129 -c
-o
$@ ..
/libi386
/$*.c
131 devicename.o
: ..
/libi386
/devicename.c
132 $(CC
) $(CFLAGS
) $(CPPFLAGS
) -c
-o
$@ ..
/libi386
/$*.c
134 time.o
: ..
/libi386
/time.c
135 $(CC
) $(CFLAGS
) $(CPPFLAGS
) -c
-o
$@ ..
/libi386
/$*.c
137 multiboot.o
: ..
/..
/common
/multiboot.S
138 $(CC
) $(CFLAGS
) $(CCASFLAGS
) -c
-o
$@ ..
/..
/common
/$*.S
141 $(CC
) $(CFLAGS
) $(CCASFLAGS
) -c
-o
$@
$<
146 $(RM
) $(CLEANFILES
) machine x86