From owner-freebsd-current@FreeBSD.ORG Thu Jun 16 12:56:49 2005 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0557616A41C for ; Thu, 16 Jun 2005 12:56:49 +0000 (GMT) (envelope-from fli+freebsd-current@shapeshifter.se) Received: from mail.hamnpolare.net (manticore.shapeshifter.se [212.37.5.30]) by mx1.FreeBSD.org (Postfix) with ESMTP id 850C343D4C for ; Thu, 16 Jun 2005 12:56:46 +0000 (GMT) (envelope-from fli+freebsd-current@shapeshifter.se) Received: from localhost (localhost [127.0.0.1]) by mail.hamnpolare.net (Postfix) with ESMTP id B4E4B1A6F0 for ; Thu, 16 Jun 2005 14:56:41 +0200 (CEST) Received: from mail.hamnpolare.net ([127.0.0.1]) by localhost (manticore.shapeshifter.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 07753-09 for ; Thu, 16 Jun 2005 14:56:40 +0200 (CEST) Received: from biocandy.shapeshifter.se (h99n2fls32o270.telia.com [217.210.25.99]) by mail.hamnpolare.net (Postfix) with ESMTP id 6EA871A6D5 for ; Thu, 16 Jun 2005 14:56:40 +0200 (CEST) Received: by biocandy.shapeshifter.se (Postfix, from userid 1001) id DC3834197; Thu, 16 Jun 2005 14:56:39 +0200 (CEST) Date: Thu, 16 Jun 2005 14:56:39 +0200 From: Fredrik Lindberg To: freebsd-current@freebsd.org Message-ID: <20050616125639.GA1419@shapeshifter.se> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="r5Pyd7+fXNt84Ff3" Content-Disposition: inline User-Agent: Mutt/1.4.2.1i X-Virus-Scanned: at mail.hamnpolare.net Subject: Slight problem with ndisgen and ndiscvt X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jun 2005 12:56:49 -0000 --r5Pyd7+fXNt84Ff3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi There is a slight problem with ndisgen and ndiscvt when the filename of the .sys-file starts with a number (such as 3C154G72.sys). The produced header file contains variable declarations which starts with a number, such as extern unsigned char 3C154G72_sys_drv_data_start[] which results in several "syntax error before numeric constant" during compilation. While this can be solved simply by renaming the .sys-file, that solution might not be obvious to ordinary users. Here is a small patch which adds a "ndis_" prefix to drv_data_start and related variables. This will allow filesnames which starts with a number. Maybe even more care should be taken to make sure there are no spaces or other "strange" characters in the name. Fredrik Lindberg --r5Pyd7+fXNt84Ff3 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="ndisgen-numeric-sysfile.patch" diff -cr --exclude=CVS ndiscvt.old/ndiscvt.c ndiscvt/ndiscvt.c *** ndiscvt.old/ndiscvt.c Thu Jun 16 14:45:38 2005 --- ndiscvt/ndiscvt.c Mon Jun 13 19:07:26 2005 *************** *** 207,215 **** } snprintf(sysbuf, sizeof(sysbuf), ! "objcopy --redefine-sym _binary_%s_start=%s_drv_data_start " "--strip-symbol _binary_%s_size " ! "--redefine-sym _binary_%s_end=%s_drv_data_end %s.o %s.o\n", tname, sysfile, tname, tname, sysfile, outfile, outfile); printf("%s", sysbuf); system(sysbuf); --- 207,215 ---- } snprintf(sysbuf, sizeof(sysbuf), ! "objcopy --redefine-sym _binary_%s_start=ndis_%s_drv_data_start " "--strip-symbol _binary_%s_size " ! "--redefine-sym _binary_%s_end=ndis_%s_drv_data_end %s.o %s.o\n", tname, sysfile, tname, tname, sysfile, outfile, outfile); printf("%s", sysbuf); system(sysbuf); *************** *** 384,393 **** ptr++; } fprintf(outfp, ! "\nextern unsigned char %s_drv_data_start[];\n", sysfile); fprintf(outfp, "static unsigned char *drv_data = " ! "%s_drv_data_start;\n\n", sysfile); bincvt(sysfile, outfile, img, fsize); goto done; } --- 384,393 ---- ptr++; } fprintf(outfp, ! "\nextern unsigned char ndis_%s_drv_data_start[];\n", sysfile); fprintf(outfp, "static unsigned char *drv_data = " ! "ndis_%s_drv_data_start;\n\n", sysfile); bincvt(sysfile, outfile, img, fsize); goto done; } diff -cr --exclude=CVS ndiscvt.old/ndisgen.sh ndiscvt/ndisgen.sh *** ndiscvt.old/ndisgen.sh Thu Jun 16 14:45:38 2005 --- ndiscvt/ndisgen.sh Mon Jun 13 20:45:37 2005 *************** *** 393,399 **** touch bus_if.h touch device_if.h echo -n " Compiling stub... " ! if ! ${CC} -D_KERNEL -DDRV_DATA_START=${SYSBASE}_drv_data_start -DDRV_NAME=${SYSBASE} -DDRV_DATA_END=${SYSBASE}_drv_data_end -I. ${STUBFILE} -c -o windrv_stub.o; then echo "compilation failed. Exiting." echo "" exit --- 393,399 ---- touch bus_if.h touch device_if.h echo -n " Compiling stub... " ! if ! ${CC} -D_KERNEL -DDRV_DATA_START=ndis_${SYSBASE}_drv_data_start -DDRV_NAME=ndis_${SYSBASE} -DDRV_DATA_END=ndis_${SYSBASE}_drv_data_end -I. ${STUBFILE} -c -o windrv_stub.o; then echo "compilation failed. Exiting." echo "" exit --r5Pyd7+fXNt84Ff3--