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 2016 Toomas Soome <tsoome@me.com>
14 # Copyright 2016 RackTop Systems.
17 include $(SRC
)/Makefile.master
18 include $(SRC
)/boot
/Makefile.version
20 CC
= $(GCC_ROOT
)/bin
/gcc
21 LD
= $(GNU_ROOT
)/bin
/gld
22 OBJCOPY
= $(GNU_ROOT
)/bin
/gobjcopy
23 OBJDUMP
= $(GNU_ROOT
)/bin
/gobjdump
28 # architecture-specific loader code
29 SRCS
= boot1.c self_reloc.c start.S ufs_module.c zfs_module.c devopen.c
30 OBJS
= boot1.o self_reloc.o start.o ufs_module.o zfs_module.o devopen.o
36 CPPFLAGS
+= -I.
/..
/include
37 CPPFLAGS
+= -I.
/..
/include/${MACHINE}
38 CPPFLAGS
+= -I
$(SRCTOP
)/arch
/x86
/include/sys
/acpi
39 CPPFLAGS
+= -I.
/..
/..
/..
/..
/include
40 CPPFLAGS
+= -I.
/..
/..
/..
/sys
41 CPPFLAGS
+= -I.
/..
/..
/..
42 CPPFLAGS
+= -I..
/..
/..
/..
/lib
/libstand
43 CPPFLAGS
+= -DUFS1_ONLY
44 # CPPFLAGS += -DEFI_DEBUG
46 CPPFLAGS
+= -I.
/..
/..
/zfs
/
47 CPPFLAGS
+= -I.
/..
/..
/..
/cddl
/boot
/zfs
/
49 # Always add MI sources and REGULAR efi loader bits
50 CPPFLAGS
+= -I.
/..
/..
/common
52 include ..
/Makefile.inc
56 ROOT_BOOT
= $(ROOT
)/boot
57 ROOTBOOTFILES
=$(FILES
:%=$(ROOT_BOOT
)/%)
59 LDSCRIPT
= .
/..
/loader
/arch
/${MACHINE}/ldscript.
${MACHINE}
60 LDFLAGS
= -nostdlib
--eh-frame-hdr
-znocombreloc
61 LDFLAGS
+= -shared
--hash-style
=both
--enable-new-dtags
62 LDFLAGS
+= -T
${LDSCRIPT} -Bsymbolic
66 install: all $(ROOTBOOTFILES
)
68 LIBEFI
= ..
/libefi
/libefi.a
70 # Add libstand for the runtime functions used by the compiler - for example
71 # __aeabi_* (arm) or __divdi3 (i386).
72 # as well as required string and memory functions for all platforms.
74 LIBSTAND
= ..
/..
/libstand
/$(MACH64
)/libstand.a
75 LIBZFSBOOT
= ..
/..
/zfs
/$(MACH64
)/libzfsboot.a
76 DPADD
= $(LIBEFI
) $(LIBZFSBOOT
) $(LIBSTAND
)
77 LDADD
= -L..
/libefi
-lefi
78 LDADD
+= -L..
/..
/zfs
/$(MACH64
) -lzfsboot
79 LDADD
+= -L..
/..
/libstand
/$(MACH64
) -lstand
83 EFI_TARGET
= pei-x86-64
86 if
[ `${OBJDUMP} -t ${PROG} | fgrep '*UND*' | wc -l` != 0 ]; then \
87 ${OBJDUMP} -t
${PROG} | fgrep
'*UND*'; \
90 ${OBJCOPY} --readonly-text
-j .peheader
-j .text
-j .sdata
-j .data \
91 -j .dynamic
-j .dynsym
-j .rel.dyn \
92 -j .rela.dyn
-j .reloc
-j .eh_frame \
93 --output-target
=${EFI_TARGET} --subsystem efi-app
${PROG} $@
95 boot1.o
: .
/..
/..
/common
/ufsread.c
97 CLEANFILES
= boot1.efi
${PROG}
99 ${PROG}: $(OBJS
) $(DPADD
)
100 $(LD
) $(LDFLAGS
) -o
$@
$(OBJS
) $(LDADD
)
102 CLEANFILES
+= machine x86
106 $(SYMLINK
) .
/..
/..
/..
/${MACHINE}/include machine
110 $(SYMLINK
) .
/..
/..
/..
/x86
/include x86
115 $(RM
) $(CLEANFILES
) $(OBJS
)
117 %.o
: ..
/loader
/arch
/${MACHINE}/%.S
123 %.o
: ..
/..
/common
/%.c