Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x68k/stand Emit the binaries directly from the loader.



details:   https://anonhg.NetBSD.org/src/rev/9398d4ade350
branches:  trunk
changeset: 518101:9398d4ade350
user:      minoura <minoura%NetBSD.org@localhost>
date:      Sat Nov 24 16:18:44 2001 +0000

description:
Emit the binaries directly from the loader.

diffstat:

 sys/arch/x68k/stand/boot_ufs/Makefile              |  47 ++++++++++-------
 sys/arch/x68k/stand/boot_ufs/boot_ufs.ldscript     |   3 +-
 sys/arch/x68k/stand/boot_ustar/Makefile            |  59 +++++++++++++++------
 sys/arch/x68k/stand/boot_ustar/boot_ustar.ldscript |   3 +-
 4 files changed, 70 insertions(+), 42 deletions(-)

diffs (180 lines):

diff -r 78e4f4317bb4 -r 9398d4ade350 sys/arch/x68k/stand/boot_ufs/Makefile
--- a/sys/arch/x68k/stand/boot_ufs/Makefile     Sat Nov 24 16:08:25 2001 +0000
+++ b/sys/arch/x68k/stand/boot_ufs/Makefile     Sat Nov 24 16:18:44 2001 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.6 2001/10/15 16:23:01 minoura Exp $
+#      $NetBSD: Makefile,v 1.7 2001/11/24 16:18:44 minoura Exp $
 
 .include <bsd.own.mk>
 
@@ -19,8 +19,6 @@
 BINMODE=       444
 MKMAN=         no
 
-OBJCOPY?=      objcopy
-
 S=             ${.CURDIR}/../../../..
 M=             $S/arch/${MACHINE}
 LIBKERN=       $S/lib/libkern/arch/${MACHINE_ARCH}
@@ -45,29 +43,38 @@
 CPPFLAGS+= -I${COMMONDIR} -I${LIBIOCS}
 AFLAGS=           ${CFLAGS:M-[ID]*}
 .if ${OBJECT_FMT} == "ELF"
-LDFLAGS=   -N -Bstatic -T ${.CURDIR}/${BOOT}.ldscript
+LDFLAGS=   -n -Bstatic -T ${.CURDIR}/${BOOT}.ldscript -M
 LDFLAGS+=  -noinhibit-exec     # XXX
 .else
-LDFLAGS=   -n -Bstatic -Ttext ${TEXT}
+LDFLAGS=   -n -Bstatic -Ttext ${TEXT} -M
+OBJCOPY?=  objcopy
 .endif
 
-CLEANFILES=    $(PROG).x s.x x.s x.o
+CLEANFILES+=   $(PROG).x $(PROG).map
 
 
 $(PROG): $(OBJS)
-       $(LD) $(LDFLAGS) -o $(PROG).x $(OBJS) $(LDADD)
-       @$(NM) --target=a.out-m68k-netbsd $(PROG).x | sed -n '/T first_kbyte/p'
-       @if [ `(echo ibase=16; \
-               $(NM) --target=a.out-m68k-netbsd $(PROG).x | sed -n 's/T first_kbyte/-$(TEXT)-400/p' | \
-                               tr a-f A-F) | bc` -gt 0 ];\
-       then echo '$(PROG): first_kbyte exceeds the first killobyte'; exit 1; fi
-       @$(SIZE) --target=a.out-m68k-netbsd $(PROG).x
-       @if [ `(echo ibase=16; \
-               $(NM) --target=a.out-m68k-netbsd $(PROG).x | sed -n 's/D _edata/-$(TEXT)-2000/p' | tr a-f A-F) |\
-                       bc` -gt 0 ];\
-       then    echo '$(PROG): text+data is too large'; exit 1; fi
-       @cp $(PROG).x s.x
-       @$(OBJCOPY) -I a.out-m68k-netbsd -O binary s.x $(PROG)
-       @rm s.x
+       $(LD) $(LDFLAGS) -o $(PROG) $(OBJS) $(LDADD) > $(PROG).map
+       @grep first_kbyte $(PROG).map
+.if ${OBJECT_FMT} == "ELF"
+       @if [ `(echo ibase=16;                                             \
+           sed -n 's/^.*0x\([0-9a-f]*\).* first_kbyte$$/\1-$(TEXT)-400/p' \
+               $(PROG).map |                                              \
+           tr a-f A-F) | bc` -gt 0 ];                                     \
+       then echo '$(BOOT): first_kbyte exceeds the first killobyte';      \
+           rm $(PROG) ; exit 1;                                           \
+       fi
+.else
+       mv $(PROG) $(PROG).x
+       $(OBJCOPY) -I a.out-m68k-netbsd -O binary $(PROG).x $(PROG)
+       @rm -f $(PROG).x
+       @if [ `(echo ibase=16;                                             \
+           sed -n 's/  first_kbyte:.*0x\(.*\),.*$$/\1-$(TEXT)-400/p'      \
+               $(PROG).map |                                              \
+           tr a-f A-F) | bc` -gt 0 ];                                     \
+       then echo '$(BOOT): first_kbyte exceeds the first killobyte';      \
+           rm $(PROG) ; exit 1;                                           \
+       fi
+.endif
 
 .include <bsd.prog.mk>
diff -r 78e4f4317bb4 -r 9398d4ade350 sys/arch/x68k/stand/boot_ufs/boot_ufs.ldscript
--- a/sys/arch/x68k/stand/boot_ufs/boot_ufs.ldscript    Sat Nov 24 16:08:25 2001 +0000
+++ b/sys/arch/x68k/stand/boot_ufs/boot_ufs.ldscript    Sat Nov 24 16:18:44 2001 +0000
@@ -1,5 +1,4 @@
-OUTPUT_FORMAT("a.out-m68k-netbsd", "a.out-m68k-netbsd",
-             "a.out-m68k-netbsd")
+OUTPUT_FORMAT("binary", "binary", "binary")
 OUTPUT_ARCH(m68k)
 ENTRY(start)
 SEARCH_DIR(/usr/lib);
diff -r 78e4f4317bb4 -r 9398d4ade350 sys/arch/x68k/stand/boot_ustar/Makefile
--- a/sys/arch/x68k/stand/boot_ustar/Makefile   Sat Nov 24 16:08:25 2001 +0000
+++ b/sys/arch/x68k/stand/boot_ustar/Makefile   Sat Nov 24 16:18:44 2001 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.4 2001/10/15 16:23:01 minoura Exp $
+#      $NetBSD: Makefile,v 1.5 2001/11/24 16:18:45 minoura Exp $
 
 .include <bsd.own.mk>
 
@@ -17,8 +17,6 @@
 BINMODE=       444
 MKMAN=         no
 
-OBJCOPY?=      objcopy
-
 S=             ${.CURDIR}/../../../..
 M=             $S/arch/x68k
 COMMONDIR=     $M/stand/common
@@ -36,27 +34,52 @@
 AFLAGS=           ${CFLAGS:M-[ID]*}
 AFLAGS+=   -Wa,-mc68000
 .if ${OBJECT_FMT} == "ELF"
-LDFLAGS=   -n -Bstatic -T ${.CURDIR}/${BOOT}.ldscript
+LDFLAGS=   -n -Bstatic -T ${.CURDIR}/${BOOT}.ldscript -M
 LDFLAGS+=  -noinhibit-exec     # XXX
 .else
-LDFLAGS=   -n -Bstatic -Ttext ${TEXT}
+LDFLAGS=   -n -Bstatic -Ttext ${TEXT} -M
+OBJCOPY?=  objcopy
 .endif
 
-CLEANFILES=    ${PROG}.x s.x x.s x.o
+CLEANFILES=    ${PROG}.x $(PROG).map
 
 
 ${PROG}: $(OBJS)
-       $(LD) $(LDFLAGS) -o ${PROG}.x $(OBJS) $(LDADD)
-       @$(NM) --target=a.out-m68k-netbsd ${PROG}.x | sed -n '/T first_kbyte/p'
-       @if [ `(echo ibase=16; \
-               $(NM) --target=a.out-m68k-netbsd ${PROG}.x | sed -n 's/T first_kbyte/-$(TEXT)-400/p' | \
-                               tr a-f A-F) | bc` -gt 0 ];\
-       then echo '${PROG}: first_kbyte exceeds the first killobyte'; exit 1; fi
-       @$(SIZE) --target=a.out-m68k-netbsd ${PROG}.x
-       @if [ `(echo ibase=16; \
-               $(NM) --target=a.out-m68k-netbsd ${PROG}.x | sed -n 's/D _edata/-$(TEXT)-2000/p' | tr a-f A-F) |\
-                       bc` -gt 0 ];\
-       then    echo '${PROG}: text+data is too large'; exit 1; fi
-       @$(OBJCOPY) -I a.out-m68k-netbsd -O binary ${PROG}.x ${PROG}
+       $(LD) $(LDFLAGS) -o ${PROG} $(OBJS) $(LDADD) > $(PROG).map
+       @grep first_kbyte $(PROG).map
+.if ${OBJECT_FMT} == "ELF"
+       @if [ `(echo ibase=16;                                             \
+           sed -n 's/^.*0x\([0-9a-f]*\).* first_kbyte$$/\1-$(TEXT)-400/p' \
+               $(PROG).map |                                              \
+           tr a-f A-F) | bc` -gt 0 ];                                     \
+       then echo '$(BOOT): first_kbyte exceeds the first killobyte';      \
+           rm $(PROG) ; exit 1;                                           \
+       fi
+       @if [ `(echo ibase=16;                                             \
+           sed -n 's/^.*0x\([0-9a-f]*\).* _edata=\.$$/\1-$(TEXT)-2000/p' \
+               $(PROG).map |                                              \
+           tr a-f A-F) | bc` -gt 0 ];                                     \
+       then echo '$(BOOT): text+data is too large';                       \
+           rm $(PROG) ; exit 1;                                           \
+       fi
+.else
+       mv $(PROG) $(PROG).x
+       $(OBJCOPY) -I a.out-m68k-netbsd -O binary $(PROG).x $(PROG)
+       @rm -f $(PROG).x
+       @if [ `(echo ibase=16;                                             \
+           sed -n 's/  first_kbyte:.*0x\(.*\),.*$$/\1-$(TEXT)-400/p'      \
+               $(PROG).map |                                              \
+           tr a-f A-F) | bc` -gt 0 ];                                     \
+       then echo '$(BOOT): first_kbyte exceeds the first killobyte';      \
+           rm $(PROG) ; exit 1;                                           \
+       fi
+       @if [ `(echo ibase=16;                                             \
+           sed -n 's/  _edata:.*0x\(.*\),.*$$/\1-$(TEXT)-2000/p'          \
+               $(PROG).map |                                              \
+           tr a-f A-F) | bc` -gt 0 ];                                     \
+       then echo '$(BOOT): text+data is too large';                       \
+           rm $(PROG) ; exit 1;                                           \
+       fi
+.endif
 
 .include <bsd.prog.mk>
diff -r 78e4f4317bb4 -r 9398d4ade350 sys/arch/x68k/stand/boot_ustar/boot_ustar.ldscript
--- a/sys/arch/x68k/stand/boot_ustar/boot_ustar.ldscript        Sat Nov 24 16:08:25 2001 +0000
+++ b/sys/arch/x68k/stand/boot_ustar/boot_ustar.ldscript        Sat Nov 24 16:18:44 2001 +0000
@@ -1,5 +1,4 @@
-OUTPUT_FORMAT("a.out-m68k-netbsd", "a.out-m68k-netbsd",
-             "a.out-m68k-netbsd")
+OUTPUT_FORMAT("binary", "binary", "binary")
 OUTPUT_ARCH(m68k)
 ENTRY(start)
 SEARCH_DIR(/usr/lib);



Home | Main Index | Thread Index | Old Index