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