1178170Simp# Makefile.mips 2178170Simp# $FreeBSD$ 3178170Simp# 4178170Simp# Makefile for FreeBSD 5178170Simp# 6178170Simp# This makefile is constructed from a machine description: 7178170Simp# config machineid 8178170Simp# Most changes should be made in the machine description 9178170Simp# /sys/mips/conf/``machineid'' 10178170Simp# after which you should do 11178170Simp# config machineid 12178170Simp# Generic makefile changes should be made in 13178170Simp# /sys/conf/Makefile.mips 14178170Simp# after which config should be rerun for all machines. 15178170Simp# 16178170Simp 17178170Simp# Which version of config(8) is required. 18178170Simp%VERSREQ= 600004 19178170Simp 20178170SimpSTD8X16FONT?= iso 21178170Simp 22178170Simp.if !defined(S) 23178170Simp.if exists(./@/.) 24178170SimpS= ./@ 25178170Simp.else 26178170SimpS= ../../.. 27178170Simp.endif 28178170Simp.endif 29178170Simp.include "$S/conf/kern.pre.mk" 30178170Simp 31226496SjchandraINCLUDES+= -I$S/contrib/libfdt 32226496Sjchandra 33201984SimpLDSCRIPT_NAME?=ldscript.$M 34201984SimpSYSTEM_LD:= ${SYSTEM_LD:$S/conf/${LDSCRIPT_NAME}=${LDSCRIPT_NAME}} 35201984SimpSYSTEM_DEP:= ${SYSTEM_DEP:$S/conf/${LDSCRIPT_NAME}=${LDSCRIPT_NAME}} 36201984Simp 37201984SimpKERNLOADADDR?=0x80001000 38201984Simp# This obscure value is defined by CFE for WR160N 39201984Simp# To be changed later 40201984SimpTRAMPLOADADDR?=0x807963c0 41178170Simp 42178170SimpMKMODULESENV+= MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH} 43178170Simp 44178170Simp# We default to the MIPS32 ISA, if none specified in the 45178170Simp# kernel configuration file. 46178170SimpARCH_FLAGS?=-march=mips32 47232998SgonzoEXTRA_FLAGS=-fno-pic -mno-abicalls -G0 -DKERNLOADADDR=${KERNLOADADDR} 48178170Simp 49178170SimpHACK_EXTRA_FLAGS=-shared 50178170Simp 51178170Simp# We add the -fno-pic flag to kernels because otherwise performance 52178170Simp# is extremely poor, as well as -mno-abicalls to force no ABI usage. 53201984SimpCFLAGS+=${EXTRA_FLAGS} $(ARCH_FLAGS) 54201984SimpHACK_EXTRA_FLAGS+=${EXTRA_FLAGS} $(ARCH_FLAGS) 55224105SjchandraTRAMP_ARCH_FLAGS?=$(ARCH_FLAGS) 56224105SjchandraTRAMP_EXTRA_FLAGS=${EXTRA_FLAGS} ${TRAMP_ARCH_FLAGS} 57224105Sjchandra.if ${MACHINE_ARCH:Mmips64*} != "" 58224105SjchandraTRAMP_ELFSIZE=64 59224105Sjchandra.else 60224105SjchandraTRAMP_ELFSIZE=32 61224105Sjchandra.endif 62178170Simp 63178170Simp# XXX hardcoded kernel entry point 64178170SimpASM_CFLAGS+=${CFLAGS} -D_LOCORE -DLOCORE 65178170Simp 66232913Sjmallett.if !defined(WITHOUT_KERNEL_TRAMPOLINE) 67201984SimpKERNEL_EXTRA=trampoline 68201984Simptrampoline: ${KERNEL_KO}.tramp.bin 69201984Simp${KERNEL_KO}.tramp.bin: ${KERNEL_KO} $S/$M/$M/elf_trampoline.c \ 70201984Simp $S/$M/$M/inckern.S 71201984Simp ${OBJCOPY} --strip-symbol '$$d' --strip-symbol '$$a' \ 72216498Sjchandra -g --strip-symbol '$$t' ${FULLKERNEL} ${KERNEL_KO}.tmp 73216498Sjchandra sed -e s/${KERNLOADADDR}/${TRAMPLOADADDR}/ -e s/" + SIZEOF_HEADERS"// \ 74216498Sjchandra ${LDSCRIPT_NAME} > ${LDSCRIPT_NAME}.tramp.noheader 75216474Sjchandra ${CC} -O -nostdlib -I. -I$S ${TRAMP_EXTRA_FLAGS} ${TRAMP_LDFLAGS} -Xlinker \ 76224105Sjchandra -T -Xlinker ${LDSCRIPT_NAME}.tramp.noheader \ 77224105Sjchandra -DKERNNAME="\"${KERNEL_KO}.tmp\"" -DELFSIZE=${TRAMP_ELFSIZE} \ 78224105Sjchandra $S/$M/$M/elf_trampoline.c $S/$M/$M/inckern.S \ 79224105Sjchandra -o ${KERNEL_KO}.tramp.elf 80224105Sjchandra ${OBJCOPY} -S -O binary ${KERNEL_KO}.tramp.elf \ 81224105Sjchandra ${KERNEL_KO}.tramp.bin 82232913Sjmallett.endif 83201984Simp 84178170Simp%BEFORE_DEPEND 85178170Simp 86178170Simp%OBJS 87178170Simp 88178170Simp%FILES.c 89178170Simp 90178170Simp%FILES.s 91178170Simp 92178170Simp%FILES.m 93178170Simp 94178170Simp%CLEAN 95178170Simp 96201984SimpCLEAN+= ${LDSCRIPT_NAME} ${LDSCRIPT_NAME}.tramp.noheader \ 97224105Sjchandra ${KERNEL_KO}.tramp.elf ${KERNEL_KO}.tramp.bin 98201984Simp 99201984Simp${LDSCRIPT_NAME}: $S/conf/${LDSCRIPT_NAME} 100217220Sjchandra sed s/KERNLOADADDR/${KERNLOADADDR}/g $S/conf/${LDSCRIPT_NAME} \ 101201984Simp > ${LDSCRIPT_NAME} 102178170Simp%RULES 103178170Simp 104178170Simp.include "$S/conf/kern.post.mk" 105