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