Subject: port-next68k/16930: boot program doesn't build without gawk
To: None <gnats-bugs@gnats.netbsd.org>
From: None <chris@Pin.LU>
List: netbsd-bugs
Date: 05/20/2002 21:37:02
>Number: 16930
>Category: port-next68k
>Synopsis: boot program doesn't build without gawk
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: port-next68k-maintainer
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon May 20 13:17:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Christian Limpach
>Release: current (as of May 20 2002)
>Organization:
>Environment:
System: NetBSD clapper 1.5ZC NetBSD 1.5ZC (CLAPPER) #46: Mon May 13 20:51:50 CEST 2002 root@marble:/devel/netbsd/src-current/sys/arch/next68k/compile/CLAPPER next68k
arch/next68k/stand/boot/Makefile rev. 1.13
>Description:
awk is used to generate the header for the boot program. Since the
header includes NUL-bytes, printf "\0" is used to generate those.
This only works with gawk since most other awk implementations will
only print strings upto a NUL character.
>How-To-Repeat:
build boot program with awk=gawk and with awk=some other awk and
notice the missing header (since the very first byte is NUL)
>Fix:
change the awk script to output the header as '\0\0207\01\07...'
and then use "| xargs printf" to generate the header.
Index: Makefile
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/next68k/stand/boot/Makefile,v
retrieving revision 1.13
diff -u -r1.13 Makefile
--- Makefile 2002/05/12 15:18:27 1.13
+++ Makefile 2002/05/20 19:49:06
@@ -48,20 +48,20 @@
STRIPFLAG= # defined
AWKPROG='\
-function x(v) { printf "\0%c%c%c", v / 65536, v / 256, v } \
+function x(v) { printf "\\0\\0%o\\0%o\\0%o", (v / 65536) % 256, (v / 256) % 256, v % 256 } \
{ \
- printf "\0\207\01\07"; \
+ printf "\047\\0\\0207\\01\\07"; \
x($$1); \
x($$2); \
x($$3); \
- printf "\0\0\0\0\04\070\0\0\0\0\0\0\0\0\0\0" \
+ printf "\\0\\0\\0\\0\\04\\070\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\047" \
}'
${PROG}: srt0.o ${OBJS} ${LIBS}
${LD} -N -Ttext ${RELOC} -e start srt0.o ${OBJS} ${LIBS} -o $@.elf
@${SIZE} $@.elf
@${OBJCOPY} -O binary $@.elf $@.raw
- @(${SIZE} $@.elf | tail +2 | awk ${AWKPROG} ; cat $@.raw) > $@
+ @(${SIZE} $@.elf | tail +2 | awk ${AWKPROG} | xargs printf ; cat $@.raw) > $@
# startup
>Release-Note:
>Audit-Trail:
>Unformatted: