Makefile revision 96342
1# $FreeBSD: head/sys/boot/pc98/boot2/Makefile 96342 2002-05-10 09:26:35Z obrien $
2#
3
4PROG=	boot
5# Order is very important on the SRCS line for this prog
6SRCS=	start.S table.c boot2.S boot.c asm.S bios.S serial.S
7SRCS+=	probe_keyboard.c io.c disk.c sys.c
8
9BINDIR=		/boot
10BINMODE=	444
11CFLAGS=		-elf -Os -ffreestanding -fforce-addr -fdata-sections \
12		-malign-functions=0 -malign-jumps=0 -malign-loops=0 \
13		-mpreferred-stack-boundary=2 -mrtd \
14		-D_KERNEL -DPC98 -DBOOTWAIT=${BOOTWAIT} -DTIMEOUT=${TIMEOUT}
15CFLAGS+=	-DBOOTSEG=${BOOTSEG} -DBOOTSTACK=${BOOTSTACK}
16CFLAGS+=	${CWARNFLAGS}
17CFLAGS+=	-I${.CURDIR}/../../..
18
19
20# By default, if a serial port is going to be used as console, use COM1
21# (aka /dev/ttyd0).
22#BOOT_COMCONSOLE_PORT?=0x30
23BOOT_COMCONSOLE_PORT?=0x238
24BOOT_COMCONSOLE_CLK?=16
25BOOT_COMCONSOLE_MODE=0x0c
26CFLAGS+=	-DCOMCONSOLE=${BOOT_COMCONSOLE_PORT} \
27		-DCOMCONSOLE_CLK=${BOOT_COMCONSOLE_CLK} \
28		-DCOMCONSOLE_MODE=${BOOT_COMCONSOLE_MODE}
29
30# feature not implemented
31BOOT_COMCONSOLE_SPEED?=9600
32CFLAGS+=	-DCONSPEED=${BOOT_COMCONSOLE_SPEED}
33
34# Enable code to take the default boot string from a fixed location on the
35# disk.  See nextboot(8) and README.386BSD for more info.
36#CFLAGS+=	-DNAMEBLOCK
37#CFLAGS+=	-DNAMEBLOCK_WRITEBACK
38
39# Bias the conversion from the BIOS drive number to the FreeBSD unit number
40# for hard disks.  This may be useful for people booting in a mixed IDE/SCSI
41# environment (set BOOT_HD_BIAS to the number of IDE drives).
42#CFLAGS+=	-DBOOT_HD_BIAS=1
43#
44# Details: this only applies if BOOT_HD_BIAS > 0.  If the BIOS drive number
45# for the boot drive is >= BOOT_HD_BIAS, then the boot drive is assumed to
46# be SCSI and have unit number (BIOS_drive_number - BOOT_HD_BIAS).  E.g.,
47# BOOT_HD_BIAS=1 makes BIOS drive 1 correspond to 1:da(0,a) instead of
48# 1:wd(1,a).  If `da' is given explicitly, then the drive is assumed to be
49# SCSI and have BIOS drive number (da_unit_number + BOOT_HD_BIAS).  E.g.,
50# BOOT_HD_BIAS=1 makes da(0,a) correspond to 1:da(0,a) instead of 0:da(0,a).
51
52CLEANFILES+=	boot.nohdr boot.strip boot1 boot2 sizetest
53LDFLAGS+=	-N -Ttext 0 -nostdlib -e start
54NOSHARED=	YES
55NOMAN=
56STRIP=
57
58# tunable timeout parameter, waiting for keypress, calibrated in ms
59BOOTWAIT?=	5000
60# tunable timeout during string input, calibrated in ms
61#TIMEOUT?=	30000
62
63# Location that boot2 is loaded at
64BOOTSEG=	0x1000
65
66# Offset in BOOTSEG for the top of the stack, keep this 16 byte aligned
67BOOTSTACK=	0xFFF0
68
69boot.nohdr:	boot
70	objcopy -S -O binary boot boot.nohdr
71	ls -l boot.nohdr
72
73boot1:		boot.nohdr
74	dd if=boot.nohdr of=boot1 bs=512 count=1
75
76boot2:		boot.nohdr
77	dd if=boot.nohdr of=boot2 bs=512 skip=1
78	@dd if=boot2 skip=14 of=sizetest 2> /dev/null
79	@if [ -s sizetest ] ; then \
80		echo "boot2 is too big" >&2 ; \
81		rm boot2 ; \
82		exit 2 ; \
83	fi
84
85all:		boot1 boot2
86
87install:
88	${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
89		boot1 boot2 ${DESTDIR}${BINDIR}
90
91.include <bsd.kern.mk>
92.include <bsd.prog.mk>
93