Subject: use OMAGIC for kernels
To: None <port-mips@netbsd.org>
From: Jason R Thorpe <thorpej@zembu.com>
List: port-mips
Date: 06/07/2001 08:25:31
Folks..

All NetBSD/mips ports load the kernel into KSEG0 (we'd be ... rather
foolish not to do so), and as such, have no reason to use an executable
format that inserts alignment between the text and data load sections,
since there is no way to write-protect the "read-only" load sections.

Based on some suggestions from Ian Taylor, I've modified the kern.ldscript
files for MIPS to remove some padding between the "read-only" and .data
sections.  He also said we should be using the -N linker flag to really
tell the linker to make a single loadable section.

The patch below does this for NetBSD/sgimips, and with a "slight hack"
to BFD, I am able to use objcopy to make an ECOFF kernel that the ARCS
console will load.  Probably a similar thing will work to make the
DECstation console load an objcopy'd ECOFF kernel.  I'll post my "slight
hack" to BFD shortly (it really should be done differently, but Ian
couldn't suggest a better way without thinking about it more).

-- 
        -- Jason R. Thorpe <thorpej@zembu.com>

Index: Makefile.sgimips.inc
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/sgimips/conf/Makefile.sgimips.inc,v
retrieving revision 1.1
diff -c -r1.1 Makefile.sgimips.inc
*** Makefile.sgimips.inc	2000/12/03 02:07:04	1.1
--- Makefile.sgimips.inc	2001/06/07 15:23:55
***************
*** 1,8 ****
  #	$NetBSD: Makefile.sgimips.inc,v 1.1 2000/12/03 02:07:04 matt Exp $
  
! SYSTEM_LD_TAIL=	@echo ${LD} -T ${MIPS}/conf/kern.ldscript.be -Ttext 0x88002000 \
  		-e start ${GP} -x -o $@.high '$${SYSTEM_OBJ}' vers.o ; \
! 		${LD} -T ${MIPS}/conf/kern.ldscript.be -Ttext 0x88002000 \
  		-e start ${GP} -x -o $@.high ${SYSTEM_OBJ} vers.o swapnetbsd.o
  # XXX
  SYSTEM_LD_TAIL+=; \
--- 1,8 ----
  #	$NetBSD: Makefile.sgimips.inc,v 1.1 2000/12/03 02:07:04 matt Exp $
  
! SYSTEM_LD_TAIL=	@echo ${LD} -N -T ${MIPS}/conf/kern.ldscript.be -Ttext 0x88002000 \
  		-e start ${GP} -x -o $@.high '$${SYSTEM_OBJ}' vers.o ; \
! 		${LD} -N -T ${MIPS}/conf/kern.ldscript.be -Ttext 0x88002000 \
  		-e start ${GP} -x -o $@.high ${SYSTEM_OBJ} vers.o swapnetbsd.o
  # XXX
  SYSTEM_LD_TAIL+=; \