1 # $NetBSD: Makefile.bootxx,v 1.2 2009/04/03 10:38:13 tsutsui Exp $
6 BOOTXX_MAXSIZE?= (( ${BOOTXX_SECTORS} * 512 ))
8 SRCS= pbr.S label.S bootxx.S boot1.c
18 CPPFLAGS+= -DBOOTXX_SECTORS=${BOOTXX_SECTORS}
19 CPPFLAGS+= -DPRIMARY_LOAD_ADDRESS=${PRIMARY_LOAD_ADDRESS}
20 CPPFLAGS+= -DSECONDARY_LOAD_ADDRESS=${SECONDARY_LOAD_ADDRESS}
21 CPPFLAGS+= -DXXfs_open=${FS}_open
22 CPPFLAGS+= -DXXfs_close=${FS}_close
23 CPPFLAGS+= -DXXfs_read=${FS}_read
24 CPPFLAGS+= -DXXfs_stat=${FS}_stat
27 CPPFLAGS+= -DLIBSA_SINGLE_FILESYSTEM=xxfs \
29 -DLIBSA_NO_FD_CHECKING \
30 -DLIBSA_NO_RAW_ACCESS \
33 -DLIBSA_SINGLE_DEVICE=blkdev \
34 -DLIBKERN_OPTIMISE_SPACE \
35 -D"blkdevioctl(x,y,z)=EINVAL" \
36 -D"blkdevclose(f)=0" \
37 -D"devopen(f,n,fl)=(*(fl)=(void *)n,0)" \
38 -DLIBSA_NO_DISKLABEL_MSGS
40 SAMISCMAKEFLAGS+="SA_USE_LOADFILE=yes"
42 .include "../Makefile.bootprogs"
44 LIBLIST= ${LIBSA} ${LIBKERN}
46 CLEANFILES+= ${PROG}.sym ${PROG}.map
48 ${PROG}: ${OBJS} ${LIBLIST}
49 ${LD} -o ${PROG}.sym ${LDFLAGS} -Ttext ${PRIMARY_LOAD_ADDRESS} \
50 -Map ${PROG}.map -cref ${OBJS} ${LIBLIST}
51 ${OBJCOPY} -O binary ${PROG}.sym ${PROG}
52 @ sz=$$(ls -ln ${PROG} | tr -s ' ' | cut -d' ' -f5); \
53 if [ "$$sz" -gt "$$${BOOTXX_MAXSIZE}" ]; then \
54 echo "### ${PROG} size $$sz is larger than ${BOOTXX_MAXSIZE}" >&2 \
58 : pad to sector boundary; \
59 pad=$$(( 512 - ( $$sz & 511 ) )); \
61 dd if=/dev/zero bs=1 count=$$pad >>${PROG} 2>/dev/null; \
62 echo "${PROG} size $$sz, $$((${BOOTXX_MAXSIZE} - $$sz)) free"; \
65 .include <bsd.prog.mk>