Slight problem with ndisgen and ndiscvt
Fredrik Lindberg
fli+freebsd-current at shapeshifter.se
Thu Jun 16 12:56:49 GMT 2005
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
-------------- next part --------------
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
More information about the freebsd-current
mailing list