xref: /freebsd/stand/i386/boot0/Makefile (revision 7ed3228323ef4f9e3130603ea68c3be9c2ed50ce)
1ca987d46SWarner Losh# $FreeBSD$
2ca987d46SWarner Losh
3ca987d46SWarner LoshPROG?=	boot0
4ca987d46SWarner LoshSTRIP=
5ca987d46SWarner LoshBINMODE=${NOBINMODE}
6ca987d46SWarner LoshSRCS=	${PROG}.S
7ca987d46SWarner Losh
8ca987d46SWarner Losh# Additional options that you can specify with make OPTS="..."
9ca987d46SWarner Losh# (these only apply to boot0.S)
10ca987d46SWarner Losh#
11ca987d46SWarner Losh#	-DVOLUME_SERIAL	support volume serial number (NT, XP, Vista)
12ca987d46SWarner Losh#	-DSIO		do I/O using COM1:
13ca987d46SWarner Losh#	-DPXE		fallback to INT18/PXE with F6
14ca987d46SWarner Losh#	-DCHECK_DRIVE	enable checking drive number
15ca987d46SWarner Losh#	-DONLY_F_KEYS	accept only Fx keys in console
16ca987d46SWarner Losh#	-DTEST		print drive number on entry
17ca987d46SWarner Losh#
18ca987d46SWarner LoshOPTS ?= -DVOLUME_SERIAL -DPXE
19ca987d46SWarner LoshCFLAGS += ${OPTS}
20ca987d46SWarner Losh
21ca987d46SWarner Losh# Flags used in the boot0.S code:
22ca987d46SWarner Losh#   0x0f	all valid partitions enabled.
23ca987d46SWarner Losh#   0x80	'packet', use BIOS EDD (LBA) extensions instead of CHS
24ca987d46SWarner Losh#		to read from disk. boot0.S does not check that the extensions
25ca987d46SWarner Losh#		are supported, but all modern BIOSes should have them.
26ca987d46SWarner Losh#   0x40	'noupdate', disable writing boot0 back to disk so that
27ca987d46SWarner Losh#		the current selection is not preserved across reboots.
28ca987d46SWarner Losh#   0x20	'setdrv', override the drive number supplied by the bios
29ca987d46SWarner Losh#		with the one in the boot sector.
30ca987d46SWarner Losh
31ca987d46SWarner Losh# Default boot flags:
32ca987d46SWarner LoshBOOT_BOOT0_FLAGS?=	0x8f
33ca987d46SWarner Losh
34ca987d46SWarner Losh# The number of timer ticks to wait for a keypress before assuming the default
35ca987d46SWarner Losh# selection.  Since there are 18.2 ticks per second, the default value of
36ca987d46SWarner Losh# 0xb6 (182d) corresponds to 10 seconds.
37ca987d46SWarner LoshBOOT_BOOT0_TICKS?=	0xb6
38ca987d46SWarner Losh
39ca987d46SWarner Losh# The base address that we the boot0 code to to run it.  Don't change this
40ca987d46SWarner Losh# unless you are glutton for punishment.
41ca987d46SWarner LoshBOOT_BOOT0_ORG?=	0x600
42ca987d46SWarner LoshORG=${BOOT_BOOT0_ORG}
43ca987d46SWarner Losh
44ca987d46SWarner Losh# Comm settings for boot0sio.
45*7ed32283SWarner Losh#
46*7ed32283SWarner Losh# boot0sio uses BIOS INT $0x14 for serial ports, we can only support these
47*7ed32283SWarner Losh# baudrates due to INT14's limited interface. In addition, if
48*7ed32283SWarner Losh# BOOT_BOOT0_COMCONSOLE_SPEED=0, then the baud rate and frame format will remain
49*7ed32283SWarner Losh# unchanged. Some BIOSes initialize the serial ports to 115200, and this may
50*7ed32283SWarner Losh# allow boot0sio access at that rate if so.
51*7ed32283SWarner Losh#
52ca987d46SWarner Losh# Bit(s) Description
53ca987d46SWarner Losh# 7-5    data rate (110,150,300,600,1200,2400,4800,9600 bps)
54ca987d46SWarner Losh# 4-3    parity (00 or 10 = none, 01 = odd, 11 = even)
55ca987d46SWarner Losh# 2      stop bits (set = 2, clear = 1)
56ca987d46SWarner Losh# 1-0    data bits (00 = 5, 01 = 6, 10 = 7, 11 = 8)
57ca987d46SWarner Losh.if !defined(BOOT_BOOT0_COMCONSOLE_SPEED)
58ca987d46SWarner LoshBOOT_COMCONSOLE_SPEED?=	9600
59ca987d46SWarner Losh.if ${BOOT_COMCONSOLE_SPEED} == 9600
60ca987d46SWarner LoshBOOT_BOOT0_COMCONSOLE_SPEED=	"7 << 5 + 3"
61ca987d46SWarner Losh.elif ${BOOT_COMCONSOLE_SPEED} == 4800
62ca987d46SWarner LoshBOOT_BOOT0_COMCONSOLE_SPEED=	"6 << 5 + 3"
63ca987d46SWarner Losh.elif ${BOOT_COMCONSOLE_SPEED} == 2400
64ca987d46SWarner LoshBOOT_BOOT0_COMCONSOLE_SPEED=	"5 << 5 + 3"
65ca987d46SWarner Losh.elif ${BOOT_COMCONSOLE_SPEED} == 1200
66ca987d46SWarner LoshBOOT_BOOT0_COMCONSOLE_SPEED=	"4 << 5 + 3"
67ca987d46SWarner Losh.elif ${BOOT_COMCONSOLE_SPEED} == 600
68ca987d46SWarner LoshBOOT_BOOT0_COMCONSOLE_SPEED=	"3 << 5 + 3"
69ca987d46SWarner Losh.elif ${BOOT_COMCONSOLE_SPEED} == 300
70ca987d46SWarner LoshBOOT_BOOT0_COMCONSOLE_SPEED=	"2 << 5 + 3"
71ca987d46SWarner Losh.elif ${BOOT_COMCONSOLE_SPEED} == 150
72ca987d46SWarner LoshBOOT_BOOT0_COMCONSOLE_SPEED=	"1 << 5 + 3"
73ca987d46SWarner Losh.elif ${BOOT_COMCONSOLE_SPEED} == 110
74ca987d46SWarner LoshBOOT_BOOT0_COMCONSOLE_SPEED=	"0 << 5 + 3"
75ca987d46SWarner Losh.else
76ca987d46SWarner LoshBOOT_BOOT0_COMCONSOLE_SPEED=	"7 << 5 + 3"
77ca987d46SWarner Losh.endif
78ca987d46SWarner Losh.endif
79ca987d46SWarner Losh
80ca987d46SWarner LoshCFLAGS+=-DFLAGS=${BOOT_BOOT0_FLAGS} \
81ca987d46SWarner Losh	-DTICKS=${BOOT_BOOT0_TICKS} \
82ca987d46SWarner Losh	-DCOMSPEED=${BOOT_BOOT0_COMCONSOLE_SPEED}
83ca987d46SWarner Losh
84ca987d46SWarner LoshLDFLAGS+=${LDFLAGS_BIN}
85ca987d46SWarner Losh
86ca987d46SWarner Losh.include <bsd.prog.mk>
87