6 # This makefile is constructed from a machine description:
8 # Most changes should be made in the machine description
9 # /sys/mips/conf/``machineid''
10 # after which you should do
12 # Generic makefile changes should be made in
13 # /sys/conf/Makefile.mips
14 # after which config should be rerun for all machines.
17 # Which version of config(8) is required.
29 .include "$S/conf/kern.pre.mk"
31 INCLUDES+= -I$S/contrib/libfdt
33 LDSCRIPT_NAME?=ldscript.$M
34 SYSTEM_LD:= ${SYSTEM_LD:$S/conf/${LDSCRIPT_NAME}=${LDSCRIPT_NAME}}
35 SYSTEM_DEP:= ${SYSTEM_DEP:$S/conf/${LDSCRIPT_NAME}=${LDSCRIPT_NAME}}
37 KERNLOADADDR?=0x80001000
38 # This obscure value is defined by CFE for WR160N
40 TRAMPLOADADDR?=0x807963c0
42 # We default to the MIPS32 ISA for O32 and MIPS64 ISA for N64 and N32
43 # if none is specified in the kernel configuration file.
44 .if ${MACHINE_ARCH:Mmips64*} != "" || ${MACHINE_ARCH:Mmipsn32*} != ""
45 ARCH_FLAGS?=-march=mips64
47 ARCH_FLAGS?=-march=mips32
49 ARCH_FLAGS+=-mabi=${MIPS_ABI}
50 EXTRA_FLAGS=-fno-pic -mno-abicalls -G0 -DKERNLOADADDR=${KERNLOADADDR}
51 EXTRA_FLAGS+=-${MIPS_ENDIAN}
53 # We add the -fno-pic flag to kernels because otherwise performance
54 # is extremely poor, as well as -mno-abicalls to force no ABI usage.
55 CFLAGS+=${EXTRA_FLAGS} $(ARCH_FLAGS)
56 TRAMP_ARCH_FLAGS?=$(ARCH_FLAGS)
57 TRAMP_EXTRA_FLAGS=${EXTRA_FLAGS} ${TRAMP_ARCH_FLAGS}
58 # Kernel code is always compiled with soft-float on MIPS
59 TRAMP_EXTRA_FLAGS+=-msoft-float
60 .if ${MACHINE_ARCH:Mmips64*} != ""
66 ASM_CFLAGS+=${CFLAGS} -D_LOCORE -DLOCORE
68 .if !defined(WITHOUT_KERNEL_TRAMPOLINE)
69 KERNEL_EXTRA=trampoline
70 KERNEL_EXTRA_INSTALL=${KERNEL_KO}.tramp.bin
71 trampoline: ${KERNEL_KO}.tramp.bin
72 ${KERNEL_KO}.tramp.bin: ${KERNEL_KO} $S/$M/$M/elf_trampoline.c \
74 ${OBJCOPY} --strip-symbol '$$d' --strip-symbol '$$a' \
75 -g --strip-symbol '$$t' ${FULLKERNEL} ${KERNEL_KO}.tmp
76 sed -e s/${KERNLOADADDR}/${TRAMPLOADADDR}/ -e s/" + SIZEOF_HEADERS"// \
77 ${LDSCRIPT_NAME} > ${LDSCRIPT_NAME}.tramp.noheader
78 ${CC} -O -nostdlib -I. -I$S ${TRAMP_EXTRA_FLAGS} ${TRAMP_LDFLAGS} -Xlinker \
79 -T -Xlinker ${LDSCRIPT_NAME}.tramp.noheader \
80 -DKERNNAME="\"${KERNEL_KO}.tmp\"" -DELFSIZE=${TRAMP_ELFSIZE} \
81 -fno-asynchronous-unwind-tables \
82 $S/$M/$M/inckern.S $S/$M/$M/elf_trampoline.c \
83 -o ${KERNEL_KO}.tramp.elf
84 ${OBJCOPY} -S -O binary ${KERNEL_KO}.tramp.elf \
85 ${KERNEL_KO}.tramp.bin
100 CLEAN+= ${LDSCRIPT_NAME} ${LDSCRIPT_NAME}.tramp.noheader \
101 ${KERNEL_KO}.tramp.elf ${KERNEL_KO}.tramp.bin
103 ${LDSCRIPT_NAME}: $S/conf/${LDSCRIPT_NAME}
104 sed s/KERNLOADADDR/${KERNLOADADDR}/g $S/conf/${LDSCRIPT_NAME} \
108 .include "$S/conf/kern.post.mk"