Makefile revision 125563
1# $FreeBSD: head/sys/boot/pc98/boot2/Makefile 125563 2004-02-07 12:19:44Z nyan $
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
9BINMODE=	444
10CFLAGS=		-elf -Os -mrtd \
11		-ffreestanding -fno-builtin -fno-guess-branch-probability \
12		-D_KERNEL -DPC98 -DBOOTWAIT=${BOOTWAIT} -DTIMEOUT=${TIMEOUT}
13CFLAGS+=	-DBOOTSEG=${BOOTSEG} -DBOOTSTACK=${BOOTSTACK}
14CFLAGS+=	${CWARNFLAGS}
15CFLAGS+=	-I${.CURDIR}/../../.. -I.
16
17# By default, if a serial port is going to be used as console, use COM1
18# (aka /dev/ttyd0).
19#BOOT_COMCONSOLE_PORT?=0x30
20BOOT_COMCONSOLE_PORT?=0x238
21BOOT_COMCONSOLE_CLK?=16
22BOOT_COMCONSOLE_MODE=0x0c
23CFLAGS+=	-DCOMCONSOLE=${BOOT_COMCONSOLE_PORT} \
24		-DCOMCONSOLE_CLK=${BOOT_COMCONSOLE_CLK} \
25		-DCOMCONSOLE_MODE=${BOOT_COMCONSOLE_MODE}
26
27# feature not implemented
28BOOT_COMCONSOLE_SPEED?=9600
29CFLAGS+=	-DCOMSPEED=${BOOT_COMCONSOLE_SPEED}
30
31# Enable code to take the default boot string from a fixed location on the
32# disk.  See nextboot(8) and README.386BSD for more info.
33#CFLAGS+=	-DNAMEBLOCK
34#CFLAGS+=	-DNAMEBLOCK_WRITEBACK
35
36# Bias the conversion from the BIOS drive number to the FreeBSD unit number
37# for hard disks.  This may be useful for people booting in a mixed IDE/SCSI
38# environment (set BOOT_HD_BIAS to the number of IDE drives).
39#CFLAGS+=	-DBOOT_HD_BIAS=1
40#
41# Details: this only applies if BOOT_HD_BIAS > 0.  If the BIOS drive number
42# for the boot drive is >= BOOT_HD_BIAS, then the boot drive is assumed to
43# be SCSI and have unit number (BIOS_drive_number - BOOT_HD_BIAS).  E.g.,
44# BOOT_HD_BIAS=1 makes BIOS drive 1 correspond to 1:da(0,a) instead of
45# 1:wd(1,a).  If `da' is given explicitly, then the drive is assumed to be
46# SCSI and have BIOS drive number (da_unit_number + BOOT_HD_BIAS).  E.g.,
47# BOOT_HD_BIAS=1 makes da(0,a) correspond to 1:da(0,a) instead of 0:da(0,a).
48
49CLEANFILES+=	boot.nohdr boot.strip boot.ldr boot1 boot2 sizetest
50LDFLAGS+=	-N -Ttext 0 -nostdlib -e start
51NOSHARED=	YES
52NOMAN=
53STRIP=
54
55# tunable timeout parameter, waiting for keypress, calibrated in ms
56BOOTWAIT?=	5000
57# tunable timeout during string input, calibrated in ms
58#TIMEOUT?=	30000
59
60# Location that boot2 is loaded at
61BOOTSEG=	0x1000
62
63# Offset in BOOTSEG for the top of the stack, keep this 16 byte aligned
64BOOTSTACK=	0xFFF0
65
66boot.nohdr:	boot
67	objcopy -S -O binary boot boot.nohdr
68	ls -l boot.nohdr
69
70boot.ldr:	boot.nohdr
71	dd if=boot.nohdr of=boot.ldr bs=8192 count=1 conv=sync
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:		boot.ldr boot1 boot2
86
87install:
88	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
89		boot.ldr ${DESTDIR}${BINDIR}/boot
90	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
91		boot1 boot2 ${DESTDIR}${BINDIR}
92
93# If it's not there, don't consider it a target
94.if exists(${.CURDIR}/../../../i386/include)
95beforedepend ${OBJS}: machine
96
97machine:
98	ln -sf ${.CURDIR}/../../../i386/include machine
99
100.endif
101
102CLEANFILES+=	machine
103
104.include "${.CURDIR}/../../../conf/kern.mk"
105.include <bsd.prog.mk>
106