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