From 160618754617dcb25884d48bec4e40d6a98a1592 Mon Sep 17 00:00:00 2001 From: jchandra Date: Thu, 16 Dec 2010 04:56:03 +0000 Subject: 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 --- sys/conf/Makefile.mips | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'sys/conf/Makefile.mips') 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 " >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 \ -- cgit v1.1