Makefile revision 110102
111499Sjkh# $FreeBSD: head/sys/boot/pc98/boot2/Makefile 110102 2003-01-30 14:50:25Z nyan $
211499Sjkh#
311499Sjkh
411499SjkhPROG=	boot
511499Sjkh# Order is very important on the SRCS line for this prog
611499SjkhSRCS=	start.S table.c boot2.S boot.c asm.S bios.S serial.S
742520SasamiSRCS+=	probe_keyboard.c io.c disk.c sys.c
811499Sjkh
911499SjkhBINDIR=		/boot
1011499SjkhBINMODE=	444
1111499SjkhCFLAGS=		-elf -Os -mrtd \
1211499Sjkh		-ffreestanding -fno-builtin -fno-guess-branch-probability \
1311499Sjkh		-D_KERNEL -DPC98 -DBOOTWAIT=${BOOTWAIT} -DTIMEOUT=${TIMEOUT}
1411499SjkhCFLAGS+=	-DBOOTSEG=${BOOTSEG} -DBOOTSTACK=${BOOTSTACK}
1511499SjkhCFLAGS+=	${CWARNFLAGS}
1611499SjkhCFLAGS+=	-I${.CURDIR}/../../.. -I.
1711499Sjkh
1811499Sjkh# By default, if a serial port is going to be used as console, use COM1
1911499Sjkh# (aka /dev/ttyd0).
2011499Sjkh#BOOT_COMCONSOLE_PORT?=0x30
2111499SjkhBOOT_COMCONSOLE_PORT?=0x238
2211499SjkhBOOT_COMCONSOLE_CLK?=16
2311499SjkhBOOT_COMCONSOLE_MODE=0x0c
2411499SjkhCFLAGS+=	-DCOMCONSOLE=${BOOT_COMCONSOLE_PORT} \
2511499Sjkh		-DCOMCONSOLE_CLK=${BOOT_COMCONSOLE_CLK} \
2611499Sjkh		-DCOMCONSOLE_MODE=${BOOT_COMCONSOLE_MODE}
2711499Sjkh
2811499Sjkh# feature not implemented
2911499SjkhBOOT_COMCONSOLE_SPEED?=9600
3011499SjkhCFLAGS+=	-DCOMSPEED=${BOOT_COMCONSOLE_SPEED}
3111499Sjkh
3211499Sjkh# Enable code to take the default boot string from a fixed location on the
3311499Sjkh# disk.  See nextboot(8) and README.386BSD for more info.
3411499Sjkh#CFLAGS+=	-DNAMEBLOCK
3511499Sjkh#CFLAGS+=	-DNAMEBLOCK_WRITEBACK
3611499Sjkh
3711532Sjkh# Bias the conversion from the BIOS drive number to the FreeBSD unit number
3811303Sjkh# for hard disks.  This may be useful for people booting in a mixed IDE/SCSI
3911303Sjkh# environment (set BOOT_HD_BIAS to the number of IDE drives).
4011303Sjkh#CFLAGS+=	-DBOOT_HD_BIAS=1
4111303Sjkh#
4211303Sjkh# Details: this only applies if BOOT_HD_BIAS > 0.  If the BIOS drive number
4311303Sjkh# for the boot drive is >= BOOT_HD_BIAS, then the boot drive is assumed to
4411303Sjkh# be SCSI and have unit number (BIOS_drive_number - BOOT_HD_BIAS).  E.g.,
4511303Sjkh# BOOT_HD_BIAS=1 makes BIOS drive 1 correspond to 1:da(0,a) instead of
4616366Sjkh# 1:wd(1,a).  If `da' is given explicitly, then the drive is assumed to be
4717377Sjkh# SCSI and have BIOS drive number (da_unit_number + BOOT_HD_BIAS).  E.g.,
4811303Sjkh# BOOT_HD_BIAS=1 makes da(0,a) correspond to 1:da(0,a) instead of 0:da(0,a).
4914738Sjkh
5014670SjkhCLEANFILES+=	boot.nohdr boot.strip boot.ldr boot1 boot2 sizetest
5111303SjkhLDFLAGS+=	-N -Ttext 0 -nostdlib -e start
5211303SjkhNOSHARED=	YES
5311303SjkhNOMAN=
5411303SjkhSTRIP=
5511593Sjkh
5611303Sjkh# tunable timeout parameter, waiting for keypress, calibrated in ms
5711303SjkhBOOTWAIT?=	5000
5811303Sjkh# tunable timeout during string input, calibrated in ms
5924235Sjkh#TIMEOUT?=	30000
6024235Sjkh
6124235Sjkh# Location that boot2 is loaded at
6224235SjkhBOOTSEG=	0x1000
6324235Sjkh
6411479Sjkh# Offset in BOOTSEG for the top of the stack, keep this 16 byte aligned
6512245SjkhBOOTSTACK=	0xFFF0
6612245Sjkh
6711303Sjkhboot.nohdr:	boot
6842520Sasami	objcopy -S -O binary boot boot.nohdr
6911303Sjkh	ls -l boot.nohdr
7021132Sobrien
7111303Sjkhboot.ldr:	boot.nohdr
7211303Sjkh	dd if=boot.nohdr of=boot.ldr bs=8192 count=1 conv=sync
7341752Ssteve
7411303Sjkhboot1:		boot.nohdr
7511303Sjkh	dd if=boot.nohdr of=boot1 bs=512 count=1
7621132Sobrien
7711303Sjkhboot2:		boot.nohdr
7841752Ssteve	dd if=boot.nohdr of=boot2 bs=512 skip=1
7911303Sjkh	@dd if=boot2 skip=14 of=sizetest 2> /dev/null
8011303Sjkh	@if [ -s sizetest ] ; then \
8140281Sjkh		echo "boot2 is too big" >&2 ; \
8211303Sjkh		rm boot2 ; \
8311303Sjkh		exit 2 ; \
8442005Sjkh	fi
8542520Sasami
8611303Sjkhall:		boot.ldr boot1 boot2
8711303Sjkh
8834792Sjkhinstall:
8911303Sjkh	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
9011303Sjkh		boot.ldr ${DESTDIR}${BINDIR}/boot
9134867Sjkh	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
9224235Sjkh		boot1 boot2 ${DESTDIR}${BINDIR}
9311303Sjkh
9411303Sjkh# If it's not there, don't consider it a target
9511303Sjkh.if exists(${.CURDIR}/../../../i386/include)
9611303Sjkhbeforedepend ${OBJS}: machine
9711303Sjkh
9841752Sstevemachine:
9914670Sjkh	ln -sf ${.CURDIR}/../../../i386/include machine
10011303Sjkh
10111303Sjkh.endif
10211303Sjkh
10339595SjkhCLEANFILES+=	machine
10411303Sjkh
10542520Sasami.include <bsd.kern.mk>
10641752Ssteve.include <bsd.prog.mk>
10741752Ssteve