1# Makefile.mips 2# $FreeBSD$ 3# 4# Makefile for FreeBSD 5# 6# This makefile is constructed from a machine description: 7# config machineid 8# Most changes should be made in the machine description 9# /sys/mips/conf/``machineid'' 10# after which you should do 11# config machineid 12# Generic makefile changes should be made in 13# /sys/conf/Makefile.mips 14# after which config should be rerun for all machines. 15# 16 17# Which version of config(8) is required. 18%VERSREQ= 600012 19 20STD8X16FONT?= iso 21 22.if !defined(S) 23.if exists(./@/.) 24S= ./@ 25.else 26S= ../../.. 27.endif 28.endif 29.include "$S/conf/kern.pre.mk" 30 31INCLUDES+= -I$S/contrib/libfdt 32 33LDSCRIPT_NAME?=ldscript.$M 34SYSTEM_LD:= ${SYSTEM_LD:$S/conf/${LDSCRIPT_NAME}=${LDSCRIPT_NAME}} 35SYSTEM_DEP:= ${SYSTEM_DEP:$S/conf/${LDSCRIPT_NAME}=${LDSCRIPT_NAME}} 36 37KERNLOADADDR?=0x80001000 38# This obscure value is defined by CFE for WR160N 39# To be changed later 40TRAMPLOADADDR?=0x807963c0 41 42# We default to the MIPS32 ISA, if none specified in the 43# kernel configuration file. 44ARCH_FLAGS?=-march=mips32 45EXTRA_FLAGS=-fno-pic -mno-abicalls -G0 -DKERNLOADADDR=${KERNLOADADDR} 46 47# We add the -fno-pic flag to kernels because otherwise performance 48# is extremely poor, as well as -mno-abicalls to force no ABI usage. 49CFLAGS+=${EXTRA_FLAGS} $(ARCH_FLAGS) 50TRAMP_ARCH_FLAGS?=$(ARCH_FLAGS) 51TRAMP_EXTRA_FLAGS=${EXTRA_FLAGS} ${TRAMP_ARCH_FLAGS} 52# Kernel code is always compiled with soft-float on MIPS 53TRAMP_EXTRA_FLAGS+=-msoft-float 54.if ${MACHINE_ARCH:Mmips64*} != "" 55TRAMP_ELFSIZE=64 56.else 57TRAMP_ELFSIZE=32 58.endif 59 60ASM_CFLAGS+=${CFLAGS} -D_LOCORE -DLOCORE 61 62.if !defined(WITHOUT_KERNEL_TRAMPOLINE) 63KERNEL_EXTRA=trampoline 64KERNEL_EXTRA_INSTALL=${KERNEL_KO}.tramp.bin 65trampoline: ${KERNEL_KO}.tramp.bin 66${KERNEL_KO}.tramp.bin: ${KERNEL_KO} $S/$M/$M/elf_trampoline.c \ 67 $S/$M/$M/inckern.S 68 ${OBJCOPY} --strip-symbol '$$d' --strip-symbol '$$a' \ 69 -g --strip-symbol '$$t' ${FULLKERNEL} ${KERNEL_KO}.tmp 70 sed -e s/${KERNLOADADDR}/${TRAMPLOADADDR}/ -e s/" + SIZEOF_HEADERS"// \ 71 ${LDSCRIPT_NAME} > ${LDSCRIPT_NAME}.tramp.noheader 72 ${CC} -O -nostdlib -I. -I$S ${TRAMP_EXTRA_FLAGS} ${TRAMP_LDFLAGS} -Xlinker \ 73 -T -Xlinker ${LDSCRIPT_NAME}.tramp.noheader \ 74 -DKERNNAME="\"${KERNEL_KO}.tmp\"" -DELFSIZE=${TRAMP_ELFSIZE} \ 75 $S/$M/$M/inckern.S $S/$M/$M/elf_trampoline.c \ 76 -o ${KERNEL_KO}.tramp.elf 77 ${OBJCOPY} -S -O binary ${KERNEL_KO}.tramp.elf \ 78 ${KERNEL_KO}.tramp.bin 79.endif 80 81%BEFORE_DEPEND 82 83%OBJS 84 85%FILES.c 86 87%FILES.s 88 89%FILES.m 90 91%CLEAN 92 93CLEAN+= ${LDSCRIPT_NAME} ${LDSCRIPT_NAME}.tramp.noheader \ 94 ${KERNEL_KO}.tramp.elf ${KERNEL_KO}.tramp.bin 95 96${LDSCRIPT_NAME}: $S/conf/${LDSCRIPT_NAME} 97 sed s/KERNLOADADDR/${KERNLOADADDR}/g $S/conf/${LDSCRIPT_NAME} \ 98 > ${LDSCRIPT_NAME} 99%RULES 100 101.include "$S/conf/kern.post.mk" 102