2001-10-05 09:03:27 +04:00
|
|
|
# $NetBSD: Makefile.booters,v 1.4 2001/10/05 05:03:30 simonb Exp $
|
2000-09-18 15:40:46 +04:00
|
|
|
|
|
|
|
S= ${.CURDIR}/../../../..
|
|
|
|
MIPS= ${S}/arch/mips
|
|
|
|
MIPSCO= ${S}/arch/mipsco
|
|
|
|
|
|
|
|
.PATH: ${.CURDIR}/../common
|
|
|
|
|
2000-09-26 13:11:04 +04:00
|
|
|
.PHONY: machine-links
|
|
|
|
beforedepend: machine-links
|
|
|
|
machine-links: machine mipsco mips
|
|
|
|
machine mipsco:
|
2000-09-18 15:40:46 +04:00
|
|
|
-rm -f ${.TARGET}
|
|
|
|
ln -s ${MIPSCO}/include ${.TARGET}
|
|
|
|
|
2000-09-26 13:11:04 +04:00
|
|
|
mips:
|
2000-09-18 15:40:46 +04:00
|
|
|
-rm -f ${.TARGET}
|
|
|
|
ln -s ${MIPS}/include ${.TARGET}
|
|
|
|
|
2000-09-26 13:11:04 +04:00
|
|
|
CLEANFILES+= machine mipsco mips
|
|
|
|
|
2000-09-18 15:40:46 +04:00
|
|
|
BINMODE?= 444
|
|
|
|
|
|
|
|
AFLAGS+= -D_LOCORE -D_KERNEL
|
|
|
|
# -I${.CURDIR}/../.. done by Makefile.inc
|
|
|
|
CPPFLAGS+= -nostdinc -D_STANDALONE -DNO_ABICALLS -D_NO_PROM_DEFINES
|
|
|
|
CPPFLAGS+= -I${.OBJDIR} -I${S}
|
|
|
|
# compiler flags for smallest code size
|
|
|
|
CFLAGS= -Os -mmemcpy -mno-abicalls -G 128
|
2001-10-05 09:03:27 +04:00
|
|
|
OFORMAT= --oformat elf32-bigmips
|
2000-09-18 15:40:46 +04:00
|
|
|
|
|
|
|
NETBSD_VERS!= sh ${S}/conf/osrelease.sh
|
|
|
|
CPPFLAGS+= -DNETBSD_VERS='"${NETBSD_VERS}"'
|
|
|
|
|
|
|
|
PRIMARY_LOAD_ADDRESS?= 0x80600000
|
|
|
|
SECONDARY_LOAD_ADDRESS?=0x80610000
|
|
|
|
|
|
|
|
PRIMARY_LDSCRIPT?= ${MIPSCO}/conf/stand.ldscript
|
2001-10-05 09:03:27 +04:00
|
|
|
SECONDARY_LDSCRIPT?= ${MIPS}/conf/stand.ldscript
|
2000-09-18 15:40:46 +04:00
|
|
|
|
|
|
|
.if defined(PRIMARY_PROG)
|
|
|
|
PROG= ${PRIMARY_PROG}
|
|
|
|
SRCS = start.S bootxx.c callvec.c
|
|
|
|
SRCS+= devopen.c conf.c saio.c
|
|
|
|
SRCS+= prom.S
|
|
|
|
|
|
|
|
LOAD_ADDRESS= ${PRIMARY_LOAD_ADDRESS}
|
|
|
|
LDSCRIPT= ${PRIMARY_LDSCRIPT}
|
|
|
|
|
|
|
|
CPPFLAGS+= -DPRIMARY_BOOTBLOCK \
|
|
|
|
-DPRIMARY_LOAD_ADDRESS="${PRIMARY_LOAD_ADDRESS}" \
|
|
|
|
-DNO_GETCHAR \
|
|
|
|
-DLIBSA_NO_FS_SYMLINK -DLIBSA_NO_FS_WRITE \
|
|
|
|
-DLIBSA_NO_FS_CLOSE \
|
|
|
|
-DLIBSA_NO_DEV_CLOSE \
|
|
|
|
-DLIBSA_SINGLE_DEVICE=saio \
|
|
|
|
-D"saioioctl(x,y,z)=EINVAL" -D"saioclose(f)=0" \
|
|
|
|
-DLIBSA_NO_TWIDDLE \
|
|
|
|
-DLIBSA_NO_FD_CHECKING \
|
|
|
|
-DLIBSA_NO_DISKLABEL_MSGS \
|
|
|
|
-DLIBSA_NO_RAW_ACCESS \
|
|
|
|
-DALLOC_FIRST_FIT \
|
|
|
|
-DLIBSA_USE_MEMCPY -DLIBSA_USE_MEMSET
|
|
|
|
|
|
|
|
|
|
|
|
CHECKSIZE_CMD?= SIZE=${SIZE} sh ${.CURDIR}/../common/checksize.sh
|
|
|
|
|
|
|
|
.elif defined(SECONDARY_PROG)
|
|
|
|
PROG= ${SECONDARY_PROG}
|
|
|
|
LOAD_ADDRESS= ${SECONDARY_LOAD_ADDRESS}
|
|
|
|
LDSCRIPT= ${SECONDARY_LDSCRIPT}
|
|
|
|
CPPFLAGS+= -DSECONDARY_BOOTBLOCK
|
|
|
|
SRCS+= vers.c
|
|
|
|
CLEANFILES+= vers.c
|
|
|
|
.else
|
|
|
|
|
|
|
|
.endif
|
|
|
|
|
|
|
|
### find out what to use for libkern
|
|
|
|
KERN_AS= library
|
|
|
|
.include "${S}/lib/libkern/Makefile.inc"
|
|
|
|
LIBKERN= ${KERNLIB}
|
|
|
|
|
|
|
|
### find out what to use for libz
|
|
|
|
.if defined(PRIMARY_PROG)
|
|
|
|
LIBZ=
|
|
|
|
.else
|
|
|
|
Z_AS= library
|
|
|
|
.include "${S}/lib/libz/Makefile.inc"
|
|
|
|
LIBZ= ${ZLIB}
|
|
|
|
.endif
|
|
|
|
|
|
|
|
### find out what to use for libsa
|
|
|
|
SA_AS= library
|
|
|
|
.if defined(PRIMARY_PROG)
|
|
|
|
SAMISCMAKEFLAGS+=SA_INCLUDE_NET=no
|
|
|
|
.endif
|
|
|
|
.if defined(SECONDARY_PROG)
|
|
|
|
SAMISCMAKEFLAGS+=SA_USE_LOADFILE=yes SA_USE_CREAD=yes
|
|
|
|
# for now:
|
|
|
|
SAMISCMAKEFLAGS+=SA_INCLUDE_NET=no
|
|
|
|
.endif
|
|
|
|
.include "${S}/lib/libsa/Makefile.inc"
|
|
|
|
LIBSA= ${SALIB}
|
|
|
|
|
|
|
|
LIBS= ${LIBSA} ${LIBZ} ${LIBSA} ${LIBKERN}
|
|
|
|
|
|
|
|
.PHONY: vers.c
|
|
|
|
vers.c: ${.CURDIR}/version
|
|
|
|
sh ${S}/conf/newvers_stand.sh -N ${.CURDIR}/version "mipsco"
|
|
|
|
|
2000-09-26 13:11:04 +04:00
|
|
|
${PROG}: machine-links ${LDSCRIPT} ${OBJS} ${LIBS}
|
2001-10-05 09:03:27 +04:00
|
|
|
${LD} ${OFORMAT} -Map ${PROG}.map -N -x -Ttext ${LOAD_ADDRESS} \
|
|
|
|
-T ${LDSCRIPT} -e start -o ${PROG} ${OBJS} ${LIBS}
|
2000-09-18 15:40:46 +04:00
|
|
|
@${SIZE} ${PROG}
|
2000-09-26 13:11:04 +04:00
|
|
|
.if defined(PRIMARY_PROG)
|
|
|
|
@mv ${PROG} ${PROG}.elf
|
2001-09-22 07:34:17 +04:00
|
|
|
@${OBJCOPY} --strip-all -O ecoff-bigmips -R .reginfo ${PROG}.elf ${PROG}
|
2000-09-26 13:11:04 +04:00
|
|
|
.endif
|
2000-09-18 15:40:46 +04:00
|
|
|
.if defined(CHECKSIZE_CMD)
|
2000-09-26 13:11:04 +04:00
|
|
|
@${CHECKSIZE_CMD} ${PROG} ${PRIMARY_MAX_LOAD} || \
|
2000-09-18 15:40:46 +04:00
|
|
|
(rm -f ${PROG} ; false)
|
|
|
|
.endif
|
|
|
|
|
|
|
|
CLEANFILES+= ${PROG}.map
|
|
|
|
|
|
|
|
cleandir distclean: cleanlibdir
|
|
|
|
|
|
|
|
cleanlibdir:
|
|
|
|
rm -rf lib
|
|
|
|
|
|
|
|
.include <bsd.prog.mk>
|