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.
17 include $(SRC
)/Makefile.master
18 include $(SRC
)/boot
/Makefile.version
21 CPPFLAGS
= -D_STANDALONE
-nostdinc
-I..
/..
/..
/..
/include -I..
/..
/..
22 CPPFLAGS
+= -I
$(SRCTOP
)/arch
/x86
/include/sys
/acpi
24 NEWVERSWHAT
= "ZFS enabled bootstrap loader" x86
26 # Set by loader Makefile
27 CPPFLAGS
+= -DLOADER_ZFS_SUPPORT
-I..
/..
/zfs
28 CPPFLAGS
+= -I..
/libi386
29 LIBZFSBOOT
= ..
/..
/zfs
/$(MACH
)/libzfsboot.a
30 LIBI386
= ..
/libi386
/libi386.a
32 LD
= $(GNU_ROOT
)/bin
/gld
33 CC
= $(GCC_ROOT
)/bin
/gcc
34 OBJCOPY
= $(GNU_ROOT
)/bin
/gobjcopy
35 GSTRIP
= $(GNU_ROOT
)/bin
/gstrip
36 ROOT_BOOT
= $(ROOT
)/boot
37 ROOT_BOOT_DEFAULTS
= $(ROOT
)/boot
/defaults
38 ROOT_BOOT_FORTH
= $(ROOT
)/boot
/forth
39 ROOT_BOOT_CONF
= $(ROOT
)/boot
/conf.d
40 ROOTBOOTFILES
=$(FILES
:%=$(ROOT_BOOT
)/%)
41 ROOTBOOTFORTH
=$(FORTH
:%=$(ROOT_BOOT_FORTH
)/%)
42 ROOTBOOTDEFAULTS
=$(DEFFILES
:%=$(ROOT_BOOT_DEFAULTS
)/%)
45 all: ${LOADER} loader.help
47 install: all $(ROOTBOOTLOADER
)
52 # architecture-specific loader code
53 SRCS
= main.c conf.c vers.c chain.c
55 CPPFLAGS
+= -DLOADER_GZIP_SUPPORT
58 CPPFLAGS
+= -DBOOT_FORTH
-I
$(SRC
)/common
/ficl
-I..
/..
/libficl
59 LIBFICL
= ..
/..
/libficl
/$(MACH
)/libficl.a
61 # Always add MI sources
62 SRCS
+= boot.c commands.c console.c devopen.c interp.c
63 SRCS
+= interp_backslash.c interp_parse.c ls.c misc.c
64 SRCS
+= module.c panic.c linenoise.c multiboot2.c
66 SRCS
+= load_elf32.c load_elf32_obj.c reloc_elf32.c
67 SRCS
+= load_elf64.c load_elf64_obj.c reloc_elf64.c
72 CPPFLAGS
+= -DLOADER_DISK_SUPPORT
74 CPPFLAGS
+= -DLOADER_GPT_SUPPORT
75 CPPFLAGS
+= -DLOADER_MBR_SUPPORT
83 SRCS
+= interp_forth.c
85 CPPFLAGS
+= -I..
/..
/common
88 CLEANFILES
= vers.c
${LOADER} ${LOADER}.sym
${LOADER}.bin loader.help
91 LDFLAGS
= -static
-Ttext
0x0
93 # i386 standalone support library
94 CPPFLAGS
+= -I..
-I..
/..
/..
/..
/lib
/libstand
95 LIBSTAND
= ..
/..
/libstand
/$(MACH
)/libstand.a
98 CPPFLAGS
+= -I..
/btx
/lib
104 include ..
/Makefile.inc
106 # For multiboot2.h, must be last, to avoid conflicts
107 CPPFLAGS
+= -I
$(SRCTOP
)/include
109 vers.c
: ..
/..
/common
/newvers.sh
$(SRC
)/boot
/Makefile.version
110 $(SH
) ..
/..
/common
/newvers.sh
${LOADER_VERSION} ${NEWVERSWHAT}
112 ${LOADER}: ${LOADER}.bin
${BTXLDR} ${BTXKERN}
113 $(BTXLD
) -f aout
-e
${LOADER_ADDRESS} -o
$@
-l
${BTXLDR} \
114 -b
${BTXKERN} ${LOADER}.bin
116 ${LOADER}.bin
: ${LOADER}.sym
118 $(GSTRIP
) -R .comment
-R .note
$@
120 loader.help
: ..
/..
/common
/help.common help.i386
121 $(CAT
) $^ |
$(AWK
) -f ..
/..
/common
/merge_help.awk
> $@
123 FILES
= ${LOADER} loader.help
125 include ..
/..
/forth
/Makefile.inc
131 # XXX crt0.o needs to be first for pxeboot(8) to work
133 DPADD
= ${LIBFICL} ${LIBZFSBOOT} ${LIBI386} ${LIBSTAND}
134 LDADD
= ${LIBFICL} ${LIBZFSBOOT} ${LIBI386} ${LIBSTAND}
136 CLEANFILES
+= machine x86
140 $(SYMLINK
) ..
/..
/..
/i386
/include machine
144 $(SYMLINK
) ..
/..
/..
/x86
/include x86
146 OBJS
= $(SRCS
:%.c
=%.o
)
150 ${PROG}: ${OBJS} $(LDADD
)
151 $(LD
) $(LDFLAGS
) -o
$@
$(BTXCRT
) $(OBJS
) $(LDADD
)
155 $(RM
) $(CLEANFILES
) $(OBJS
)
157 install: all $(ROOT_BOOT_DEFAULTS
) $(ROOT_BOOT_FORTH
) \
158 $(ROOTBOOTFILES
) $(ROOTBOOTDEFAULTS
) $(ROOT_BOOT_CONF
) $(ROOTBOOTFORTH
)
160 %.o
: ..
/..
/common
/%.c
161 $(COMPILE.c
) -o
$@
$<
163 %.o
: ..
/..
/common
/linenoise
/%.c
164 $(COMPILE.c
) -o
$@
$<
166 $(ROOT_BOOT
)/%: ..
/..
/forth
/%
169 $(ROOT_BOOT_DEFAULTS
)/%: ..
/..
/forth
/%
172 $(ROOT_BOOT_FORTH
)/%: ..
/..
/forth
/%
175 $(ROOT_BOOT_DEFAULTS
) $(ROOT_BOOT_CONF
) $(ROOT_BOOT_FORTH
):