1# $NetBSD: Makefile.bootxx,v 1.11 2014/08/24 18:27:17 apb Exp $ 2 3SRCS = start.S bootxx.c booted_dev.c blkdev.c prom.c prom_disp.S \ 4 putstr.c panic_putstr.c 5 6# XXX sometimes useful for debugging 7# SRCS += putulong.c 8 9BOOT_RELOC = ${PRIMARY_LOAD_ADDRESS} 10 11CPPFLAGS += ${PRIMARY_CPPFLAGS} \ 12 -DLIBSA_FS_SINGLECOMPONENT -DLIBSA_NO_FS_WRITE \ 13 -DLIBSA_NO_FS_CLOSE -DLIBSA_NO_FS_SEEK \ 14 -DLIBSA_SINGLE_DEVICE=blkdev \ 15 -D"blkdevioctl(x,y,z)=EINVAL" -D"blkdevclose(f)=0" \ 16 -DLIBSA_NO_TWIDDLE \ 17 -DLIBSA_NO_FD_CHECKING \ 18 -DLIBSA_NO_RAW_ACCESS \ 19 -DLIBSA_NO_DISKLABEL_MSGS 20 21CLEANFILES+= ${PROG}.sym ${PROG}.map ${PROG}.lds 22 23${PROG}: ${PROG}.sym 24 @echo creating ${PROG} from ${PROG}.sym... 25 @${OBJCOPY} --output-target=binary ${PROG}.sym ${PROG} 26 @chmod 644 ${PROG} 27 @ls -l ${PROG} 28 @${CHECKSIZE_CMD} ${PROG}.sym ${PROG} ${PRIMARY_MAX_LOAD} \ 29 ${PRIMARY_MAX_TOTAL} || (rm -f ${PROG} ; false) 30 31SAMISCMAKEFLAGS= SA_INCLUDE_NET=no SA_USE_CREAD=no 32.include "../Makefile.bootprogs" 33 34# We need to strip out the .eh_frame section from the final object. 35# To do this, we get the linker's idea of the ldscript, and assign 36# any .eh_frame sections to the special "DISCARD" section so that 37# they are not included in the final object. 38 39${PROG}.sym: ${OBJS} ${LIBSA} ${LIBKERN} 40 ${_MKTARGET_LINK} 41 @${LD} -Ttext 0x20000000 -N --verbose 2>&1 \ 42 | ${TOOL_SED} -n -e '/^==========/,/^===========/{' \ 43 -e '/^========/d' \ 44 -e 's,^[[:blank:]]*\.eh_frame[[:blank:]]*:, /DISCARD/ : ,' \ 45 -e 'p' -e '}' \ 46 > ${PROG}.lds 47 ${LD} -T ${PROG}.lds -Ttext ${BOOT_RELOC} -N -e start \ 48 -o ${PROG}.sym ${OBJS} ${LIBSA} ${LIBKERN} -Map ${PROG}.map 49 @chmod 644 ${PROG}.sym 50 @${SIZE} ${PROG}.sym 51