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