blob: ad97283ca48c5e9fd6340601901f83745a3cdcc2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# Copyright 2015 Toomas Soome <tsoome@me.com>
# Copyright 2016 RackTop Systems.
#
#
include $(SRC)/Makefile.master
include $(SRC)/boot/Makefile.version
include $(SRC)/boot/Makefile.inc
PROG= gptzfsboot
MAN= gptzfsboot.8
FILEMODE=0444
BOOT_COMCONSOLE_PORT= 0x3f8
BOOT_COMCONSOLE_SPEED= 9600
B2SIOFMT= 0x3
REL1= 0x700
ORG1= 0x7c00
ORG2= 0x0
CPPFLAGS += -DBOOTPROG=\"gptzfsboot\" \
-DGPT -DBOOT2 \
-DLOADER_MBR_SUPPORT -DLOADER_GPT_SUPPORT \
-DSIOPRT=$(BOOT_COMCONSOLE_PORT) \
-DSIOFMT=$(B2SIOFMT) \
-DSIOSPD=$(BOOT_COMCONSOLE_SPEED) \
-I../../include \
-I../../libsa \
-I../../common \
-I../common \
-I$(ZFSSRC) \
-I../../sys/cddl/boot/zfs \
-I../btx/lib -I. \
-I../../sys \
-I../libi386
LDSCRIPT= ../boot.ldscript
LD_FLAGS= -static -N --gc-sections
LIBI386= -L ../libi386 -li386
LIBSTAND= -L ../../libsa/$(MACH) -lsa
LIBS= $(LIBI386) $(LIBSTAND)
DPADD= ../libi386/libi386.a ../../libsa/$(MACH)/libsa.a
include ../Makefile.inc
.PARALLEL:
all: $(PROG)
install: all $(ROOTBOOTPROG)
OBJS = mb_header.o zfsboot.o sio.o cons.o devopen.o \
part.o disk.o bcache.o zfs_cmd.o
zfsboot.o := CPPFLAGS += -I$(SRC)/uts/common -I$(SRC)/uts/common/fs/zfs
zfs_cmd.o := CPPFLAGS += -I$(SRC)/uts/common
part.o := CPPFLAGS += -I$(ZLIB)
smbios.o := CPPFLAGS += -DSMBIOS_SERIAL_NUMBERS
smbios.o := CPPFLAGS += -DSMBIOS_LITTLE_ENDIAN_UUID
gptldr.out := LD_FLAGS += $(GLDTARGET)
CLEANFILES= gptzfsboot $(OBJS)
gptzfsboot: gptldr.bin gptzfsboot.bin $(BTXKERN)
$(BTXLD) -E $(ORG2) -f bin -b $(BTXKERN) -V $(BOOT_VERSION) -l \
gptldr.bin -o $@ gptzfsboot.bin
CLEANFILES += gptldr.bin gptldr.out gptldr.o
gptldr.bin: gptldr.out
$(OBJCOPY) -S -O binary gptldr.out $@
gptldr.out: gptldr.o
$(GLD) $(LD_FLAGS) -e start -Ttext $(ORG1) -o $@ gptldr.o
CLEANFILES += gptzfsboot.bin gptzfsboot.out
gptzfsboot.bin: gptzfsboot.out
$(OBJCOPY) -S -O binary gptzfsboot.out $@
gptzfsboot.out: $(BTXCRT) $(OBJS) $(DPADD)
$(GLD) $(LD_FLAGS) -T $(LDSCRIPT) -o $@ $(BTXCRT) $(OBJS) $(LIBS)
machine:
$(RM) machine
$(SYMLINK) ../../sys/i386/include machine
x86:
$(RM) x86
$(SYMLINK) ../../sys/x86/include x86
$(OBJS): machine x86
%.o: ../common/%.c
$(COMPILE.c) $<
%.o: ../../common/%.c
$(COMPILE.c) $<
%.o: ../../common/%.S
$(COMPILE.S) $<
clobber: clean
clean:
$(RM) $(CLEANFILES) machine x86
|