Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/cats/conf Adjust for new location of elf2aout.sh, a...



details:   https://anonhg.NetBSD.org/src/rev/7631a40e5696
branches:  trunk
changeset: 521834:7631a40e5696
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Wed Feb 06 19:59:01 2002 +0000

description:
Adjust for new location of elf2aout.sh, and echo the command before
executing it (like we do for other commands).

diffstat:

 sys/arch/cats/conf/Makefile.cats.inc |  15 ++++++-
 sys/arch/cats/conf/elf2aout.sh       |  64 ------------------------------------
 2 files changed, 12 insertions(+), 67 deletions(-)

diffs (98 lines):

diff -r 0d29960d713a -r 7631a40e5696 sys/arch/cats/conf/Makefile.cats.inc
--- a/sys/arch/cats/conf/Makefile.cats.inc      Wed Feb 06 19:58:02 2002 +0000
+++ b/sys/arch/cats/conf/Makefile.cats.inc      Wed Feb 06 19:59:01 2002 +0000
@@ -1,14 +1,23 @@
-#      $NetBSD: Makefile.cats.inc,v 1.4 2002/02/06 00:55:56 chris Exp $
+#      $NetBSD: Makefile.cats.inc,v 1.5 2002/02/06 19:59:01 thorpej Exp $
 
 GENASSYM_EXTRAS+=      ${ARM}/footbridge/genassym.cf
 LOOSE_PROTOTYPES=      NO
 
 .if (${OBJECT_FMT} == "ELF")
-# Under ELF we need to do a whole load of stuff extra to get that kernel.
+# Need to convert the kernel from ELF to a.out so that OpenFirmware
+# can load it.
 
+# ZMAGIC a.out includes the a.out header in front of the text
+# segment, so if we link the kernel at the normal load address,
+# it will be wrong once the a.out header is stuck in the file.
+# XXX HOWEVER, by linking it +32 bytes to compensate, the resulting
+# XXX ELF kernel cannot be booted itself.
 LOADADDRESS=0xF0000020
 
 SYSTEM_LD_TAIL_EXTRA=; \
        ${DBSYM} $@ || true; \
-       $S/arch/${MACHINE}/conf/elf2aout.sh
+       echo OBJCOPY=${OBJCOPY:Q} SIZE=${SIZE:Q} \
+           ${ARM}/conf/elf2aout.sh $@ $@.aout; \
+       OBJCOPY=${OBJCOPY:Q} SIZE=${SIZE:Q} \
+           ${ARM}/conf/elf2aout.sh $@ $@.aout
 .endif 
diff -r 0d29960d713a -r 7631a40e5696 sys/arch/cats/conf/elf2aout.sh
--- a/sys/arch/cats/conf/elf2aout.sh    Wed Feb 06 19:58:02 2002 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-#!/bin/sh
-# $NetBSD: elf2aout.sh,v 1.2 2002/01/31 21:50:06 chris Exp $
-# Shell script to convert a cats ELF kernel into a bootable a.out kernel by
-# changing the header block on the kernel, and shuffling bits around in the
-# file.  Care has to be taken with the sections as they need to be page
-# aligned.
-
-AWKPROG='\
-function r(v) { return sprintf("%d", ((v + 4095) / 4096)) * 4096 } \
-function x(v) { printf "%c%c%c\0", v, v / 256, v / 65536 } \
-{ \
-        printf "\0\217\01\013"; \
-        x(r($1)); \
-        x(r($2 + 32768 - (r($1) - $1))); \
-        x($3); \
-        printf "\0\0\0\0\040\0\0\360\0\0\0\0\0\0\0\0" \
-}'
-
-if [ "x${TOOLDIR}" = "x" ]; then
-OBJCOPY=objcopy
-SIZE=size
-else
-OBJCOPY=${TOOLDIR}/bin/arm--netbsdelf-objcopy
-SIZE=${TOOLDIR}/bin/arm--netbsdelf-size
-fi
-
-if [ ! -f netbsd ]; then 
-echo "Missing netbsd kernel"
-exit 1
-fi
-
-mv -f netbsd netbsd.elf
-${OBJCOPY} -O binary -j .text netbsd.elf netbsd.text
-${OBJCOPY} -O binary -j .data netbsd.elf netbsd.data
-
-TEXT=`${SIZE} netbsd.elf | tail +2 | awk '
-function r(v) { return sprintf("%d", ((v + 4095) / 4096)) * 4096 }
-{print r($1)}'`
-echo TEXT = $TEXT
-
-TPAD=`${SIZE} netbsd.elf | tail +2 | awk '
-       function r(v) { return sprintf("%d", ((v + 4095) / 4096)) * 4096 }
-       {print r($1) - $1}'`
-       echo TPAD = $TPAD
-
-DATA=`${SIZE} netbsd.elf | tail +2 | awk '
-function r(v) { return sprintf("%d", ((v + 4095) / 4096)) * 4096 }
-{print r($2 + 32768 - (r($1) - $1))}'`
-echo DATA = $DATA
-
-DPAD=`${SIZE} netbsd.elf | tail +2 | awk '
-function r(v) { return sprintf("%d", ((v + 4095) / 4096)) * 4096 }
-{print r($2 + 32768 - (r($1) - $1)) - ($2 + 32768 - (r($1) - $1))}'`
-echo DPAD = $DPAD
-
-(${SIZE} netbsd.elf | tail +2 | awk "${AWKPROG}" ; \
-  cat netbsd.text ; dd if=/dev/zero bs=32k count=1; cat netbsd.data; dd if=/dev/zero bs=$DPAD count=1 \
-) > netbsd.aout
-
-cp netbsd.aout netbsd
-${SIZE} netbsd
-chmod 755 netbsd
-
-exit 0



Home | Main Index | Thread Index | Old Index