blob: f0a1a2e43b3757c722a7c6320846c6eccf72016e (
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
|
#
# 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
CPPFLAGS += -I../../include -I../../sys
CPPFLAGS += -I$(SRC)/uts/intel/sys/acpi
CPPFLAGS += -I$(ZLIB)
LOADER= loader
NEWVERSWHAT= "ZFS enabled bootstrap loader" x86
# Set by loader Makefile
CPPFLAGS += -I$(ZFSSRC)
CPPFLAGS += -I../libi386
DPLIBI386= ../libi386/libi386.a
LIBI386= -L../libi386 -li386
ROOT_BOOT= $(ROOT)/boot
ROOTBOOTFILES=$(FILES:%=$(ROOT_BOOT)/%)
FILEMODE=0444
all: $(LOADER) loader.help
install: all $(ROOTBOOTLOADER)
PROG= $(LOADER).sym
# architecture-specific loader code
SRCS= main.c conf.c vers.c chain.c
CPPFLAGS += -DLOADER_GZIP_SUPPORT
# Enable BootForth
CPPFLAGS += -DBOOT_FORTH -I$(SRC)/common/ficl -I../../libficl
DPLIBFICL= ../../libficl/$(MACH)/libficl.a
LIBFICL= -L../../libficl/$(MACH) -lficl
# Always add MI sources
SRCS += boot.c commands.c console.c devopen.c interp.c
SRCS += interp_backslash.c interp_parse.c ls.c misc.c
SRCS += module.c linenoise.c multiboot2.c nvstore.c
SRCS += zfs_cmd.c
SRCS += font.c $(FONT).c tem.c
module.o := CPPFLAGS += -I$(CRYPTOSRC)
tem.o := CPPFLAGS += $(DEFAULT_CONSOLE_COLOR)
SRCS += load_elf32.c load_elf32_obj.c reloc_elf32.c
SRCS += load_elf64.c load_elf64_obj.c reloc_elf64.c
SRCS += dev_net.c
SRCS += disk.c part.c vdisk.c
CPPFLAGS += -DLOADER_DISK_SUPPORT
CPPFLAGS += -DLOADER_GPT_SUPPORT
CPPFLAGS += -DLOADER_MBR_SUPPORT
SRCS += bcache.c
SRCS += isapnp.c
SRCS += pnp.c
# Forth interpreter
SRCS += interp_forth.c
CPPFLAGS += -I../../common
CPPFLAGS += -I.
CLEANFILES= vers.c $(LOADER) $(LOADER).sym $(LOADER).bin loader.help
CLEANFILES += $(FONT).c
LDSCRIPT= ldscript.i386
LDFLAGS= -static -T $(LDSCRIPT) -N --gc-sections
# i386 standalone support library
CPPFLAGS += -I.. -I../../libsa
DPLIBSA= ../../libsa/$(MACH)/libsa.a
LIBSA= -L../../libsa/$(MACH) -lsa
# BTX components
CPPFLAGS += -I../btx/lib
# Debug me!
#CFLAGS+= -g
#LDFLAGS+= -g
include ../Makefile.inc
conf.o := CPPFLAGS += -I../../sys/cddl/boot/zfs
multiboot2.o := CPPFLAGS += -I../../sys/cddl/boot/zfs
main.o := CPPFLAGS += -I../../sys/cddl/boot/zfs -I$(SRC)/uts/common/fs/zfs
zfs_cmd.o := CPPFLAGS += -I../../sys/cddl/boot/zfs
# For multiboot2.h, must be last, to avoid conflicts
CPPFLAGS += -I$(SRC)/uts/common
vers.c: ../../common/newvers.sh $(SRC)/boot/Makefile.version
$(SH) ../../common/newvers.sh $(LOADER_VERSION) $(NEWVERSWHAT)
$(LOADER): $(LOADER).bin $(BTXLDR) $(BTXKERN)
$(BTXLD) -f aout -e $(LOADER_ADDRESS) -o $@ -l $(BTXLDR) \
-b $(BTXKERN) $(LOADER).bin
$(LOADER).bin: $(LOADER).sym
$(CP) $^ $@
$(GSTRIP) -R .comment -R .note $@
loader.help: ../../common/help.common help.i386
$(CAT) $^ | $(AWK) -f ../../common/merge_help.awk > $@
FILES= $(LOADER) loader.help
# XXX crt0.o needs to be first for pxeboot(8) to work
DPADD= $(DPLIBFICL) $(DPLIBI386) $(DPLIBSA)
LDADD= $(LIBFICL) $(LIBI386) $(LIBSA)
CLEANFILES += machine x86
machine:
$(RM) machine
$(SYMLINK) ../../sys/i386/include machine
x86:
$(RM) x86
$(SYMLINK) ../../sys/x86/include x86
OBJS= $(SRCS:%.c=%.o)
$(OBJS): machine x86
$(PROG): $(OBJS) $(DPADD)
$(GLD) $(LDFLAGS) -o $@ $(BTXCRT) $(OBJS) $(LDADD)
clean: clobber
clobber:
$(RM) $(CLEANFILES) $(OBJS)
install: all $(ROOTBOOTFILES)
%.o: ../../common/%.c
$(COMPILE.c) -o $@ $<
%.o: ../../common/linenoise/%.c
$(COMPILE.c) -o $@ $<
%.o: $(SRC)/common/font/%.c
$(COMPILE.c) $<
$(FONT).c: $(FONT_DIR)/$(FONT_SRC)
$(VTFONTCVT) -f compressed-source -o $@ $(FONT_DIR)/$(FONT_SRC)
$(ROOT_BOOT)/%: ../../forth/% $(ROOT_BOOT)
$(INS.file)
|