summaryrefslogtreecommitdiffstats
path: root/sys/conf/Makefile.mips
diff options
context:
space:
mode:
authorjchandra <jchandra@FreeBSD.org>2010-12-16 04:56:03 +0000
committerjchandra <jchandra@FreeBSD.org>2010-12-16 04:56:03 +0000
commit160618754617dcb25884d48bec4e40d6a98a1592 (patch)
treecfb3df700ed5e4fcd250ecb94fb9d78204244b53 /sys/conf/Makefile.mips
parent4db53c4394eb7b7b1c9da72ad337bf2aee1bb74c (diff)
downloadFreeBSD-src-160618754617dcb25884d48bec4e40d6a98a1592.zip
FreeBSD-src-160618754617dcb25884d48bec4e40d6a98a1592.tar.gz
Make the ELF trampoline binary ELF executable (and do some cleanup).
- Remove the -shared flag for the trampoline binary, generate an ELF executable instead of a shared object. - No need to generate tmphack.S, move the code to sys/mips/mips/inckern.S - No need generate opt_kernname.h, KERNNAME can be passed with -D Reviewed by: gonzo, imp
Diffstat (limited to 'sys/conf/Makefile.mips')
-rw-r--r--sys/conf/Makefile.mips20
1 files changed, 5 insertions, 15 deletions
diff --git a/sys/conf/Makefile.mips b/sys/conf/Makefile.mips
index 57e1dfe..6536334 100644
--- a/sys/conf/Makefile.mips
+++ b/sys/conf/Makefile.mips
@@ -50,6 +50,7 @@ HACK_EXTRA_FLAGS=-shared
# is extremely poor, as well as -mno-abicalls to force no ABI usage.
CFLAGS+=${EXTRA_FLAGS} $(ARCH_FLAGS)
HACK_EXTRA_FLAGS+=${EXTRA_FLAGS} $(ARCH_FLAGS)
+TRAMP_EXTRA_FLAGS=${EXTRA_FLAGS} $(ARCH_FLAGS)
# XXX hardcoded kernel entry point
ASM_CFLAGS+=${CFLAGS} -D_LOCORE -DLOCORE
@@ -62,21 +63,10 @@ ${KERNEL_KO}.tramp.bin: ${KERNEL_KO} $S/$M/$M/elf_trampoline.c \
-g --strip-symbol '$$t' ${FULLKERNEL} ${KERNEL_KO}.tmp
sed s/${KERNLOADADDR}/${TRAMPLOADADDR}/ ${LDSCRIPT_NAME} | \
sed s/" + SIZEOF_HEADERS"// > ${LDSCRIPT_NAME}.tramp.noheader
- # Generate .S file that setups stack and jumps to trampoline
- echo "#include <machine/asm.h>" >tmphack.S
- echo "ENTRY(_start)" >>tmphack.S
- echo "PTR_LA t0, kernel_end" >>tmphack.S
- echo "move sp, t0" >>tmphack.S
- echo "add sp, 0x2000" >>tmphack.S
- echo "and sp, ~0x7" >>tmphack.S
- echo "PTR_LA t0, _startC" >>tmphack.S
- echo "j t0" >>tmphack.S
- echo "END(_start)" >>tmphack.S
- echo "#define KERNNAME \"${KERNEL_KO}.tmp\"" >opt_kernname.h
- ${CC} -O -nostdlib -I. -I$S ${HACK_EXTRA_FLAGS} ${TRAMP_LDFLAGS} -Xlinker \
- -T -Xlinker ${LDSCRIPT_NAME}.tramp.noheader tmphack.S \
- $S/$M/$M/elf_trampoline.c $S/$M/$M/inckern.S \
- -o ${KERNEL_KO}.tramp.noheader
+ ${CC} -O -nostdlib -I. -I$S ${TRAMP_EXTRA_FLAGS} ${TRAMP_LDFLAGS} -Xlinker \
+ -T -Xlinker ${LDSCRIPT_NAME}.tramp.noheader \
+ -DKERNNAME="\"${KERNEL_KO}.tmp\"" $S/$M/$M/elf_trampoline.c \
+ $S/$M/$M/inckern.S -o ${KERNEL_KO}.tramp.noheader
${OBJCOPY} -S -O binary ${KERNEL_KO}.tramp.noheader \
${KERNEL_KO}.tramp.bin \
OpenPOWER on IntegriCloud