1 1.1.2.2 nathanw # $NetBSD: Makefile.bootprogs,v 1.1.2.2 2002/11/11 22:03:20 nathanw Exp $ 2 1.1.2.2 nathanw 3 1.1.2.2 nathanw S= ${.CURDIR}/../../../.. 4 1.1.2.2 nathanw 5 1.1.2.2 nathanw .PATH: ${.CURDIR}/../common 6 1.1.2.2 nathanw 7 1.1.2.2 nathanw STRIPFLAG= 8 1.1.2.2 nathanw BINMODE= 444 9 1.1.2.2 nathanw 10 1.1.2.2 nathanw STRIP?= strip 11 1.1.2.2 nathanw 12 1.1.2.2 nathanw CHECKSIZE_CMD= SIZE=${SIZE} sh ${.CURDIR}/../common/checksize.sh 13 1.1.2.2 nathanw 14 1.1.2.2 nathanw .PHONY: machine-links 15 1.1.2.2 nathanw beforedepend: machine-links 16 1.1.2.2 nathanw # ${MACHINE} then ${MACHINE_ARCH} 17 1.1.2.2 nathanw machine-links: 18 1.1.2.2 nathanw -rm -f machine && \ 19 1.1.2.2 nathanw ln -s $S/arch/sbmips/include machine 20 1.1.2.2 nathanw -rm -f mips && \ 21 1.1.2.2 nathanw ln -s $S/arch/mips/include mips 22 1.1.2.2 nathanw CLEANFILES+=machine mips 23 1.1.2.2 nathanw 24 1.1.2.2 nathanw realall: machine-links ${PROG} 25 1.1.2.2 nathanw 26 1.1.2.2 nathanw AFLAGS+= -DASSEMBLER -D_LOCORE 27 1.1.2.2 nathanw # -I${.CURDIR}/../.. done by Makefile.inc 28 1.1.2.2 nathanw CPPFLAGS+= -nostdinc -I${.OBJDIR} -D_STANDALONE -I${S} 29 1.1.2.2 nathanw CFLAGS= -Os -g -ffreestanding -mno-abicalls -mno-half-pic -G 0 30 1.1.2.2 nathanw 31 1.1.2.2 nathanw NETBSD_VERS!=sh ${.CURDIR}/../../../../conf/osrelease.sh 32 1.1.2.2 nathanw CPPFLAGS+= -DNETBSD_VERS='"${NETBSD_VERS}"' 33 1.1.2.2 nathanw 34 1.1.2.2 nathanw CWARNFLAGS+= -Wno-main 35 1.1.2.2 nathanw 36 1.1.2.2 nathanw # if there is a 'version' file, add rule for vers.c and add it to SRCS 37 1.1.2.2 nathanw # and CLEANFILES 38 1.1.2.2 nathanw .if exists(version) 39 1.1.2.2 nathanw .PHONY: vers.c 40 1.1.2.2 nathanw vers.c: version 41 1.1.2.2 nathanw sh ${S}/conf/newvers_stand.sh -N ${.CURDIR}/version "sbmips" 42 1.1.2.2 nathanw 43 1.1.2.2 nathanw SRCS+= vers.c 44 1.1.2.2 nathanw CLEANFILES+= vers.c 45 1.1.2.2 nathanw .endif 46 1.1.2.2 nathanw 47 1.1.2.2 nathanw # 48 1.1.2.2 nathanw # Refer to CFE documentation for a description of these regions. 49 1.1.2.2 nathanw # 50 1.1.2.2 nathanw 51 1.1.2.2 nathanw REGION1_START= 0x20000000 # "Region 1 start" 52 1.1.2.2 nathanw REGION1_SIZE!= expr 256 \* 1024 # 256k 53 1.1.2.2 nathanw 54 1.1.2.2 nathanw # our memory lauout: 55 1.1.2.2 nathanw 56 1.1.2.2 nathanw # 'unified' boot loaders (e.g. netboot) can consume all of region 57 1.1.2.2 nathanw # 1 for their text+data, or text+data+bss. 58 1.1.2.2 nathanw 59 1.1.2.2 nathanw UNIFIED_LOAD_ADDRESS= ${REGION1_START} 60 1.1.2.2 nathanw UNIFIED_MAX_LOAD!= expr ${REGION1_SIZE} 61 1.1.2.2 nathanw UNIFIED_MAX_TOTAL!= expr ${REGION1_SIZE} 62 1.1.2.2 nathanw 63 1.1.2.2 nathanw #UNIFIED_HEAP_START= right after secondary bss 64 1.1.2.2 nathanw UNIFIED_HEAP_LIMIT= (${REGION1_START} + ${REGION1_SIZE}) 65 1.1.2.2 nathanw 66 1.1.2.2 nathanw # two-stage boot loaders must share region 1. The first stage 67 1.1.2.2 nathanw # loads into the lowest portion, and uses the higest portion 68 1.1.2.2 nathanw # for its heap. The second stage loads in between the primary image 69 1.1.2.2 nathanw # and the heap, and can reuse the memory after it (i.e. the primary's 70 1.1.2.2 nathanw # heap) for its own heap. 71 1.1.2.2 nathanw 72 1.1.2.2 nathanw PRIMARY_LOAD_ADDRESS= ${REGION1_START} 73 1.1.2.2 nathanw #PRIMARY_MAX_LOAD= booter dependent, no more than ${PRIMARY_MAX_TOTAL} 74 1.1.2.2 nathanw PRIMARY_MAX_TOTAL!= expr 16 \* 1024 75 1.1.2.2 nathanw 76 1.1.2.2 nathanw # XXX SECONDARY_LOAD_ADDRESS should be 77 1.1.2.2 nathanw # XXX (${PRIMARY_LOAD_ADDRESS} + ${PRIMARY_MAX_TOTAL}) bt there's no easy 78 1.1.2.2 nathanw # XXX way to do that calculation and 'ld' wants a single number. 79 1.1.2.2 nathanw SECONDARY_LOAD_ADDRESS= 0x20004000 # XXX 80 1.1.2.2 nathanw SECONDARY_MAX_LOAD!= expr 112 \* 1024 81 1.1.2.2 nathanw SECONDARY_MAX_TOTAL!= expr ${REGION1_SIZE} - ${PRIMARY_MAX_TOTAL} 82 1.1.2.2 nathanw 83 1.1.2.2 nathanw PRIMARY_HEAP_START= (${SECONDARY_LOAD_ADDRESS} + ${SECONDARY_MAX_LOAD}) 84 1.1.2.2 nathanw PRIMARY_HEAP_LIMIT= (${REGION1_START} + ${REGION1_SIZE}) 85 1.1.2.2 nathanw 86 1.1.2.2 nathanw #SECONDARY_HEAP_START= right after secondary bss 87 1.1.2.2 nathanw SECONDARY_HEAP_LIMIT= (${REGION1_START} + ${REGION1_SIZE}) 88 1.1.2.2 nathanw 89 1.1.2.2 nathanw # standalone programs are like kernels. They load at 90 1.1.2.2 nathanw # 0xfffffc0000300000 and can use the rest of memory. 91 1.1.2.2 nathanw 92 1.1.2.2 nathanw STANDPROG_LOAD_ADDRESS= 0xfffffc0000300000 93 1.1.2.2 nathanw 94 1.1.2.2 nathanw 95 1.1.2.2 nathanw FILE_FORMAT_CPPFLAGS= -DBOOT_ECOFF -DBOOT_ELF 96 1.1.2.2 nathanw 97 1.1.2.2 nathanw UNIFIED_CPPFLAGS= -DUNIFIED_BOOTBLOCK \ 98 1.1.2.2 nathanw -DHEAP_LIMIT="${UNIFIED_HEAP_LIMIT}" \ 99 1.1.2.2 nathanw ${FILE_FORMAT_CPPFLAGS} 100 1.1.2.2 nathanw 101 1.1.2.2 nathanw PRIMARY_CPPFLAGS= -DPRIMARY_BOOTBLOCK \ 102 1.1.2.2 nathanw -DSECONDARY_LOAD_ADDRESS="${SECONDARY_LOAD_ADDRESS}" \ 103 1.1.2.2 nathanw -DSECONDARY_MAX_LOAD="${SECONDARY_MAX_LOAD}" \ 104 1.1.2.2 nathanw -DHEAP_LIMIT="${PRIMARY_HEAP_LIMIT}" \ 105 1.1.2.2 nathanw -DHEAP_START="${PRIMARY_HEAP_START}" 106 1.1.2.2 nathanw 107 1.1.2.2 nathanw SECONDARY_CPPFLAGS= -DSECONDARY_BOOTBLOCK \ 108 1.1.2.2 nathanw -DHEAP_LIMIT="${SECONDARY_HEAP_LIMIT}" \ 109 1.1.2.2 nathanw ${FILE_FORMAT_CPPFLAGS} 110 1.1.2.2 nathanw 111 1.1.2.2 nathanw STANDPROG_CPPFLAGS= -DSTANDALONE_PROGRAM 112 1.1.2.2 nathanw 113 1.1.2.2 nathanw .include <bsd.prog.mk> 114 1.1.2.2 nathanw 115 1.1.2.2 nathanw ### find out what to use for libkern 116 1.1.2.2 nathanw KERN_AS= library 117 1.1.2.2 nathanw .include "${S}/lib/libkern/Makefile.inc" 118 1.1.2.2 nathanw LIBKERN= ${KERNLIB} 119 1.1.2.2 nathanw 120 1.1.2.2 nathanw ### find out what to use for libz 121 1.1.2.2 nathanw Z_AS= library 122 1.1.2.2 nathanw .include "${S}/lib/libz/Makefile.inc" 123 1.1.2.2 nathanw LIBZ= ${ZLIB} 124 1.1.2.2 nathanw 125 1.1.2.2 nathanw ### find out what to use for libsa 126 1.1.2.2 nathanw SA_AS= library 127 1.1.2.2 nathanw SAMISCMAKEFLAGS+="SA_USE_LOADFILE=yes" 128 1.1.2.2 nathanw .include "${S}/lib/libsa/Makefile.inc" 129 1.1.2.2 nathanw LIBSA= ${SALIB} 130 1.1.2.2 nathanw 131 1.1.2.2 nathanw 132 1.1.2.2 nathanw /usr/lib/crt0.o: 133 1.1.2.2 nathanw true 134 1.1.2.2 nathanw 135 1.1.2.2 nathanw /usr/lib/crtbegin.o: 136 1.1.2.2 nathanw true 137 1.1.2.2 nathanw 138 1.1.2.2 nathanw /usr/lib/crtend.o: 139 1.1.2.2 nathanw true 140 1.1.2.2 nathanw 141 1.1.2.2 nathanw cleandir: cleandirlocal 142 1.1.2.2 nathanw cleandirlocal: 143 1.1.2.2 nathanw rm -rf lib 144