xref: /netbsd-src/sys/arch/alpha/stand/Makefile.bootxx (revision 500db002748d9818288e46e10f026a2b09548086)
1# $NetBSD: Makefile.bootxx,v 1.8 2008/10/25 22:27:36 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		-DLIBSA_USE_MEMCPY
21
22CLEANFILES+= ${PROG}.sym ${PROG}.map ${PROG}.lds
23
24${PROG}: ${PROG}.sym
25	@echo creating ${PROG} from ${PROG}.sym...
26	@${OBJCOPY} --output-target=binary ${PROG}.sym ${PROG}
27	@chmod 644 ${PROG}
28	@ls -l ${PROG}
29	@${CHECKSIZE_CMD} ${PROG}.sym ${PROG} ${PRIMARY_MAX_LOAD} \
30	    ${PRIMARY_MAX_TOTAL} || (rm -f ${PROG} ; false)
31
32SAMISCMAKEFLAGS= SA_INCLUDE_NET=no SA_USE_CREAD=no
33.include "../Makefile.bootprogs"
34
35# We need to strip out the .eh_frame section from the final object.
36# To do this, we get the linker's idea of the ldscript, and assign
37# any .eh_frame sections to the special "DISCARD" section so that
38# they are not included in the final object.
39
40${PROG}.sym: ${OBJS} ${LIBSA} ${LIBKERN}
41	@${LD} -Ttext 0x20000000 -N --verbose 2>&1 \
42	    | ${TOOL_SED} -n '/^==========/,/^===========/{/^========/d; \
43	    s,^[[:blank:]]*\.eh_frame[[:blank:]]*:,  /DISCARD/ : ,;p;}' \
44	    > ${PROG}.lds
45	${LD} -T ${PROG}.lds -Ttext ${BOOT_RELOC} -N -e start \
46	    -o ${PROG}.sym ${OBJS} ${LIBSA} ${LIBKERN} -Map ${PROG}.map
47	@chmod 644 ${PROG}.sym
48	@${SIZE} ${PROG}.sym
49