Training courses

Kernel and Embedded Linux

Bootlin training courses

Embedded Linux, kernel,
Yocto Project, Buildroot, real-time,
graphics, boot time, debugging...

Bootlin logo

Elixir Cross Referencer

#	$NetBSD: Makefile.bootxx,v 1.11 2014/01/12 15:26:28 tsutsui Exp $

NOMAN=	# defined

.include <bsd.own.mk>

PROG=	bootxx

STRIPFLAG=
BINMODE=${NONBINMODE}

# XXX SHOULD NOT NEED TO DEFINE THESE!
LIBCRT0=
LIBCRTI=
LIBC=
LIBCRTBEGIN=
LIBCRTEND=

# logically src/sys
S=${.CURDIR}/../../../../..
S_SA=${S}/lib/libsa
S_KERN=${S}/lib/libkern
S_MACHSA=${S}/arch/atari/stand/libsa
S_LIBTOS=${S}/arch/atari/stand/tostools/libtos

S_MACHSAOBJ!=	cd ${S_MACHSA} && ${PRINTOBJDIR}

LIBSA=${S_MACHSAOBJ}/lib/sa/libsa.a
LIBKERN=${S_MACHSAOBJ}/lib/kern/libkern.a

.include "../../Makefile.booters"
.include "../../xxboot/${BTYPE}_LOADADDR"


BOOTXX_MAXSIZE=		6656

CPPFLAGS+=	-I. -I${S_LIBTOS} -I${S_MACHSA} -I${S_KERN} -I${S_SA} -I${S}
LINKFLAGS=	-static -N -e start -Ttext ${LOADADDR}

.PATH: ${.CURDIR}/.. ${S_LIBTOS}

#
# Warning: start.S should be the first source!
#
SRCS=	start.S bootxx.c filesystem.c

LIBS=	${LIBSA} ${LIBKERN}

beforeinstall:
	${INSTALL_DIR} ${DESTDIR}${BINDIR}

${PROG}:	${OBJS} ${LIBS}
	${_MKTARGET_LINK}
	${LD} ${LINKFLAGS} -o ${.TARGET}.elf ${OBJS} ${LIBS}
	${OBJCOPY} -O binary ${PROG}.elf ${PROG}.bin
	${SIZE} ${PROG}.elf
	@len=`${SIZE} ${PROG}.elf |					\
	    ${TOOL_AWK} 'NR==2 { print $$1+$$2 }'`;			\
	if [ "$$len" -gt ${BOOTXX_MAXSIZE} ]; then			\
		echo "### ${PROG} text+data size $$len is"		\
		    "larger than ${BOOTXX_MAXSIZE}" >&2; \
		exit 1;							\
	fi;
	${TOOL_CAT} ${PROG}.bin /dev/zero |				\
	    dd of=${PROG}.tmp bs=1 count=6656  2>/dev/null
	mv ${PROG}.tmp ${.TARGET}

CLEANFILES+=	${PROG}.elf ${PROG}.bin ${PROG}.tmp

.include <bsd.prog.mk>