9 # Additional options that you can specify with make OPTS="..."
10 # (these only apply to boot0.S)
12 # -DVOLUME_SERIAL support volume serial number (NT, XP, Vista)
13 # -DSIO do I/O using COM1:
14 # -DPXE fallback to INT18/PXE with F6
15 # -DCHECK_DRIVE enable checking drive number
16 # -DONLY_F_KEYS accept only Fx keys in console
17 # -DTEST print drive number on entry
19 OPTS ?= -DVOLUME_SERIAL -DPXE
22 .if ${CC:T:Mclang} == "clang"
23 # XXX: clang integrated-as doesn't grok .codeNN directives yet
24 CFLAGS+= ${.IMPSRC:T:Mboot0.S:C/^.+$/-no-integrated-as/}
25 CFLAGS+= ${.IMPSRC:T:Mboot0ext.S:C/^.+$/-no-integrated-as/}
28 # Flags used in the boot0.S code:
29 # 0x0f all valid partitions enabled.
30 # 0x80 'packet', use BIOS EDD (LBA) extensions instead of CHS
31 # to read from disk. boot0.S does not check that the extensions
32 # are supported, but all modern BIOSes should have them.
33 # 0x40 'noupdate', disable writing boot0 back to disk so that
34 # the current selection is not preserved across reboots.
35 # 0x20 'setdrv', override the drive number supplied by the bios
36 # with the one in the boot sector.
39 BOOT_BOOT0_FLAGS?= 0x8f
41 # The number of timer ticks to wait for a keypress before assuming the default
42 # selection. Since there are 18.2 ticks per second, the default value of
43 # 0xb6 (182d) corresponds to 10 seconds.
44 BOOT_BOOT0_TICKS?= 0xb6
46 # The base address that we the boot0 code to to run it. Don't change this
47 # unless you are glutton for punishment.
48 BOOT_BOOT0_ORG?= 0x600
50 # Comm settings for boot0sio.
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)
57 BOOT_COMCONSOLE_SPEED?= 9600
58 .if ${BOOT_COMCONSOLE_SPEED} == 9600
59 BOOT_BOOT0_COMCONSOLE_SPEED= "7 << 5 + 3"
60 .elif ${BOOT_COMCONSOLE_SPEED} == 4800
61 BOOT_BOOT0_COMCONSOLE_SPEED= "6 << 5 + 3"
62 .elif ${BOOT_COMCONSOLE_SPEED} == 2400
63 BOOT_BOOT0_COMCONSOLE_SPEED= "5 << 5 + 3"
64 .elif ${BOOT_COMCONSOLE_SPEED} == 1200
65 BOOT_BOOT0_COMCONSOLE_SPEED= "4 << 5 + 3"
66 .elif ${BOOT_COMCONSOLE_SPEED} == 600
67 BOOT_BOOT0_COMCONSOLE_SPEED= "3 << 5 + 3"
68 .elif ${BOOT_COMCONSOLE_SPEED} == 300
69 BOOT_BOOT0_COMCONSOLE_SPEED= "2 << 5 + 3"
70 .elif ${BOOT_COMCONSOLE_SPEED} == 150
71 BOOT_BOOT0_COMCONSOLE_SPEED= "1 << 5 + 3"
72 .elif ${BOOT_COMCONSOLE_SPEED} == 110
73 BOOT_BOOT0_COMCONSOLE_SPEED= "0 << 5 + 3"
75 BOOT_BOOT0_COMCONSOLE_SPEED= "7 << 5 + 3"
79 CFLAGS+=-DFLAGS=${BOOT_BOOT0_FLAGS} \
80 -DTICKS=${BOOT_BOOT0_TICKS} \
81 -DCOMSPEED=${BOOT_BOOT0_COMCONSOLE_SPEED}
83 LDFLAGS=-e start -Ttext ${BOOT_BOOT0_ORG} -Wl,-N,-S,--oformat,binary
85 .include <bsd.prog.mk>