From f5a9ac9ca429acd9dcbe2277846f191ff7664ab8 Mon Sep 17 00:00:00 2001 From: Olivier Houchard Date: Thu, 24 Nov 2005 02:25:49 +0000 Subject: [PATCH] Create a non-elf pure binary version of the kernel as well. --- sys/conf/Makefile.arm | 20 +++++++++++++++++++- sys/conf/ldscript.arm | 29 +++++++++++++++-------------- 2 files changed, 34 insertions(+), 15 deletions(-) diff --git a/sys/conf/Makefile.arm b/sys/conf/Makefile.arm index c0e5a124718..11495a401bd 100644 --- a/sys/conf/Makefile.arm +++ b/sys/conf/Makefile.arm @@ -48,6 +48,16 @@ CFLAGS += -mno-apcs-frame DDB_ENABLED!= grep DDB opt_ddb.h || true +SYSTEM_LD_ = ${LD} -Bdynamic -T ldscript.$M.static \ + -warn-common -export-dynamic -dynamic-linker /red/herring -o \ + ${FULLKERNEL}.noheader -X ${SYSTEM_OBJS} vers.o +SYSTEM_LD_TAIL +=; cat ldscript.$M| \ + sed s/" + SIZEOF_HEADERS"// \ + >ldscript.$M.noheader; \ + ${SYSTEM_LD_}; \ + ${OBJCOPY} -S -O binary ${FULLKERNEL}.noheader \ + ${KERNEL_KO}.bin; \ + rm ${FULLKERNEL}.noheader .if ${DDB_ENABLED} != "" SYSTEM_LD_TAIL += ;echo "\#define KERNNAME \"${KERNEL_KO}.tmp\"" \ >opt_kernname.h ;\ @@ -55,9 +65,17 @@ SYSTEM_LD_TAIL += ;echo "\#define KERNNAME \"${KERNEL_KO}.tmp\"" \ -g --strip-symbol '$$t' ${FULLKERNEL} ${KERNEL_KO}.tmp;\ ${CC} -O -nostdlib -I. -Xlinker -T -Xlinker ldscript.arm \ $S/$M/$M/elf_trampoline.c $S/$M/$M/inckern.S -o ${KERNEL_KO}.tramp;\ - rm ${KERNEL_KO}.tmp + ${CC} -O -nostdlib -I. -Xlinker -T -Xlinker ldscript.arm.noheader \ + $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; \ + rm ${KERNEL_KO}.tmp ${KERNEL_KO}.tramp.noheader; \ + .endif +CLEANFILES += ldscript.$M ldscript.$M.static ${KERNEL_KO}.bin \ + ${KERNEL_KO}.tramp ${KERNEL_KO}.tramp.bin %BEFORE_DEPEND %OBJS diff --git a/sys/conf/ldscript.arm b/sys/conf/ldscript.arm index d43e730587c..3ccf916b1d7 100644 --- a/sys/conf/ldscript.arm +++ b/sys/conf/ldscript.arm @@ -8,7 +8,20 @@ SECTIONS { /* Read-only sections, merged into text segment: */ . = KERNVIRTADDR + SIZEOF_HEADERS; - .interp : { *(.interp) } + .text : + { + *(.text) + *(.stub) + /* .gnu.warning sections are handled specially by elf32.em. */ + *(.gnu.warning) + *(.gnu.linkonce.t*) + } =0x9090 + _etext = .; + PROVIDE (etext = .); + .fini : { *(.fini) } =0x9090 + .rodata : { *(.rodata) *(.gnu.linkonce.r*) } + .rodata1 : { *(.rodata1) } + .interp : { *(.interp) } .hash : { *(.hash) } .dynsym : { *(.dynsym) } .dynstr : { *(.dynstr) } @@ -43,19 +56,7 @@ SECTIONS .rela.plt : { *(.rela.plt) } .init : { *(.init) } =0x9090 .plt : { *(.plt) } - .text : - { - *(.text) - *(.stub) - /* .gnu.warning sections are handled specially by elf32.em. */ - *(.gnu.warning) - *(.gnu.linkonce.t*) - } =0x9090 - _etext = .; - PROVIDE (etext = .); - .fini : { *(.fini) } =0x9090 - .rodata : { *(.rodata) *(.gnu.linkonce.r*) } - .rodata1 : { *(.rodata1) } + /* Adjust the address for the data segment. We want to adjust up to the same address within the page on the next page up. */ . = ALIGN(0x1000) + (. & (0x1000 - 1)) ; -- 2.45.2