64 lines
1.7 KiB
Makefile
64 lines
1.7 KiB
Makefile
# $NetBSD: Makefile.bootxx,v 1.1 2006/09/01 21:26:19 uwe Exp $
|
|
|
|
PROG?= bootxx_${FS}
|
|
|
|
BOOTXX_SECTORS?= 15
|
|
BOOTXX_MAXSIZE?= (( ${BOOTXX_SECTORS} * 512 ))
|
|
|
|
SRCS= pbr.S label.S bootxx.S boot1.c
|
|
|
|
LDFLAGS+= -e start
|
|
|
|
CFLAGS=
|
|
CPPFLAGS+= -DBOOTXX
|
|
CPPFLAGS+= -DBOOTXX_SECTORS=${BOOTXX_SECTORS}
|
|
CPPFLAGS+= -DPRIMARY_LOAD_ADDRESS=${PRIMARY_LOAD_ADDRESS}
|
|
CPPFLAGS+= -DSECONDARY_LOAD_ADDRESS=${SECONDARY_LOAD_ADDRESS}
|
|
CPPFLAGS+= -DXXfs_open=${FS}_open
|
|
CPPFLAGS+= -DXXfs_close=${FS}_close
|
|
CPPFLAGS+= -DXXfs_read=${FS}_read
|
|
CPPFLAGS+= -DXXfs_stat=${FS}_stat
|
|
CPPFLAGS+= -DFS=${FS}
|
|
|
|
CPPFLAGS+= -DLIBSA_SINGLE_FILESYSTEM=xxfs \
|
|
-DLIBSA_NO_TWIDDLE \
|
|
-DLIBSA_NO_FD_CHECKING \
|
|
-DLIBSA_NO_RAW_ACCESS \
|
|
-DLIBSA_NO_FS_WRITE \
|
|
-DLIBSA_NO_FS_SEEK \
|
|
-DLIBSA_USE_MEMCPY \
|
|
-DLIBSA_USE_MEMSET \
|
|
-DLIBSA_SINGLE_DEVICE=blkdev \
|
|
-DLIBKERN_OPTIMISE_SPACE \
|
|
-D"blkdevioctl(x,y,z)=EINVAL" \
|
|
-D"blkdevclose(f)=0" \
|
|
-D"devopen(f,n,fl)=(*(fl)=(void *)n,0)" \
|
|
-DLIBSA_NO_DISKLABEL_MSGS
|
|
|
|
SAMISCMAKEFLAGS+="SA_USE_LOADFILE=yes"
|
|
|
|
.include "../Makefile.bootprogs"
|
|
|
|
LIBLIST= ${LIBSA} ${LIBKERN}
|
|
|
|
CLEANFILES+= ${PROG}.sym ${PROG}.map
|
|
|
|
${PROG}: ${OBJS} ${LIBLIST}
|
|
${LD} -o ${PROG}.sym ${LDFLAGS} -Ttext ${PRIMARY_LOAD_ADDRESS} \
|
|
-Map ${PROG}.map -cref ${OBJS} ${LIBLIST}
|
|
${OBJCOPY} -O binary ${PROG}.sym ${PROG}
|
|
@ sz=$$(ls -ln ${PROG} | tr -s ' ' | cut -d' ' -f5); \
|
|
if [ "$$sz" -gt "$$${BOOTXX_MAXSIZE}" ]; then \
|
|
echo "### ${PROG} size $$sz is larger than ${BOOTXX_MAXSIZE}" >&2 \
|
|
rm -f ${PROG}; \
|
|
! :; \
|
|
else \
|
|
: pad to sector boundary; \
|
|
pad=$$(( 512 - ( $$sz & 511 ) )); \
|
|
[ $$pad = 512 ] || \
|
|
dd if=/dev/zero bs=1 count=$$pad >>${PROG} 2>/dev/null; \
|
|
echo "${PROG} size $$sz, $$((${BOOTXX_MAXSIZE} - $$sz)) free"; \
|
|
fi
|
|
|
|
.include <bsd.prog.mk>
|