Makefile revision 232263
1145117Sume# $FreeBSD: head/sys/boot/i386/boot0/Makefile 232263 2012-02-28 18:30:18Z dim $
2145117Sume
3145117SumePROG?=	boot0
4145117SumeSTRIP=
5145117SumeBINMODE=${NOBINMODE}
6145117SumeNO_MAN=
7145117SumeSRCS=	${PROG}.S
8145117Sume
9145117Sume# Additional options that you can specify with make OPTS="..."
10145117Sume# (these only apply to boot0.S)
11145117Sume#
12145117Sume#	-DVOLUME_SERIAL	support volume serial number (NT, XP, Vista)
13145117Sume#	-DSIO		do I/O using COM1:
14145117Sume#	-DPXE		fallback to INT18/PXE with F6
15145117Sume#	-DCHECK_DRIVE	enable checking drive number
16145117Sume#	-DONLY_F_KEYS	accept only Fx keys in console
17145117Sume#	-DTEST		print drive number on entry
18145117Sume#
19145117SumeOPTS ?= -DVOLUME_SERIAL -DPXE
20145117SumeCFLAGS += ${OPTS}
21145117Sume
22145117Sume# Flags used in the boot0.S code:
23145117Sume#   0x0f	all valid partitions enabled.
24145117Sume#   0x80	'packet', use BIOS EDD (LBA) extensions instead of CHS
25145117Sume#		to read from disk. boot0.S does not check that the extensions
26145117Sume#		are supported, but all modern BIOSes should have them.
27145117Sume#   0x40	'noupdate', disable writing boot0 back to disk so that
28145117Sume#		the current selection is not preserved across reboots.
29145117Sume#   0x20	'setdrv', override the drive number supplied by the bios
30145117Sume#		with the one in the boot sector.
31145626Sume
32145117Sume# Default boot flags:
33157779SumeBOOT_BOOT0_FLAGS?=	0x8f
34157779Sume
35157779Sume# The number of timer ticks to wait for a keypress before assuming the default
36157779Sume# selection.  Since there are 18.2 ticks per second, the default value of
37157779Sume# 0xb6 (182d) corresponds to 10 seconds.
38157779SumeBOOT_BOOT0_TICKS?=	0xb6
39157779Sume
40157779Sume# The base address that we the boot0 code to to run it.  Don't change this
41157779Sume# unless you are glutton for punishment.
42157779SumeBOOT_BOOT0_ORG?=	0x600
43157779Sume
44157779Sume# Comm settings for boot0sio.
45157779Sume# Bit(s) Description
46157779Sume# 7-5    data rate (110,150,300,600,1200,2400,4800,9600 bps)
47157779Sume# 4-3    parity (00 or 10 = none, 01 = odd, 11 = even)
48157779Sume# 2      stop bits (set = 2, clear = 1)
49157779Sume# 1-0    data bits (00 = 5, 01 = 6, 10 = 7, 11 = 8)
50157779Sume.if !defined(BOOT_BOOT0_COMCONSOLE_SPEED)
51157779SumeBOOT_COMCONSOLE_SPEED?=	9600
52157779Sume.if ${BOOT_COMCONSOLE_SPEED} == 9600
53157779SumeBOOT_BOOT0_COMCONSOLE_SPEED=	"7 << 5 + 3"
54157779Sume.elif ${BOOT_COMCONSOLE_SPEED} == 4800
55157779SumeBOOT_BOOT0_COMCONSOLE_SPEED=	"6 << 5 + 3"
56157779Sume.elif ${BOOT_COMCONSOLE_SPEED} == 2400
57157779SumeBOOT_BOOT0_COMCONSOLE_SPEED=	"5 << 5 + 3"
58157779Sume.elif ${BOOT_COMCONSOLE_SPEED} == 1200
59157779SumeBOOT_BOOT0_COMCONSOLE_SPEED=	"4 << 5 + 3"
60157779Sume.elif ${BOOT_COMCONSOLE_SPEED} == 600
61157779SumeBOOT_BOOT0_COMCONSOLE_SPEED=	"3 << 5 + 3"
62157779Sume.elif ${BOOT_COMCONSOLE_SPEED} == 300
63157779SumeBOOT_BOOT0_COMCONSOLE_SPEED=	"2 << 5 + 3"
64157779Sume.elif ${BOOT_COMCONSOLE_SPEED} == 150
65157779SumeBOOT_BOOT0_COMCONSOLE_SPEED=	"1 << 5 + 3"
66157779Sume.elif ${BOOT_COMCONSOLE_SPEED} == 110
67157779SumeBOOT_BOOT0_COMCONSOLE_SPEED=	"0 << 5 + 3"
68145626Sume.else
69145626SumeBOOT_BOOT0_COMCONSOLE_SPEED=	"7 << 5 + 3"
70145626Sume.endif
71145633Sume.endif
72145626Sume
73145117SumeCFLAGS+=-DFLAGS=${BOOT_BOOT0_FLAGS} \
74145633Sume	-DTICKS=${BOOT_BOOT0_TICKS} \
75145633Sume	-DCOMSPEED=${BOOT_BOOT0_COMCONSOLE_SPEED}
76145633Sume
77145633SumeLDFLAGS=-e start -Ttext ${BOOT_BOOT0_ORG} -Wl,-N,-S,--oformat,binary
78145633Sume
79145633Sume.include <bsd.prog.mk>
80145633Sume
81145633Sume# XXX: clang integrated-as doesn't grok .codeNN directives yet
82145633SumeCFLAGS.boot0.S=		${CLANG_NO_IAS}
83145633SumeCFLAGS.boot0ext.S=	${CLANG_NO_IAS}
84145633SumeCFLAGS+=		${CFLAGS.${.IMPSRC:T}}
85145633Sume