1# Makefile.arm -- with config changes. 2# Copyright 1990 W. Jolitz 3# from: @(#)Makefile.i386 7.1 5/10/91 4# $FreeBSD$ 5# 6# Makefile for FreeBSD 7# 8# This makefile is constructed from a machine description: 9# config machineid 10# Most changes should be made in the machine description 11# /sys/arm/conf/``machineid'' 12# after which you should do 13# config machineid 14# Generic makefile changes should be made in 15# /sys/conf/Makefile.arm 16# after which config should be rerun for all machines. 17# 18 19# Which version of config(8) is required. 20%VERSREQ= 600004 21 22STD8X16FONT?= iso 23 24.if !defined(S) 25.if exists(./@/.) 26S= ./@ 27.else 28S= ../../.. 29.endif 30.endif 31.include "$S/conf/kern.pre.mk" 32 33SYSTEM_LD:= ${SYSTEM_LD:$S/conf/ldscript.$M=ldscript.$M} 34SYSTEM_DEP:= ${SYSTEM_DEP:$S/conf/ldscript.$M=ldscript.$M} 35 36.if defined(ARM_BIG_ENDIAN) 37CC += -mbig-endian 38SYSTEM_LD += -EB 39LD += -EB 40.else 41CC += -mlittle-endian 42SYSTEM_LD += -EL 43LD += -EL 44.endif 45 46 47.if !defined(DEBUG) && !defined(PROFLEVEL) 48STRIP_FLAGS = -S 49.endif 50 51DDB_ENABLED!= grep DDB opt_ddb.h || true 52 53.if empty(DDB_ENABLED) 54CFLAGS += -mno-apcs-frame 55.endif 56 57SYSTEM_LD_ = ${LD} -Bdynamic -T ldscript.$M.noheader \ 58 -warn-common -export-dynamic -dynamic-linker /red/herring -o \ 59 ${FULLKERNEL}.noheader -X ${SYSTEM_OBJS} vers.o 60SYSTEM_LD_TAIL +=;sed s/" + SIZEOF_HEADERS"// ldscript.$M\ 61 >ldscript.$M.noheader; \ 62 ${SYSTEM_LD_}; \ 63 ${OBJCOPY} -S -O binary ${FULLKERNEL}.noheader \ 64 ${KERNEL_KO}.bin; \ 65 rm ${FULLKERNEL}.noheader 66 67.if defined(MFS_IMAGE) 68SYSTEM_LD_TAIL += ;sh ${S}/tools/embed_mfs.sh ${KERNEL_KO}.bin ${MFS_IMAGE}; 69.endif 70 71FILES_CPU_FUNC = $S/$M/$M/cpufunc_asm_arm7tdmi.S \ 72 $S/$M/$M/cpufunc_asm_arm8.S $S/$M/$M/cpufunc_asm_arm9.S \ 73 $S/$M/$M/cpufunc_asm_sa1.S $S/$M/$M/cpufunc_asm_arm10.S \ 74 $S/$M/$M/cpufunc_asm_xscale.S $S/$M/$M/cpufunc_asm.S \ 75 $S/$M/$M/cpufunc_asm_xscale_c3.S $S/$M/$M/cpufunc_asm_armv5_ec.S \ 76 $S/$M/$M/cpufunc_asm_sheeva.S 77KERNEL_EXTRA=trampoline 78KERNEL_EXTRA_INSTALL=kernel.gz.tramp 79trampoline: ${KERNEL_KO}.tramp 80${KERNEL_KO}.tramp: ${KERNEL_KO} $S/$M/$M/inckern.S $S/$M/$M/elf_trampoline.c 81 echo "#define KERNNAME \"${KERNEL_KO}.tmp\"" >opt_kernname.h 82 sed s/${KERNVIRTADDR}/${KERNPHYSADDR}/ ldscript.$M > ldscript.$M.tramp 83 sed s/" + SIZEOF_HEADERS"// ldscript.$M.tramp > \ 84 ldscript.$M.tramp.noheader 85 echo "#include <machine/asm.h>" >tmphack.S 86 echo "ENTRY(_start)" >>tmphack.S 87 echo "bl _startC" >>tmphack.S 88 ${OBJCOPY} --strip-symbol '$$d' --strip-symbol '$$a' \ 89 -g --strip-symbol '$$t' ${FULLKERNEL} ${KERNEL_KO}.tmp 90 eval $$(stat -s ${KERNEL_KO}.tmp) && \ 91 echo "#define KERNSIZE $$st_size" >>opt_kernname.h 92 ${CC} -O -nostdlib -I. -I$S -Xlinker -T -Xlinker ldscript.$M.tramp \ 93 tmphack.S $S/$M/$M/elf_trampoline.c $S/$M/$M/inckern.S \ 94 ${FILES_CPU_FUNC} -o ${KERNEL_KO}.tramp 95 ${CC} -O -nostdlib -I. -I$S -Xlinker -T -Xlinker \ 96 ldscript.$M.tramp.noheader \ 97 tmphack.S $S/$M/$M/elf_trampoline.c $S/$M/$M/inckern.S \ 98 ${FILES_CPU_FUNC} -o ${KERNEL_KO}.tramp.noheader 99 ${OBJCOPY} -S -O binary ${KERNEL_KO}.tramp.noheader \ 100 ${KERNEL_KO}.tramp.bin 101 ${OBJCOPY} ${STRIP_FLAGS} ${KERNEL_KO}.tmp 102 echo "#define KERNNAME \"${KERNEL_KO}.tmp.gz\"" \ 103 >opt_kernname.h 104 eval $$(stat -s ${KERNEL_KO}.tmp) && \ 105 echo "#define KERNSIZE $$st_size" >>opt_kernname.h 106 gzip -9 ${KERNEL_KO}.tmp 107 eval $$(stat -s ${KERNEL_KO}.tmp.gz) && \ 108 echo "#define KERNCOMPSIZE $$st_size" >>opt_kernname.h 109 ${CC} -O2 -DKZIP -I. -I$S -c $S/kern/inflate.c -o inflate-tramp.o 110 ${CC} -O -nostdlib -I. -I$S -Xlinker -T -Xlinker ldscript.$M.tramp \ 111 -DKZIP tmphack.S $S/$M/$M/elf_trampoline.c inflate-tramp.o \ 112 $S/$M/$M/inckern.S ${FILES_CPU_FUNC} -o ${KERNEL_KO}.gz.tramp 113 ${CC} -O -nostdlib -I. -I$S -Xlinker -T -Xlinker \ 114 ldscript.$M.tramp.noheader \ 115 -DKZIP tmphack.S $S/$M/$M/elf_trampoline.c inflate-tramp.o \ 116 $S/$M/$M/inckern.S ${FILES_CPU_FUNC} -o ${KERNEL_KO}.tramp.noheader 117 ${OBJCOPY} -S -O binary ${KERNEL_KO}.tramp.noheader \ 118 ${KERNEL_KO}.gz.tramp.bin 119 rm ${KERNEL_KO}.tmp.gz ${KERNEL_KO}.tramp.noheader opt_kernname.h \ 120 inflate-tramp.o tmphack.S 121 122MKMODULESENV+= MACHINE=${MACHINE} 123 124%BEFORE_DEPEND 125 126%OBJS 127 128%FILES.c 129 130%FILES.s 131 132%FILES.m 133 134%CLEAN 135 136CLEAN+= ldscript.$M ${KERNEL_KO}.bin ldscript.$M.noheader 137 138.if ${DDB_ENABLED} != "" 139CLEAN+= ${KERNEL_KO}.tramp ${KERNEL_KO}.tramp.bin ldscript.$M.tramp \ 140 ldscript.$M.tramp.noheader ${KERNEL_KO}.gz.tramp \ 141 ${KERNEL_KO}.gz.tramp.bin 142 143.endif 144ldscript.$M: $S/conf/ldscript.$M 145 cat $S/conf/ldscript.$M|sed s/KERNPHYSADDR/${KERNPHYSADDR}/g| \ 146 sed s/KERNVIRTADDR/${KERNVIRTADDR}/g > ldscript.$M 147%RULES 148 149.include "$S/conf/kern.post.mk" 150