Subject: Makefile.mbr problem - fix?
To: None <tech-toolchain@netbsd.org>
From: Hubert Feyrer <hubert.feyrer@informatik.fh-regensburg.de>
List: tech-toolchain
Date: 05/05/2003 15:23:32
Regarding the recent problems in sys/arch/i386/stand/mbr/Makefile.mbr that
arise because our /bin/sh doesn't want to properly convert a hex value
into a decimal value (" echo $(( 0xdeadbeef )) "), below's a possible
solution that uses nm(1) to do the conversion to dec.

Problem is that it uses sed(1) to strip leading zeroes, and I'm not sure
that's ok. At least there is no $(SED) macro defined, is it ok to use
sed(1) in that way? (Thinking about cross builds...)


 - Hubert

Index: Makefile.mbr
===================================================================
RCS file: /cvsroot/src/sys/arch/i386/stand/mbr/Makefile.mbr,v
retrieving revision 1.2
diff -u -r1.2 Makefile.mbr
--- Makefile.mbr        2003/05/05 02:47:42     1.2
+++ Makefile.mbr        2003/05/05 13:16:01
@@ -26,8 +26,8 @@

 ${PROG}: ${OBJS}
        ${LD} -o ${PROG}.tmp ${LDFLAGS} -Ttext 0x600 ${OBJS}
-       @ set -- $$( ${NM} -t x ${PROG}.tmp | grep '\<mbr_space\>' ); \
-               echo "#### There are $$((0x$$1)) free bytes in ${PROG}"
+       @ set -- $$( ${NM} -t d ${PROG}.tmp | grep '\<mbr_space\>' | sed 's/^0*//' ); \
+               echo "#### There are $$1 free bytes in ${PROG}"
        ${OBJCOPY} -O binary ${PROG}.tmp ${PROG}
        rm -f ${PROG}.tmp

-- 
Want to get a clue on IPv6 but don't know where to start? Try this:
* Basics -> http://www.onlamp.com/pub/a/onlamp/2001/05/24/ipv6_tutorial.html
* Setup  -> http://www.onlamp.com/pub/a/onlamp/2001/06/01/ipv6_tutorial.html
Of course with your #1 IPv6 ready operating system -> http://www.NetBSD.org/