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
+= -DEFI_UFS_BOOT
-DUFS1_ONLY
44 # CPPFLAGS += -DEFI_DEBUG
46 CPPFLAGS
+= -I.
/..
/..
/zfs
/
47 CPPFLAGS
+= -I.
/..
/..
/..
/cddl
/boot
/zfs
/
48 CPPFLAGS
+= -DEFI_ZFS_BOOT
50 # Always add MI sources and REGULAR efi loader bits
51 CPPFLAGS
+= -I.
/..
/..
/common
53 include ..
/Makefile.inc
57 ROOT_BOOT
= $(ROOT
)/boot
58 ROOTBOOTFILES
=$(FILES
:%=$(ROOT_BOOT
)/%)
60 LDSCRIPT
= .
/..
/loader
/arch
/${MACHINE}/ldscript.
${MACHINE}
61 LDFLAGS
= -nostdlib
--eh-frame-hdr
-znocombreloc
62 LDFLAGS
+= -shared
--hash-style
=both
--enable-new-dtags
63 LDFLAGS
+= -T
${LDSCRIPT} -Bsymbolic
67 install: all $(ROOTBOOTFILES
)
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
= ${LIBSTAND} ${LIBZFSBOOT}
77 LDADD
= -L..
/..
/zfs
/$(MACH64
) -lzfsboot
-L..
/..
/libstand
/$(MACH64
) -lstand
81 EFI_TARGET
= pei-x86-64
84 if
[ `${OBJDUMP} -t ${PROG} | fgrep '*UND*' | wc -l` != 0 ]; then \
85 ${OBJDUMP} -t
${PROG} | fgrep
'*UND*'; \
88 ${OBJCOPY} --readonly-text
-j .peheader
-j .text
-j .sdata
-j .data \
89 -j .dynamic
-j .dynsym
-j .rel.dyn \
90 -j .rela.dyn
-j .reloc
-j .eh_frame \
91 --output-target
=${EFI_TARGET} --subsystem efi-app
${PROG} $@
93 boot1.o
: .
/..
/..
/common
/ufsread.c
95 CLEANFILES
= boot1.efi
${PROG}
97 ${PROG}: $(OBJS
) $(DPADD
)
98 $(LD
) $(LDFLAGS
) -o
$@
$(OBJS
) $(LDADD
)
100 CLEANFILES
+= machine x86
104 $(SYMLINK
) .
/..
/..
/..
/${MACHINE}/include machine
108 $(SYMLINK
) .
/..
/..
/..
/x86
/include x86
113 $(RM
) $(CLEANFILES
) $(OBJS
)
115 %.o
: ..
/loader
/arch
/${MACHINE}/%.S
121 %.o
: ..
/..
/common
/%.c