Home | History | Annotate | Line # | Download | only in bootxx
      1  1.4     matt #	$NetBSD: Makefile.bootxx,v 1.4 2013/08/21 07:08:30 matt Exp $
      2  1.1      uwe 
      3  1.1      uwe PROG?=		bootxx_${FS}
      4  1.1      uwe 
      5  1.1      uwe BOOTXX_SECTORS?= 15
      6  1.1      uwe BOOTXX_MAXSIZE?= (( ${BOOTXX_SECTORS} * 512 ))
      7  1.1      uwe 
      8  1.1      uwe SRCS=		pbr.S label.S bootxx.S boot1.c
      9  1.1      uwe 
     10  1.3  tsutsui .if ${FS} == ustarfs
     11  1.3  tsutsui SRCS+=		bios.S
     12  1.3  tsutsui .endif
     13  1.3  tsutsui 
     14  1.1      uwe LDFLAGS+=	-e start
     15  1.1      uwe 
     16  1.1      uwe CFLAGS=
     17  1.1      uwe CPPFLAGS+=	-DBOOTXX
     18  1.1      uwe CPPFLAGS+=	-DBOOTXX_SECTORS=${BOOTXX_SECTORS}
     19  1.1      uwe CPPFLAGS+=	-DPRIMARY_LOAD_ADDRESS=${PRIMARY_LOAD_ADDRESS}
     20  1.1      uwe CPPFLAGS+=	-DSECONDARY_LOAD_ADDRESS=${SECONDARY_LOAD_ADDRESS}
     21  1.1      uwe CPPFLAGS+=	-DXXfs_open=${FS}_open
     22  1.1      uwe CPPFLAGS+=	-DXXfs_close=${FS}_close
     23  1.1      uwe CPPFLAGS+=	-DXXfs_read=${FS}_read
     24  1.1      uwe CPPFLAGS+=	-DXXfs_stat=${FS}_stat
     25  1.1      uwe CPPFLAGS+=	-DFS=${FS}
     26  1.1      uwe 
     27  1.1      uwe CPPFLAGS+= -DLIBSA_SINGLE_FILESYSTEM=xxfs \
     28  1.1      uwe 		-DLIBSA_NO_TWIDDLE \
     29  1.1      uwe 		-DLIBSA_NO_FD_CHECKING \
     30  1.1      uwe 		-DLIBSA_NO_RAW_ACCESS \
     31  1.1      uwe 		-DLIBSA_NO_FS_WRITE \
     32  1.1      uwe 		-DLIBSA_NO_FS_SEEK \
     33  1.1      uwe 		-DLIBSA_SINGLE_DEVICE=blkdev \
     34  1.1      uwe 		-DLIBKERN_OPTIMISE_SPACE \
     35  1.1      uwe 		-D"blkdevioctl(x,y,z)=EINVAL" \
     36  1.1      uwe 		-D"blkdevclose(f)=0" \
     37  1.1      uwe 		-D"devopen(f,n,fl)=(*(fl)=(void *)n,0)" \
     38  1.1      uwe 		-DLIBSA_NO_DISKLABEL_MSGS
     39  1.1      uwe 
     40  1.1      uwe SAMISCMAKEFLAGS+="SA_USE_LOADFILE=yes"
     41  1.1      uwe 
     42  1.1      uwe .include "../Makefile.bootprogs"
     43  1.1      uwe 
     44  1.1      uwe LIBLIST=	${LIBSA} ${LIBKERN}
     45  1.1      uwe 
     46  1.1      uwe CLEANFILES+=	${PROG}.sym ${PROG}.map
     47  1.1      uwe 
     48  1.1      uwe ${PROG}: ${OBJS} ${LIBLIST}
     49  1.4     matt 	${_MKTARGET_LINK}
     50  1.1      uwe 	${LD} -o ${PROG}.sym ${LDFLAGS} -Ttext ${PRIMARY_LOAD_ADDRESS} \
     51  1.1      uwe 		-Map ${PROG}.map -cref ${OBJS} ${LIBLIST}
     52  1.1      uwe 	${OBJCOPY} -O binary ${PROG}.sym ${PROG}
     53  1.1      uwe 	@ sz=$$(ls -ln ${PROG} | tr -s ' ' | cut -d' ' -f5); \
     54  1.1      uwe 	if [ "$$sz" -gt "$$${BOOTXX_MAXSIZE}" ]; then \
     55  1.1      uwe 		echo "### ${PROG} size $$sz is larger than ${BOOTXX_MAXSIZE}" >&2 \
     56  1.1      uwe 		rm -f ${PROG}; \
     57  1.1      uwe 		! :; \
     58  1.1      uwe 	else \
     59  1.1      uwe 		: pad to sector boundary; \
     60  1.1      uwe 		pad=$$(( 512 - ( $$sz & 511 ) )); \
     61  1.1      uwe 		[ $$pad = 512 ] || \
     62  1.1      uwe 		    dd if=/dev/zero bs=1 count=$$pad >>${PROG} 2>/dev/null; \
     63  1.1      uwe 		echo "${PROG} size $$sz, $$((${BOOTXX_MAXSIZE} - $$sz)) free"; \
     64  1.1      uwe 	fi
     65  1.1      uwe 
     66  1.1      uwe .include <bsd.prog.mk>
     67