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 22# Temporary stuff while we're still embryonic 23NO_MODULES= 24 25STD8X16FONT?= iso 26 27.if !defined(S) 28.if exists(./@/.) 29S= ./@ 30.else 31S= ../../.. 32.endif 33.endif 34.include "$S/conf/kern.pre.mk" 35 36SYSTEM_LD:= ${SYSTEM_LD:$S/conf/ldscript.$M=ldscript.$M} 37SYSTEM_DEP:= ${SYSTEM_DEP:$S/conf/ldscript.$M=ldscript.$M} 38 39.if defined(ARM_BIG_ENDIAN) 40CC += -mbig-endian 41SYSTEM_LD += -EB 42LD += -EB 43.else 44CC += -mlittle-endian 45SYSTEM_LD += -EL 46LD += -EL 47.endif 48 49 50.if !defined(DEBUG) && !defined(PROFLEVEL) 51STRIP_FLAGS = -S 52.endif 53 54DDB_ENABLED!= grep DDB opt_ddb.h || true 55 56.if empty(DDB_ENABLED) 57CFLAGS += -mno-apcs-frame 58.endif 59 60SYSTEM_LD_ = ${LD} -Bdynamic -T ldscript.$M.noheader \ 61 -warn-common -export-dynamic -dynamic-linker /red/herring -o \ 62 ${FULLKERNEL}.noheader -X ${SYSTEM_OBJS} vers.o 63SYSTEM_LD_TAIL +=;sed s/" + SIZEOF_HEADERS"// ldscript.$M\ 64 >ldscript.$M.noheader; \ 65 ${SYSTEM_LD_}; \ 66 ${OBJCOPY} -S -O binary ${FULLKERNEL}.noheader \ 67 ${KERNEL_KO}.bin; \ 68 rm ${FULLKERNEL}.noheader 69 70.if defined(MFS_IMAGE) 71SYSTEM_LD_TAIL += ;sh ${S}/tools/embed_mfs.sh ${KERNEL_KO}.bin ${MFS_IMAGE}; 72.endif 73 74FILES_CPU_FUNC = $S/$M/$M/cpufunc_asm_arm7tdmi.S \ 75 $S/$M/$M/cpufunc_asm_arm8.S $S/$M/$M/cpufunc_asm_arm9.S \ 76 $S/$M/$M/cpufunc_asm_sa1.S $S/$M/$M/cpufunc_asm_arm10.S \ 77 $S/$M/$M/cpufunc_asm_xscale.S $S/$M/$M/cpufunc_asm.S \ 78 $S/$M/$M/cpufunc_asm_xscale_c3.S $S/$M/$M/cpufunc_asm_armv5_ec.S 79KERNEL_EXTRA=trampoline 80KERNEL_EXTRA_INSTALL=kernel.gz.tramp 81trampoline: ${KERNEL_KO}.tramp 82${KERNEL_KO}.tramp: ${KERNEL_KO} $S/$M/$M/inckern.S $S/$M/$M/elf_trampoline.c 83 echo "#define KERNNAME \"${KERNEL_KO}.tmp\"" >opt_kernname.h 84 sed s/${KERNVIRTADDR}/${KERNPHYSADDR}/ ldscript.$M > ldscript.$M.tramp 85 sed s/" + SIZEOF_HEADERS"// ldscript.$M.tramp > \ 86 ldscript.$M.tramp.noheader 87 echo "#include <machine/asm.h>" >tmphack.S 88 echo "ENTRY(_start)" >>tmphack.S 89 echo "bl _startC" >>tmphack.S 90 ${OBJCOPY} --strip-symbol '$$d' --strip-symbol '$$a' \ 91 -g --strip-symbol '$$t' ${FULLKERNEL} ${KERNEL_KO}.tmp 92 eval $$(stat -s ${KERNEL_KO}.tmp) && \ 93 echo "#define KERNSIZE $$st_size" >>opt_kernname.h 94 ${CC} -O -nostdlib -I. -Xlinker -T -Xlinker ldscript.$M.tramp \ 95 tmphack.S $S/$M/$M/elf_trampoline.c $S/$M/$M/inckern.S \ 96 ${FILES_CPU_FUNC} -o ${KERNEL_KO}.tramp 97 ${CC} -O -nostdlib -I. -Xlinker -T -Xlinker ldscript.$M.tramp.noheader \ 98 tmphack.S $S/$M/$M/elf_trampoline.c $S/$M/$M/inckern.S \ 99 ${FILES_CPU_FUNC} -o ${KERNEL_KO}.tramp.noheader 100 ${OBJCOPY} -S -O binary ${KERNEL_KO}.tramp.noheader \ 101 ${KERNEL_KO}.tramp.bin 102 ${OBJCOPY} ${STRIP_FLAGS} ${KERNEL_KO}.tmp 103 echo "#define KERNNAME \"${KERNEL_KO}.tmp.gz\"" \ 104 >opt_kernname.h 105 eval $$(stat -s ${KERNEL_KO}.tmp) && \ 106 echo "#define KERNSIZE $$st_size" >>opt_kernname.h 107 gzip -9 ${KERNEL_KO}.tmp 108 eval $$(stat -s ${KERNEL_KO}.tmp.gz) && \ 109 echo "#define KERNCOMPSIZE $$st_size" >>opt_kernname.h 110 ${CC} -O2 -DKZIP -I. -c $S/kern/inflate.c -o inflate-tramp.o 111 ${CC} -O -nostdlib -I. -Xlinker -T -Xlinker ldscript.$M.tramp \ 112 -DKZIP tmphack.S $S/$M/$M/elf_trampoline.c inflate-tramp.o \ 113 $S/$M/$M/inckern.S ${FILES_CPU_FUNC} -o ${KERNEL_KO}.gz.tramp 114 ${CC} -O -nostdlib -I. -Xlinker -T -Xlinker 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 122%BEFORE_DEPEND 123 124%OBJS 125 126%FILES.c 127 128%FILES.s 129 130%FILES.m 131 132%CLEAN 133 134CLEAN+= ldscript.$M ${KERNEL_KO}.bin ldscript.$M.noheader 135 136.if ${DDB_ENABLED} != "" 137CLEAN+= ${KERNEL_KO}.tramp ${KERNEL_KO}.tramp.bin ldscript.$M.tramp \ 138 ldscript.$M.tramp.noheader ${KERNEL_KO}.gz.tramp \ 139 ${KERNEL_KO}.gz.tramp.bin 140 141.endif 142ldscript.$M: $S/conf/ldscript.$M 143 cat $S/conf/ldscript.$M|sed s/KERNPHYSADDR/${KERNPHYSADDR}/g| \ 144 sed s/KERNVIRTADDR/${KERNVIRTADDR}/g > ldscript.$M 145%RULES 146 147.include "$S/conf/kern.post.mk" 148