1 #
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.
6 #
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.
10 #
11
12 #
13 # Copyright 2015 Toomas Soome <tsoome@me.com>
14 #
15
16 include $(SRC)/Makefile.master
17
18 ROOT_BOOT = $(ROOT)/boot
19
20 CC= $(GCC_ROOT)/bin/gcc
21 LD= $(GNU_ROOT)/bin/gld
22 DD= /usr/bin/dd
23 CFLAGS= -O2 -I../../..
24 CCASFLAGS= -Wa,--divide
25
26 include ../Makefile.inc
27
28 BTXDIR=../btx
29
30 PROG= ${LDR}
31 INTERNALPROG=
32 FILES= ${BOOT}
33 MAN= ${BOOT}.8
34 SRCS= ${LDR}.S
35 OBJS= ${LDR}.o
36 CLEANFILES= ${BOOT} ${OBJS}
37
38 BOOT= pxeboot
39 LDR= pxeldr
40 ORG= 0x7c00
41 LOADER= loader
42 FILEMODE=0444
43
44 #CFLAGS += -DPROBE_KEYBOARD
45
46 #.if defined(BOOT_PXELDR_ALWAYS_SERIAL)
47 #CFLAGS+=-DALWAYS_SERIAL
48 #.endif
49
50 CFLAGS +=-I../common
51
52 LOADERBIN= ../loader/zfsloader.bin
53
54 CLEANFILES += ${BOOT}.tmp
55
56 ${BOOT}: ${LDR} ${LOADER}
57 $(CAT) ${LDR} ${LOADER} > $@.tmp
58 $(DD) if=$@.tmp of=$@ obs=2k conv=sync
59 $(RM) $@.tmp
60
61 LDFLAGS +=-e start -Ttext ${ORG} -N -S --oformat binary
62
63 CLEANFILES += ${LOADER} ${LDR}
64
65 ${LDR}: ${OBJS}
66 ${LD} ${LDFLAGS} -o $@ $^
67
68 ${LOADER}: ${LOADERBIN} ${BTXLDR} ${BTXKERN}
69 $(BTXLD) -f aout -e ${LOADER_ADDRESS} -o $@ -l ${BTXLDR} \
70 -b ${BTXKERN} ${LOADERBIN}
71
72 all: ${BOOT}
73
74 install: $(BOOT:%=$(ROOT_BOOT)/%)
75
76 clobber: clean
77 clean:
78 $(RM) $(CLEANFILES)
79
80 .S.o:
81 $(CC) $(CFLAGS) $(CCASFLAGS) -c -o $@ $<
82
83 $(ROOT_BOOT)/%: %
84 $(INS.file)