150477Speter# $FreeBSD$ 239973Srnordier 3128725SruPROG?= boot0 4128725SruSTRIP= 5128725SruBINMODE=${NOBINMODE} 6139103SruNO_MAN= 7128725SruSRCS= ${PROG}.S 839980Srnordier 9185562Sluigi# Additional options that you can specify with make OPTS="..." 10185562Sluigi# (these only apply to boot0.S) 11185562Sluigi# 12185579Sluigi# -DVOLUME_SERIAL support volume serial number (NT, XP, Vista) 13185562Sluigi# -DSIO do I/O using COM1: 14185562Sluigi# -DPXE fallback to INT18/PXE with F6 15185562Sluigi# -DCHECK_DRIVE enable checking drive number 16185562Sluigi# -DONLY_F_KEYS accept only Fx keys in console 17185562Sluigi# -DTEST print drive number on entry 18185562Sluigi# 19185579SluigiOPTS ?= -DVOLUME_SERIAL -DPXE 20185562SluigiCFLAGS += ${OPTS} 2140524Srnordier 22185562Sluigi# Flags used in the boot0.S code: 23185562Sluigi# 0x0f all valid partitions enabled. 24185562Sluigi# 0x80 'packet', use BIOS EDD (LBA) extensions instead of CHS 25185562Sluigi# to read from disk. boot0.S does not check that the extensions 26185562Sluigi# are supported, but all modern BIOSes should have them. 27185562Sluigi# 0x40 'noupdate', disable writing boot0 back to disk so that 28185562Sluigi# the current selection is not preserved across reboots. 29185562Sluigi# 0x20 'setdrv', override the drive number supplied by the bios 30185562Sluigi# with the one in the boot sector. 31185562Sluigi 32185562Sluigi# Default boot flags: 33186598SluigiBOOT_BOOT0_FLAGS?= 0x8f 34185562Sluigi 3589240Sjhb# The number of timer ticks to wait for a keypress before assuming the default 3689240Sjhb# selection. Since there are 18.2 ticks per second, the default value of 3789240Sjhb# 0xb6 (182d) corresponds to 10 seconds. 3889240SjhbBOOT_BOOT0_TICKS?= 0xb6 3939973Srnordier 4089240Sjhb# The base address that we the boot0 code to to run it. Don't change this 4189240Sjhb# unless you are glutton for punishment. 4289240SjhbBOOT_BOOT0_ORG?= 0x600 4389240Sjhb 44145515Sru# Comm settings for boot0sio. 45145515Sru# Bit(s) Description 46145515Sru# 7-5 data rate (110,150,300,600,1200,2400,4800,9600 bps) 47145515Sru# 4-3 parity (00 or 10 = none, 01 = odd, 11 = even) 48145515Sru# 2 stop bits (set = 2, clear = 1) 49145515Sru# 1-0 data bits (00 = 5, 01 = 6, 10 = 7, 11 = 8) 50145515Sru.if !defined(BOOT_BOOT0_COMCONSOLE_SPEED) 51145515SruBOOT_COMCONSOLE_SPEED?= 9600 52145515Sru.if ${BOOT_COMCONSOLE_SPEED} == 9600 53145515SruBOOT_BOOT0_COMCONSOLE_SPEED= "7 << 5 + 3" 54145515Sru.elif ${BOOT_COMCONSOLE_SPEED} == 4800 55145515SruBOOT_BOOT0_COMCONSOLE_SPEED= "6 << 5 + 3" 56145515Sru.elif ${BOOT_COMCONSOLE_SPEED} == 2400 57145515SruBOOT_BOOT0_COMCONSOLE_SPEED= "5 << 5 + 3" 58145515Sru.elif ${BOOT_COMCONSOLE_SPEED} == 1200 59145515SruBOOT_BOOT0_COMCONSOLE_SPEED= "4 << 5 + 3" 60145515Sru.elif ${BOOT_COMCONSOLE_SPEED} == 600 61145515SruBOOT_BOOT0_COMCONSOLE_SPEED= "3 << 5 + 3" 62145515Sru.elif ${BOOT_COMCONSOLE_SPEED} == 300 63145515SruBOOT_BOOT0_COMCONSOLE_SPEED= "2 << 5 + 3" 64145515Sru.elif ${BOOT_COMCONSOLE_SPEED} == 150 65145515SruBOOT_BOOT0_COMCONSOLE_SPEED= "1 << 5 + 3" 66145515Sru.elif ${BOOT_COMCONSOLE_SPEED} == 110 67145515SruBOOT_BOOT0_COMCONSOLE_SPEED= "0 << 5 + 3" 68145515Sru.else 69145515SruBOOT_BOOT0_COMCONSOLE_SPEED= "7 << 5 + 3" 70145515Sru.endif 71145515Sru.endif 72124179Sobrien 73128722SruCFLAGS+=-DFLAGS=${BOOT_BOOT0_FLAGS} \ 74128722Sru -DTICKS=${BOOT_BOOT0_TICKS} \ 75128722Sru -DCOMSPEED=${BOOT_BOOT0_COMCONSOLE_SPEED} 7639973Srnordier 77208789SedLDFLAGS=-e start -Ttext ${BOOT_BOOT0_ORG} -Wl,-N,-S,--oformat,binary 78125621Sru 79128718Sru.include <bsd.prog.mk> 80232263Sdim 81232263Sdim# XXX: clang integrated-as doesn't grok .codeNN directives yet 82232263SdimCFLAGS.boot0.S= ${CLANG_NO_IAS} 83232263SdimCFLAGS.boot0ext.S= ${CLANG_NO_IAS} 84232263SdimCFLAGS+= ${CFLAGS.${.IMPSRC:T}} 85