2004-05-14 11:49:40 +00:00
|
|
|
# Makefile.arm -- with config changes.
|
|
|
|
# Copyright 1990 W. Jolitz
|
|
|
|
# from: @(#)Makefile.i386 7.1 5/10/91
|
|
|
|
# $FreeBSD$
|
|
|
|
#
|
|
|
|
# Makefile for FreeBSD
|
|
|
|
#
|
|
|
|
# This makefile is constructed from a machine description:
|
|
|
|
# config machineid
|
|
|
|
# Most changes should be made in the machine description
|
2004-09-23 22:47:57 +00:00
|
|
|
# /sys/arm/conf/``machineid''
|
2004-05-14 11:49:40 +00:00
|
|
|
# after which you should do
|
|
|
|
# config machineid
|
|
|
|
# Generic makefile changes should be made in
|
2004-09-23 22:47:57 +00:00
|
|
|
# /sys/conf/Makefile.arm
|
2004-05-14 11:49:40 +00:00
|
|
|
# after which config should be rerun for all machines.
|
|
|
|
#
|
|
|
|
|
|
|
|
# Which version of config(8) is required.
|
2007-05-16 17:23:54 +00:00
|
|
|
%VERSREQ= 600004
|
2004-05-14 11:49:40 +00:00
|
|
|
|
|
|
|
STD8X16FONT?= iso
|
|
|
|
|
|
|
|
.if !defined(S)
|
|
|
|
.if exists(./@/.)
|
|
|
|
S= ./@
|
|
|
|
.else
|
|
|
|
S= ../../..
|
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
.include "$S/conf/kern.pre.mk"
|
|
|
|
|
2010-06-13 13:28:53 +00:00
|
|
|
INCLUDES+= -I$S/contrib/libfdt
|
|
|
|
|
2004-09-23 22:47:57 +00:00
|
|
|
SYSTEM_LD:= ${SYSTEM_LD:$S/conf/ldscript.$M=ldscript.$M}
|
|
|
|
SYSTEM_DEP:= ${SYSTEM_DEP:$S/conf/ldscript.$M=ldscript.$M}
|
2005-01-19 16:43:43 +00:00
|
|
|
|
2006-03-27 00:32:46 +00:00
|
|
|
.if !defined(DEBUG) && !defined(PROFLEVEL)
|
2005-12-05 12:55:46 +00:00
|
|
|
STRIP_FLAGS = -S
|
2005-06-27 14:33:32 +00:00
|
|
|
.endif
|
2005-10-03 14:09:58 +00:00
|
|
|
|
2014-01-12 14:37:39 +00:00
|
|
|
.if ${COMPILER_TYPE} != "clang"
|
|
|
|
CFLAGS += -mno-thumb-interwork
|
|
|
|
.endif
|
2013-01-23 07:27:38 +00:00
|
|
|
|
2006-07-24 22:09:47 +00:00
|
|
|
.if empty(DDB_ENABLED)
|
2014-01-12 14:37:39 +00:00
|
|
|
.if defined(WITHOUT_ARM_EABI) && ${COMPILER_TYPE} != "clang"
|
|
|
|
CFLAGS += -mno-apcs-frame
|
2013-03-16 03:57:46 +00:00
|
|
|
.endif
|
2013-07-16 19:15:19 +00:00
|
|
|
.elif !defined(WITHOUT_ARM_EABI)
|
2013-01-19 22:08:16 +00:00
|
|
|
CFLAGS += -funwind-tables
|
2014-01-12 14:37:39 +00:00
|
|
|
.if ${COMPILER_TYPE} == "clang"
|
2013-03-10 03:52:35 +00:00
|
|
|
# clang requires us to tell it to emit assembly with unwind information
|
2014-01-12 14:37:39 +00:00
|
|
|
CFLAGS += -mllvm -arm-enable-ehabi
|
|
|
|
.endif
|
2006-07-24 22:09:47 +00:00
|
|
|
.endif
|
|
|
|
|
MFC r261252, r261279, r261304, r261305, r261322, r261336, r261337, r261338,
r261353
Fix the name of the dts file for the HL201...
When mapping an address, the bsh needs the same offset we do for other things.
Add explicit depends on bus_if.h and device_if.h to avoid a
chicken and egg problem in some compilation environments.
Switch to using PAs rather than VAs for the addresses we map for
devices. This is a nop, except for what's reported by atmelbus for the
resources.
Comment cleanups. Move things around for diff reduction against FDT work.
2014-05-15 02:41:23 +00:00
|
|
|
# hack because genassym.c includes sys/bus.h which includes these.
|
|
|
|
genassym.o: bus_if.h device_if.h
|
|
|
|
|
2012-11-29 03:48:39 +00:00
|
|
|
SYSTEM_LD_ = ${LD} -Bdynamic -T ldscript.$M.noheader ${LDFLAGS} \
|
2005-11-24 02:25:49 +00:00
|
|
|
-warn-common -export-dynamic -dynamic-linker /red/herring -o \
|
|
|
|
${FULLKERNEL}.noheader -X ${SYSTEM_OBJS} vers.o
|
2005-12-20 01:28:17 +00:00
|
|
|
SYSTEM_LD_TAIL +=;sed s/" + SIZEOF_HEADERS"// ldscript.$M\
|
2005-11-24 02:25:49 +00:00
|
|
|
>ldscript.$M.noheader; \
|
|
|
|
${SYSTEM_LD_}; \
|
|
|
|
${OBJCOPY} -S -O binary ${FULLKERNEL}.noheader \
|
|
|
|
${KERNEL_KO}.bin; \
|
|
|
|
rm ${FULLKERNEL}.noheader
|
2005-12-20 20:57:20 +00:00
|
|
|
|
2008-02-05 10:46:30 +00:00
|
|
|
.if defined(MFS_IMAGE)
|
|
|
|
SYSTEM_LD_TAIL += ;sh ${S}/tools/embed_mfs.sh ${KERNEL_KO}.bin ${MFS_IMAGE};
|
|
|
|
.endif
|
|
|
|
|
MFC 262952, 262958, 262966, 262979, 262980, 262986, 262987, 262995, 262997,
263030, 263033, 263034, 263056, 263057,
Remove all the redundant external declarations of exception vectors and
runtime setting of the pointers that's scattered around various places.
Remove all traces of support for ARM chips prior to the arm9 series.
Make the default exception handler vectors point to where I thought they
were already pointing: the default handlers (not a panic that says there
is no default handler).
Eliminate irq_dispatch.S. Move the data items it contained into
arm/intr.c and the functionality it provided into arm/exception.S.
Move the exception vector table (so-called "page0" data) into exception.S
and eliminate vectors.S.
Change the way the asm GET_CURTHREAD_PTR() macro is defined so that code
using it doesn't have to have an "AST_LOCALS" macro somewhere in the file.
Arrange for arm fork_trampoline() to return to userland via the standard
swi_exit code in exception.S instead of having its own inline expansion
of the DO_AST and PULLFRAME macros.
Now that the PUSHFRAME and PULLFRAME macros are used only in the swi
entry/exit code, they don't need to be macros. Except that didn't work
and the whole change was reverted.
Remove some unnecessary indirection and jump right to the handler functions.
Use panic rather than printf to "handle" an arm26 address exception
(should never happen on arm32).
Remove the unreferenced DATA() macro.
Remove #include <machine/asmacros.h> from files that don't need it.
2014-05-17 13:53:38 +00:00
|
|
|
FILES_CPU_FUNC = \
|
|
|
|
$S/$M/$M/cpufunc_asm_arm9.S \
|
|
|
|
$S/$M/$M/cpufunc_asm_arm10.S \
|
2007-07-27 14:42:25 +00:00
|
|
|
$S/$M/$M/cpufunc_asm_xscale.S $S/$M/$M/cpufunc_asm.S \
|
2008-10-13 20:07:13 +00:00
|
|
|
$S/$M/$M/cpufunc_asm_xscale_c3.S $S/$M/$M/cpufunc_asm_armv5_ec.S \
|
2012-08-15 03:03:03 +00:00
|
|
|
$S/$M/$M/cpufunc_asm_fa526.S $S/$M/$M/cpufunc_asm_sheeva.S \
|
2014-05-14 16:32:27 +00:00
|
|
|
$S/$M/$M/cpufunc_asm_pj4b.S $S/$M/$M/cpufunc_asm_armv6.S \
|
|
|
|
$S/$M/$M/cpufunc_asm_armv7.S
|
2012-08-15 03:03:03 +00:00
|
|
|
|
2008-04-03 20:42:36 +00:00
|
|
|
KERNEL_EXTRA=trampoline
|
|
|
|
KERNEL_EXTRA_INSTALL=kernel.gz.tramp
|
2005-12-20 20:57:20 +00:00
|
|
|
trampoline: ${KERNEL_KO}.tramp
|
2006-06-18 22:46:30 +00:00
|
|
|
${KERNEL_KO}.tramp: ${KERNEL_KO} $S/$M/$M/inckern.S $S/$M/$M/elf_trampoline.c
|
2005-12-20 20:57:20 +00:00
|
|
|
echo "#define KERNNAME \"${KERNEL_KO}.tmp\"" >opt_kernname.h
|
|
|
|
sed s/${KERNVIRTADDR}/${KERNPHYSADDR}/ ldscript.$M > ldscript.$M.tramp
|
2005-12-20 01:28:17 +00:00
|
|
|
sed s/" + SIZEOF_HEADERS"// ldscript.$M.tramp > \
|
2013-03-16 03:15:24 +00:00
|
|
|
ldscript.$M.tramp.noheader
|
2007-07-27 14:42:25 +00:00
|
|
|
echo "#include <machine/asm.h>" >tmphack.S
|
|
|
|
echo "ENTRY(_start)" >>tmphack.S
|
|
|
|
echo "bl _startC" >>tmphack.S
|
2005-12-20 01:28:17 +00:00
|
|
|
${OBJCOPY} --strip-symbol '$$d' --strip-symbol '$$a' \
|
2013-03-16 03:15:24 +00:00
|
|
|
-g --strip-symbol '$$t' ${FULLKERNEL} ${KERNEL_KO}.tmp
|
2006-06-12 22:58:50 +00:00
|
|
|
eval $$(stat -s ${KERNEL_KO}.tmp) && \
|
2013-03-16 03:15:24 +00:00
|
|
|
echo "#define KERNSIZE $$st_size" >>opt_kernname.h
|
2008-08-04 14:38:38 +00:00
|
|
|
${CC} -O -nostdlib -I. -I$S -Xlinker -T -Xlinker ldscript.$M.tramp \
|
2013-03-16 03:15:24 +00:00
|
|
|
tmphack.S $S/$M/$M/elf_trampoline.c $S/$M/$M/inckern.S \
|
|
|
|
${FILES_CPU_FUNC} -o ${KERNEL_KO}.tramp
|
2008-08-04 14:38:38 +00:00
|
|
|
${CC} -O -nostdlib -I. -I$S -Xlinker -T -Xlinker \
|
2013-03-16 03:15:24 +00:00
|
|
|
ldscript.$M.tramp.noheader \
|
|
|
|
tmphack.S $S/$M/$M/elf_trampoline.c $S/$M/$M/inckern.S \
|
2013-03-16 03:21:25 +00:00
|
|
|
${FILES_CPU_FUNC} -o ${KERNEL_KO}.tramp.noheader
|
|
|
|
${OBJCOPY} -S -O binary ${KERNEL_KO}.tramp.noheader \
|
2013-03-16 03:15:24 +00:00
|
|
|
${KERNEL_KO}.tramp.bin
|
2005-12-20 20:57:20 +00:00
|
|
|
${OBJCOPY} ${STRIP_FLAGS} ${KERNEL_KO}.tmp
|
2013-03-16 03:15:24 +00:00
|
|
|
echo "#define KERNNAME \"${KERNEL_KO}.tmp.gz\"" >opt_kernname.h
|
2006-01-20 00:46:44 +00:00
|
|
|
eval $$(stat -s ${KERNEL_KO}.tmp) && \
|
2013-03-16 03:15:24 +00:00
|
|
|
echo "#define KERNSIZE $$st_size" >>opt_kernname.h
|
2012-07-15 05:38:43 +00:00
|
|
|
gzip -f9 ${KERNEL_KO}.tmp
|
2005-12-05 12:55:46 +00:00
|
|
|
eval $$(stat -s ${KERNEL_KO}.tmp.gz) && \
|
2013-03-16 03:15:24 +00:00
|
|
|
echo "#define KERNCOMPSIZE $$st_size" >>opt_kernname.h
|
2011-06-15 19:15:50 +00:00
|
|
|
${CC} -O2 -ffreestanding -DKZIP -I. -I$S -c $S/kern/inflate.c -o \
|
|
|
|
inflate-tramp.o
|
2008-08-04 14:38:38 +00:00
|
|
|
${CC} -O -nostdlib -I. -I$S -Xlinker -T -Xlinker ldscript.$M.tramp \
|
2013-03-16 03:15:24 +00:00
|
|
|
-DKZIP tmphack.S $S/$M/$M/elf_trampoline.c inflate-tramp.o \
|
|
|
|
$S/$M/$M/inckern.S ${FILES_CPU_FUNC} -o ${KERNEL_KO}.gz.tramp
|
2008-08-04 14:38:38 +00:00
|
|
|
${CC} -O -nostdlib -I. -I$S -Xlinker -T -Xlinker \
|
2013-03-16 03:15:24 +00:00
|
|
|
ldscript.$M.tramp.noheader \
|
|
|
|
-DKZIP tmphack.S $S/$M/$M/elf_trampoline.c inflate-tramp.o \
|
|
|
|
$S/$M/$M/inckern.S ${FILES_CPU_FUNC} -o ${KERNEL_KO}.tramp.noheader
|
2005-12-05 12:55:46 +00:00
|
|
|
${OBJCOPY} -S -O binary ${KERNEL_KO}.tramp.noheader \
|
2013-03-16 03:21:25 +00:00
|
|
|
${KERNEL_KO}.gz.tramp.bin
|
2005-12-20 01:28:17 +00:00
|
|
|
rm ${KERNEL_KO}.tmp.gz ${KERNEL_KO}.tramp.noheader opt_kernname.h \
|
2013-03-16 03:15:24 +00:00
|
|
|
inflate-tramp.o tmphack.S
|
2005-10-03 14:09:58 +00:00
|
|
|
|
2008-11-30 17:53:19 +00:00
|
|
|
MKMODULESENV+= MACHINE=${MACHINE}
|
|
|
|
|
2004-05-14 11:49:40 +00:00
|
|
|
%BEFORE_DEPEND
|
|
|
|
|
|
|
|
%OBJS
|
|
|
|
|
|
|
|
%FILES.c
|
|
|
|
|
|
|
|
%FILES.s
|
|
|
|
|
|
|
|
%FILES.m
|
|
|
|
|
|
|
|
%CLEAN
|
|
|
|
|
2005-12-20 01:28:17 +00:00
|
|
|
CLEAN+= ldscript.$M ${KERNEL_KO}.bin ldscript.$M.noheader
|
|
|
|
|
|
|
|
CLEAN+= ${KERNEL_KO}.tramp ${KERNEL_KO}.tramp.bin ldscript.$M.tramp \
|
|
|
|
ldscript.$M.tramp.noheader ${KERNEL_KO}.gz.tramp \
|
|
|
|
${KERNEL_KO}.gz.tramp.bin
|
|
|
|
|
2004-09-23 22:47:57 +00:00
|
|
|
ldscript.$M: $S/conf/ldscript.$M
|
|
|
|
cat $S/conf/ldscript.$M|sed s/KERNPHYSADDR/${KERNPHYSADDR}/g| \
|
|
|
|
sed s/KERNVIRTADDR/${KERNVIRTADDR}/g > ldscript.$M
|
2004-05-14 11:49:40 +00:00
|
|
|
%RULES
|
|
|
|
|
|
|
|
.include "$S/conf/kern.post.mk"
|