Deleted Added
full compact
1#-
2# Copyright (c) 2013-2014 Robert N. M. Watson
3# All rights reserved.
4#
5# This software was developed by SRI International and the University of
6# Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
7# ("CTSRD"), as part of the DARPA CRASH research programme.
8#
9# Redistribution and use in source and binary forms, with or without
10# modification, are permitted provided that the following conditions
11# are met:
12# 1. Redistributions of source code must retain the above copyright
13# notice, this list of conditions and the following disclaimer.
14# 2. Redistributions in binary form must reproduce the above copyright
15# notice, this list of conditions and the following disclaimer in the
16# documentation and/or other materials provided with the distribution.
17#
18# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28# SUCH DAMAGE.
29#
30# $FreeBSD: head/sys/boot/mips/beri/loader/Makefile 265420 2014-05-06 04:22:01Z imp $
30# $FreeBSD: head/sys/boot/mips/beri/loader/Makefile 266893 2014-05-30 16:47:54Z hselasky $
31
32.include <src.opts.mk>
33MK_SSP= no
34
35PROG?= loader
36NEWVERSWHAT= "BERI loader" ${MACHINE_CPUARCH}
37INSTALLFLAGS= -b
38
39# Architecture-specific loader code
40SRCS= start.S \
41 main.c \
42 devicename.c \
43 exec.c \
44 metadata.c \
45 vers.c \
46 arch.c
47
48# libstand front-ends for shared driver code
49SRCS+= beri_console.c \
50 beri_disk_cfi.c \
51 beri_disk_sdcard.c
52
53# Common code with boot2
54SRCS+= altera_jtag_uart.c \
55 cfi.c \
56 sdcard.c
57
58# Since we don't have a backward compatibility issue, default to this on BERI.
59CFLAGS+= -DBOOT_PROMPT_123
60
61CFLAGS+= -DLOADER_DISK_SUPPORT
62CFLAGS+= -DLOADER_UFS_SUPPORT
63CFLAGS+= -DLOADER_GZIP_SUPPORT
64CFLAGS+= -DLOADER_BZIP2_SUPPORT
65
66#CFLAGS+= -DLOADER_NET_SUPPORT
67#CFLAGS+= -DLOADER_NFS_SUPPORT
68#CFLAGS+= -DLOADER_TFTP_SUPPORT
69
70.if ${MK_FORTH} != "no"
71# Enable BootForth
72BOOT_FORTH= yes
73CFLAGS+= -DBOOT_FORTH -I${.CURDIR}/../../../ficl
74CFLAGS+= -I${.CURDIR}/../../../ficl/mips
75LIBFICL= ${.OBJDIR}/../../../ficl/libficl.a
76.endif
77
78# Common code across BERI boot loader parts
79.PATH: ${.CURDIR}/../common
80CFLAGS+= -I${.CURDIR}/../common
81
82# Always add MI sources
83.PATH: ${.CURDIR}/../../../common
84.include "${.CURDIR}/../../../common/Makefile.inc"
85CFLAGS+= -I${.CURDIR}/../../../common
86
87# BERI files common to boot2 and loader
88.PATH: ${.CURDIR}/../common
89CFLAGS+= -I${.CURDIR}/../common
90
91# Loader-specific MD headers
92CFLAGS+= -I${.CURDIR}
93
94CLEANFILES+= vers.c loader.help
95
96# Generate code appropriate for the loader environment
97CFLAGS+= -G0 \
98 -fno-pic \
99 -mno-abicalls \
100 -msoft-float \
101 -g
102
103LDFLAGS= -nostdlib \
104 -static \
105 -T ${.CURDIR}/loader.ldscript \
106 -L${.CURDIR} \
107 -e __start
108
109# where to get libstand from
110CFLAGS+= -I${.CURDIR}/../../../../../lib/libstand/
111LIBSTAND= ${.OBJDIR}/../../../../../lib/libstand/libstand.a
112
113DPADD= ${LIBFICL} ${LIBSTAND}
114LDADD= ${LIBFICL} ${LIBSTAND}
115
116vers.c: ${.CURDIR}/../../../common/newvers.sh ${.CURDIR}/version
117 sh ${.CURDIR}/../../../common/newvers.sh ${.CURDIR}/version \
118 ${NEWVERSWHAT}
119
120loader.help: help.common help.mips
121 cat ${.ALLSRC} | \
122 awk -f ${.CURDIR}/../../../common/merge_help.awk > ${.TARGET}
123
124.PATH: ${.CURDIR}/../../../forth
125FILES= loader.help loader.4th support.4th loader.conf
126FILES+= screen.4th frames.4th
127FILES+= beastie.4th brand.4th check-password.4th color.4th delay.4th
128FILES+= menu.4th menu-commands.4th menusets.4th shortcuts.4th version.4th
129FILESDIR_loader.conf= /boot/defaults
130
131.if !exists(${DESTDIR}/boot/loader.rc)
132FILES+= loader.rc
133.endif
134
135.if !exists(${DESTDIR}/boot/menu.rc)
136FILES+= menu.rc
137.endif
138
139.if defined(LOADER_USB_SUPPORT)
140# Do garbage collection
141CFLAGS+= -ffunction-sections -fdata-sections
142CFLAGS+= -Wl,--gc-sections
143# Link USB BOOT library
144LDADD+= ${.OBJDIR}/../../../usb/libusbboot.a
145CFLAGS+= -I${.CURDIR}/../../../usb
146# Define USB SUPPORT
147CFLAGS+= -DLOADER_USB_SUPPORT
148.endif
149
150all: loader
151
152.include <bsd.prog.mk>