9664 loader: need UEFI32 support
[unleashed.git] / usr / src / boot / sys / boot / i386 / gptzfsboot / Makefile
blob892a9d7a81335a423a1d7d31cef99119be0ab282
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
5 # 1.0 of the CDDL.
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.
19 include $(SRC)/Makefile.master
20 include $(SRC)/boot/Makefile.version
22 AS= $(GNU_ROOT)/bin/gas
23 LD= $(GNU_ROOT)/bin/gld
24 CC= $(GNUC_ROOT)/bin/gcc
25 OBJCOPY= $(GNU_ROOT)/bin/gobjcopy
27 PROG= gptzfsboot
28 MAN= gptzfsboot.8
29 FILEMODE=0444
31 BOOT_COMCONSOLE_PORT= 0x3f8
32 BOOT_COMCONSOLE_SPEED= 9600
33 B2SIOFMT= 0x3
35 REL1= 0x700
36 ORG1= 0x7c00
37 ORG2= 0x0
39 CPPFLAGS=
40 CFLAGS= -nostdinc -DBOOTPROG=\"gptzfsboot\" \
41 -O1 \
42 -DGPT -DBOOT2 \
43 -DLOADER_MBR_SUPPORT -DLOADER_GPT_SUPPORT \
44 -DSIOPRT=${BOOT_COMCONSOLE_PORT} \
45 -DSIOFMT=${B2SIOFMT} \
46 -DSIOSPD=${BOOT_COMCONSOLE_SPEED} \
47 -I../../../../include \
48 -I../../../../lib/libstand \
49 -I../../common \
50 -I../common \
51 -I../../zfs \
52 -I../../../cddl/boot/zfs \
53 -I../btx/lib -I. \
54 -I../../.. \
55 -I../libi386 \
56 -Wall -Waggregate-return -Wbad-function-cast -Wcast-align \
57 -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
58 -Wpointer-arith -Wshadow -Wwrite-strings \
59 -Winline -Wno-unknown-pragmas
61 CFLAGS += --param max-inline-insns-single=100
62 CFLAGS += -fno-reorder-functions
64 LD_FLAGS=-static -N --gc-sections
65 CCASFLAGS=-Wa,--divide
66 LIBSTAND= ../../libstand/$(MACH)/libstand.a
67 LIBZFSBOOT= ../../zfs/$(MACH)/libzfsboot.a
69 include ../Makefile.inc
71 .PARALLEL:
73 all: $(PROG)
75 install: all $(ROOTBOOTPROG)
77 OBJS = multiboot.o zfsboot.o sio.o cons.o panic.o devopen.o \
78 part.o biosmem.o smbios.o biosdisk.o devicename.o disk.o bcache.o \
79 time.o crc32.o
81 CLEANFILES= gptzfsboot $(OBJS)
83 gptzfsboot: gptldr.bin gptzfsboot.bin ${BTXKERN}
84 $(BTXLD) -E ${ORG2} -f bin -b ${BTXKERN} -V ${BOOT_VERSION} -l \
85 gptldr.bin -o $@ gptzfsboot.bin
87 CLEANFILES += gptldr.bin gptldr.out gptldr.o
89 gptldr.bin: gptldr.out
90 ${OBJCOPY} -S -O binary gptldr.out $@
92 gptldr.out: gptldr.o
93 ${LD} ${LD_FLAGS} -e start -Ttext ${ORG1} -o $@ gptldr.o
95 CLEANFILES += gptzfsboot.bin gptzfsboot.out
97 gptzfsboot.bin: gptzfsboot.out
98 ${OBJCOPY} -S -O binary gptzfsboot.out $@
100 gptzfsboot.out: ${BTXCRT} ${OBJS} ${LIBZFSBOOT} ${LIBSTAND}
101 ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o $@ ${BTXCRT} ${OBJS} \
102 ${LIBZFSBOOT} ${LIBSTAND}
104 machine:
105 $(RM) machine
106 $(SYMLINK) ../../../i386/include machine
108 x86:
109 $(RM) x86
110 $(SYMLINK) ../../../x86/include x86
112 $(OBJS): machine x86
114 %.o: ../common/%.c
115 $(COMPILE.c) -o $@ $<
117 %.o: ../../common/%.c
118 $(COMPILE.c) -o $@ $<
120 biosdisk.o: ../libi386/biosdisk.c
121 $(CC) $(CFLAGS) $(CPPFLAGS) -Dalloca=__builtin_alloca -c -o $@ ../libi386/$*.c
123 biosmem.o: ../libi386/biosmem.c
124 $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ ../libi386/$*.c
126 smbios.o: ../libi386/smbios.c
127 $(CC) $(CFLAGS) $(CPPFLAGS) \
128 -DSMBIOS_SERIAL_NUMBERS -DSMBIOS_LITTLE_ENDIAN_UUID \
129 -c -o $@ ../libi386/$*.c
131 devicename.o: ../libi386/devicename.c
132 $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ ../libi386/$*.c
134 time.o: ../libi386/time.c
135 $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ ../libi386/$*.c
137 multiboot.o: ../../common/multiboot.S
138 $(CC) $(CFLAGS) $(CCASFLAGS) -c -o $@ ../../common/$*.S
140 .S.o:
141 $(CC) $(CFLAGS) $(CCASFLAGS) -c -o $@ $<
143 clobber: clean
145 clean:
146 $(RM) $(CLEANFILES) machine x86