Deleted Added
full compact
ndisgen.sh (145485) ndisgen.sh (148279)
1#!/bin/sh
2#
3# Copyright (c) 2005
4# Bill Paul <wpaul@windriver.com>. All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:

--- 16 unchanged lines hidden (view full) ---

25# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
31# THE POSSIBILITY OF SUCH DAMAGE.
32#
1#!/bin/sh
2#
3# Copyright (c) 2005
4# Bill Paul <wpaul@windriver.com>. All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:

--- 16 unchanged lines hidden (view full) ---

25# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
31# THE POSSIBILITY OF SUCH DAMAGE.
32#
33# $FreeBSD: head/usr.sbin/ndiscvt/ndisgen.sh 145485 2005-04-24 20:21:22Z wpaul $
33# $FreeBSD: head/usr.sbin/ndiscvt/ndisgen.sh 148279 2005-07-22 05:49:41Z jkim $
34#
35
36header () {
37clear
38echo " =================================================================="
39echo " ------------------ Windows(r) driver converter -------------------"
40echo " =================================================================="
41echo ""

--- 10 unchanged lines hidden (view full) ---

52echo ""
53echo " 1] Learn about the NDIS compatibility system"
54echo " 2] Convert individual firmware files"
55echo " 3] Convert driver"
56echo " 4] Exit"
57echo ""
58echo -n " Enter your selection here and press return: "
59read KEYPRESS
34#
35
36header () {
37clear
38echo " =================================================================="
39echo " ------------------ Windows(r) driver converter -------------------"
40echo " =================================================================="
41echo ""

--- 10 unchanged lines hidden (view full) ---

52echo ""
53echo " 1] Learn about the NDIS compatibility system"
54echo " 2] Convert individual firmware files"
55echo " 3] Convert driver"
56echo " 4] Exit"
57echo ""
58echo -n " Enter your selection here and press return: "
59read KEYPRESS
60return
60}
61
62
63help1 () {
64header
65echo " General information"
66echo ""
67echo " The NDIS compatibility system is designed to let you use Windows(r)"

--- 5 unchanged lines hidden (view full) ---

73echo ""
74echo " In order to use your network device in NDIS compatibility mode,"
75echo " you need the Windows(r) driver that goes with it. Also, the driver"
76echo " must be compiled for the same architecture as the release of FreeBSD"
77echo " you have installed. At this time, the i386 and amd64 architectures"
78echo " are both supported. Note that you cannot use a Windows/i386 driver"
79echo " with FreeBSD/amd64: you must obtain a Windows/amd64 driver."
80echo ""
61}
62
63
64help1 () {
65header
66echo " General information"
67echo ""
68echo " The NDIS compatibility system is designed to let you use Windows(r)"

--- 5 unchanged lines hidden (view full) ---

74echo ""
75echo " In order to use your network device in NDIS compatibility mode,"
76echo " you need the Windows(r) driver that goes with it. Also, the driver"
77echo " must be compiled for the same architecture as the release of FreeBSD"
78echo " you have installed. At this time, the i386 and amd64 architectures"
79echo " are both supported. Note that you cannot use a Windows/i386 driver"
80echo " with FreeBSD/amd64: you must obtain a Windows/amd64 driver."
81echo ""
81echo -n " Press any key to continue... "
82echo -n " Press return to continue... "
82read KEYPRESS
83read KEYPRESS
84return
83}
84
85help2() {
86header
87echo " Where to get drivers"
88echo ""
89echo " If you purchased your network card separately from your computer,"
90echo " there should have been a driver distribution CD included with the"

--- 6 unchanged lines hidden (view full) ---

97echo ""
98echo " If your card was supplied with your computer, or is a built-in device,"
99echo " drivers may have been included on a special driver bundle CD shipped"
100echo " with the computer."
101echo ""
102echo " If you don't have a driver CD, you should be able to find a driver"
103echo " kit on the card or computer vendor's web site."
104echo ""
85}
86
87help2() {
88header
89echo " Where to get drivers"
90echo ""
91echo " If you purchased your network card separately from your computer,"
92echo " there should have been a driver distribution CD included with the"

--- 6 unchanged lines hidden (view full) ---

99echo ""
100echo " If your card was supplied with your computer, or is a built-in device,"
101echo " drivers may have been included on a special driver bundle CD shipped"
102echo " with the computer."
103echo ""
104echo " If you don't have a driver CD, you should be able to find a driver"
105echo " kit on the card or computer vendor's web site."
106echo ""
105echo -n " Press any key to continue... "
107echo -n " Press return to continue... "
106read KEYPRESS
108read KEYPRESS
109return
107}
108
109help3 () {
110header
111echo " What files do I need?"
112echo ""
113echo " In most cases, you will need only two files: a .INF file and a .SYS"
114echo " file. The .INF file is a text file used by the Windows(r) installer to"
115echo " perform the driver installation. It contains information that tells"
110}
111
112help3 () {
113header
114echo " What files do I need?"
115echo ""
116echo " In most cases, you will need only two files: a .INF file and a .SYS"
117echo " file. The .INF file is a text file used by the Windows(r) installer to"
118echo " perform the driver installation. It contains information that tells"
116echo " the intaller what devices the driver supports and what registry keys"
119echo " the installer what devices the driver supports and what registry keys"
117echo " should be created to control driver configuration. The .SYS file"
118echo " is the actual driver executable code in Windows(r) Portable Executable"
119echo " (PE) format. Note that sometimes the .INF file is supplied in unicode"
120echo " format. Unicode .INF files must be converted to ASCII form with the"
121echo " iconv(1) utility before this installer script can use them."
122echo " Occasionally, a driver may require firmware or register setup"
123echo " files that are external to the main .SYS file. These are provided"
124echo " on the same CD with the driver itself, and sometimes have a .BIN"
125echo " extension, though they can be named almost anything. You will need"
126echo " these additional files to make your device work with the NDIS"
127echo " compatibility system as well."
128echo ""
120echo " should be created to control driver configuration. The .SYS file"
121echo " is the actual driver executable code in Windows(r) Portable Executable"
122echo " (PE) format. Note that sometimes the .INF file is supplied in unicode"
123echo " format. Unicode .INF files must be converted to ASCII form with the"
124echo " iconv(1) utility before this installer script can use them."
125echo " Occasionally, a driver may require firmware or register setup"
126echo " files that are external to the main .SYS file. These are provided"
127echo " on the same CD with the driver itself, and sometimes have a .BIN"
128echo " extension, though they can be named almost anything. You will need"
129echo " these additional files to make your device work with the NDIS"
130echo " compatibility system as well."
131echo ""
129echo -n " Press any key to continue... "
132echo -n " Press return to continue... "
130read KEYPRESS
133read KEYPRESS
134return
131}
132
133help4 () {
134header
135echo " How does it all work?"
136echo ""
137echo " The installer script uses the ndiscvt(1) utility to convert the .INF,"
138echo " .SYS and optional firmware files into a FreeBSD kernel loadable module"

--- 6 unchanged lines hidden (view full) ---

145echo " stub file which contains a small amount of code to interface with"
146echo " the FreeBSD module system. This stub is linked together with the"
147echo " converted ELF objects to form a FreeBSD kernel module. A static ELF"
148echo " object (.o) file is also created. This file can be linked into a"
149echo " static kernel image for those who want/need a fully linked kernel"
150echo " image (possibly for embedded bootstrap purposes, or just plain old"
151echo " experimentation)."
152echo ""
135}
136
137help4 () {
138header
139echo " How does it all work?"
140echo ""
141echo " The installer script uses the ndiscvt(1) utility to convert the .INF,"
142echo " .SYS and optional firmware files into a FreeBSD kernel loadable module"

--- 6 unchanged lines hidden (view full) ---

149echo " stub file which contains a small amount of code to interface with"
150echo " the FreeBSD module system. This stub is linked together with the"
151echo " converted ELF objects to form a FreeBSD kernel module. A static ELF"
152echo " object (.o) file is also created. This file can be linked into a"
153echo " static kernel image for those who want/need a fully linked kernel"
154echo " image (possibly for embedded bootstrap purposes, or just plain old"
155echo " experimentation)."
156echo ""
153echo -n " Press any key to continue... "
157echo -n " Press return to continue... "
154read KEYPRESS
158read KEYPRESS
159return
155}
156
157help5 () {
158header
159echo " Prerequisites"
160echo ""
161echo " Converting a driver requires the following utilities:"
162echo ""

--- 6 unchanged lines hidden (view full) ---

169echo " then you'll also need:"
170echo ""
171echo " - The iconv(1) utility."
172echo ""
173echo " If you have installed the X Window system or some sort of desktop"
174echo " environment, then iconv(1) should already be present. If not, you"
175echo " will need to install the libiconv package or port."
176echo ""
160}
161
162help5 () {
163header
164echo " Prerequisites"
165echo ""
166echo " Converting a driver requires the following utilities:"
167echo ""

--- 6 unchanged lines hidden (view full) ---

174echo " then you'll also need:"
175echo ""
176echo " - The iconv(1) utility."
177echo ""
178echo " If you have installed the X Window system or some sort of desktop"
179echo " environment, then iconv(1) should already be present. If not, you"
180echo " will need to install the libiconv package or port."
181echo ""
177echo -n " Press any key to continue... "
182echo -n " Press return to continue... "
178read KEYPRESS
183read KEYPRESS
184return
179}
180
181infconv () {
182header
183echo " INF file validation"
184echo ""
185echo ""
186echo " A .INF file is most often provided as an ASCII file, however"
187echo " files with multilanguage support are provided in Unicode format."
188echo " Please type in the path to your .INF file now."
189echo ""
190echo -n " > "
191read INFPATH
185}
186
187infconv () {
188header
189echo " INF file validation"
190echo ""
191echo ""
192echo " A .INF file is most often provided as an ASCII file, however"
193echo " files with multilanguage support are provided in Unicode format."
194echo " Please type in the path to your .INF file now."
195echo ""
196echo -n " > "
197read INFPATH
192if [ $INFPATH ] && [ -e $INFPATH ];
193then
194 INFTYPE=`${FILE} ${INFPATH}`
195
196 case ${INFTYPE} in
197 *ASCII*)
198if [ ${INFPATH} ] && [ -e ${INFPATH} ]; then
199 INFTYPE=`${EGREP} -i -c "^Signature|^.S.i.g.n.a.t.u.r.e" ${INFPATH}`
200 if [ ${INFTYPE} -le 0 ]; then
198 echo ""
201 echo ""
199 echo " This .INF file appears to be ASCII."
202 echo " I don't recognize this file format. It may not be a valid .INF file."
200 echo ""
203 echo ""
201 echo -n " Press any key to continue... "
204 echo -n " Press enter to try again, or ^C to quit. "
202 read KEYPRESS
205 read KEYPRESS
203 ;;
204 *text*)
206 INFPATH=""
207 return
208 fi
209
210 INFTYPE=`${EGREP} -i -c "^Class.*=.*Net" ${INFPATH}`
211 if [ ${INFTYPE} -gt 0 ]; then
205 echo ""
206 echo " This .INF file appears to be ASCII."
207 echo ""
212 echo ""
213 echo " This .INF file appears to be ASCII."
214 echo ""
208 echo -n " Press any key to continue... "
215 echo -n " Press return to continue... "
209 read KEYPRESS
216 read KEYPRESS
210 ;;
211 *nicode*)
217 return
218 fi
219
220 INFTYPE=`${EGREP} -i -c "^.C.l.a.s.s.*=.*N.e.t" ${INFPATH}`
221 if [ ${INFTYPE} -gt 0 ]; then
212 echo ""
213 echo " This .INF file appears to be Unicode."
222 echo ""
223 echo " This .INF file appears to be Unicode."
214 if [ -e $ICONVPATH ];
215 then
224 if [ -e ${ICONVPATH} ]; then
216 echo " Trying to convert to ASCII..."
225 echo " Trying to convert to ASCII..."
217 ${RM} -f /tmp/ascii.inf
218 ${ICONVPATH} -f utf-16 -t utf-8 ${INFPATH} > /tmp/ascii.inf
219 INFPATH=/tmp/ascii.inf
226 ${ICONVPATH} -f utf-16 -t utf-8 ${INFPATH} > ${INFFILE}
227 INFPATH=${INFFILE}
220 echo " Done."
221 echo ""
228 echo " Done."
229 echo ""
222 echo -n " Press any key to continue... "
230 echo -n " Press return to continue... "
223 read KEYPRESS
224 else
225 echo " The iconv(1) utility does not appear to be installed."
226 echo " Please install this utility or convert the .INF file"
227 echo " to ASCII and run this utility again."
228 echo ""
229 exit
230 fi
231 read KEYPRESS
232 else
233 echo " The iconv(1) utility does not appear to be installed."
234 echo " Please install this utility or convert the .INF file"
235 echo " to ASCII and run this utility again."
236 echo ""
237 exit
238 fi
231 ;;
232 *)
233 echo ""
234 echo " I don't recognize this file format. It may not be a valid .INF file."
235 echo ""
236 echo -n " Press enter to try again, or ^C to quit. "
237 read KEYPRESS
238 INFPATH=""
239 ;;
240 esac
239 return
240 fi
241
242 echo ""
243 echo " I don't recognize this file format. It may not be a valid .INF file."
244 echo ""
245 echo -n " Press enter to try again, or ^C to quit. "
246 read KEYPRESS
247 INFPATH=""
241else
242 echo ""
248else
249 echo ""
243 echo " The file '$INFPATH' was not found."
250 echo " The file '${INFPATH}' was not found."
244 echo ""
245 echo -n " Press enter to try again, or ^C to quit. "
246 read KEYPRESS
247 INFPATH=""
248fi
251 echo ""
252 echo -n " Press enter to try again, or ^C to quit. "
253 read KEYPRESS
254 INFPATH=""
255fi
256return
249}
250
251sysconv() {
252header
253echo " Driver file validation"
254echo ""
255echo ""
256echo " Now you need to specify the name of the Windows(r) driver .SYS"
257echo " file for your device. Note that if you are running FreeBSD/amd64,"
258echo " then you must provide a driver that has been compiled for the"
259echo " 64-bit Windows(r) platform. If a 64-bit driver is not available"
260echo " for your device, you must install FreeBSD/ia32 and use the"
261echo " 32-bit driver instead."
262echo ""
263echo " Please type in the path to the Windows(r) driver .SYS file now."
264echo ""
265echo -n " > "
266read SYSPATH
257}
258
259sysconv() {
260header
261echo " Driver file validation"
262echo ""
263echo ""
264echo " Now you need to specify the name of the Windows(r) driver .SYS"
265echo " file for your device. Note that if you are running FreeBSD/amd64,"
266echo " then you must provide a driver that has been compiled for the"
267echo " 64-bit Windows(r) platform. If a 64-bit driver is not available"
268echo " for your device, you must install FreeBSD/ia32 and use the"
269echo " 32-bit driver instead."
270echo ""
271echo " Please type in the path to the Windows(r) driver .SYS file now."
272echo ""
273echo -n " > "
274read SYSPATH
267if [ $SYSPATH ] && [ -e $SYSPATH ];
268then
275if [ ${SYSPATH} ] && [ -e ${SYSPATH} ]; then
269 SYSTYPE=`${FILE} ${SYSPATH}`
270
271 case ${SYSTYPE} in
272 *Windows*)
273 echo ""
274 echo " This .SYS file appears to be in Windows(r) PE format."
275 echo ""
276 SYSTYPE=`${FILE} ${SYSPATH}`
277
278 case ${SYSTYPE} in
279 *Windows*)
280 echo ""
281 echo " This .SYS file appears to be in Windows(r) PE format."
282 echo ""
276 echo -n " Press any key to continue... "
283 echo -n " Press return to continue... "
277 read KEYPRESS
284 read KEYPRESS
278 SYSBASE=`basename ${SYSPATH} | ${TR} '.' '_'`
285 SYSBASE=`${BASENAME} ${SYSPATH} | ${TR} '.' '_'`
279 ;;
280 *)
281 echo ""
282 echo " I don't recognize this file format. It may not be a valid .SYS file."
283 echo ""
284
285 echo -n " Press enter to try again, or ^C to quit. "
286 read KEYPRESS
287 SYSPATH=""
288 ;;
289 esac
290else
291 echo ""
286 ;;
287 *)
288 echo ""
289 echo " I don't recognize this file format. It may not be a valid .SYS file."
290 echo ""
291
292 echo -n " Press enter to try again, or ^C to quit. "
293 read KEYPRESS
294 SYSPATH=""
295 ;;
296 esac
297else
298 echo ""
292 echo " The file '$SYSPATH' was not found."
299 echo " The file '${SYSPATH}' was not found."
293 echo ""
294 echo -n " Press enter to try again, or ^C to quit. "
295 read KEYPRESS
296 SYSPATH=""
297fi
300 echo ""
301 echo -n " Press enter to try again, or ^C to quit. "
302 read KEYPRESS
303 SYSPATH=""
304fi
305return
298}
299
300ndiscvt() {
301header
302echo " Driver file conversion"
303echo ""
304echo " The script will now try to convert the .INF and .SYS files"
305echo " using the ndiscvt(1) utility. This utility can handle most"

--- 11 unchanged lines hidden (view full) ---

317 exit
318else
319 echo ""
320 echo " Conversion was successful."
321 echo ""
322 echo -n " Press enter to continue... "
323 read KEYPRESS
324fi
306}
307
308ndiscvt() {
309header
310echo " Driver file conversion"
311echo ""
312echo " The script will now try to convert the .INF and .SYS files"
313echo " using the ndiscvt(1) utility. This utility can handle most"

--- 11 unchanged lines hidden (view full) ---

325 exit
326else
327 echo ""
328 echo " Conversion was successful."
329 echo ""
330 echo -n " Press enter to continue... "
331 read KEYPRESS
332fi
333return
325}
326
327firmcvt() {
328 while : ; do
329header
330echo " Firmware file conversion"
331echo ""
332echo " If your driver uses additional firmware files, please list them"
333echo " below. When you're finished, just press enter to contiue. (If your"
334echo " driver doesn't need any extra firmware files, just press enter"
335echo " to move to the next step.)"
336echo ""
337 echo -n " > "
338 read FIRMPATH
339
334}
335
336firmcvt() {
337 while : ; do
338header
339echo " Firmware file conversion"
340echo ""
341echo " If your driver uses additional firmware files, please list them"
342echo " below. When you're finished, just press enter to contiue. (If your"
343echo " driver doesn't need any extra firmware files, just press enter"
344echo " to move to the next step.)"
345echo ""
346 echo -n " > "
347 read FIRMPATH
348
340 if [ $FIRMPATH ] && [ $FIRMPATH != "" ]; then
341 if [ ! -e $FIRMPATH ]; then
349 if [ ${FIRMPATH} ]; then
350 if [ ! -e ${FIRMPATH} ]; then
342 echo ""
351 echo ""
343 echo " The file '$FIRMPATH' was not found"
352 echo " The file '${FIRMPATH}' was not found"
344 echo ""
345 echo -n " Press enter to try again, or ^C to quit. "
346 read KEYPRESS
347 continue
348 fi
349 if ! ${NDISCVT} -f ${FIRMPATH} > /dev/null; then
350 echo ""
351 echo "CONVERSION FAILED"
352 else
353 echo ""
354 echo " Conversion was successful."
355 echo ""
353 echo ""
354 echo -n " Press enter to try again, or ^C to quit. "
355 read KEYPRESS
356 continue
357 fi
358 if ! ${NDISCVT} -f ${FIRMPATH} > /dev/null; then
359 echo ""
360 echo "CONVERSION FAILED"
361 else
362 echo ""
363 echo " Conversion was successful."
364 echo ""
356 FRMBASE=`basename ${FIRMPATH}`
365 FRMBASE=`${BASENAME} ${FIRMPATH}`
357 FRMBASE="${FRMBASE}.o"
358 FRMLIST="${FRMLIST} ${FRMBASE}"
359 fi
360 echo -n " Press enter to continue... "
361 read KEYPRESS
362 else
363 break
364 fi
365 done
366
367header
368echo ""
369echo " List of files converted firmware files:"
370echo ""
366 FRMBASE="${FRMBASE}.o"
367 FRMLIST="${FRMLIST} ${FRMBASE}"
368 fi
369 echo -n " Press enter to continue... "
370 read KEYPRESS
371 else
372 break
373 fi
374 done
375
376header
377echo ""
378echo " List of files converted firmware files:"
379echo ""
371for i in $FRMLIST
380for i in ${FRMLIST}
372do
373 echo " "$i
374done
375echo ""
376echo -n " Press enter to continue... "
377read KEYPRESS
381do
382 echo " "$i
383done
384echo ""
385echo -n " Press enter to continue... "
386read KEYPRESS
387return
378}
379
380drvgen () {
381header
382echo " Kernel module generation"
383echo ""
384echo ""
385echo " The script will now try to generate the kernel driver module."
386echo " This is the last step. Once this module is generated, you should"
387echo " be able to load it just like any other FreeBSD driver module."
388echo ""
389echo " Press enter to compile the stub module and generate the driver"
390echo -n " module now: "
391read KEYPRESS
392echo ""
388}
389
390drvgen () {
391header
392echo " Kernel module generation"
393echo ""
394echo ""
395echo " The script will now try to generate the kernel driver module."
396echo " This is the last step. Once this module is generated, you should"
397echo " be able to load it just like any other FreeBSD driver module."
398echo ""
399echo " Press enter to compile the stub module and generate the driver"
400echo -n " module now: "
401read KEYPRESS
402echo ""
393touch bus_if.h
394touch device_if.h
395echo -n " Compiling stub... "
396if ! ${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
397 echo "compilation failed. Exiting."
403echo -n " Generating Makefile... "
404echo ".PATH: ${PWD} ${STUBPATH}" > ${MAKEFILE}
405echo "KMOD= ${SYSBASE}" >> ${MAKEFILE}
406echo "SRCS+= ${STUBFILE} ${DNAME}.h bus_if.h device_if.h" >> ${MAKEFILE}
407echo "OBJS+=${FRMLIST} ${DNAME}.o" >> ${MAKEFILE}
408echo "CFLAGS+= \\" >> ${MAKEFILE}
409echo " -DDRV_DATA_START=${SYSBASE}_drv_data_start \\" >> ${MAKEFILE}
410echo " -DDRV_NAME=${SYSBASE} \\" >> ${MAKEFILE}
411echo " -DDRV_DATA_END=${SYSBASE}_drv_data_end" >> ${MAKEFILE}
412echo "CLEANFILES+= \\" >> ${MAKEFILE}
413echo " ${INFFILE} \\" >> ${MAKEFILE}
414echo " ${DNAME}.h \\" >> ${MAKEFILE}
415echo " ${DNAME}.o" >> ${MAKEFILE}
416echo ".include <bsd.kmod.mk>" >> ${MAKEFILE}
417if [ -f ${MAKEFILE} ]; then
418 echo "done."
419else
420 echo "generating Makefile failed. Exiting."
398 echo ""
399 exit
421 echo ""
422 exit
400else
401 echo "done."
402fi
423fi
403echo -n " Linking loadable kernel module... "
404if ! ${LD} -Bshareable -d -warn-common -o ${SYSBASE}.ko windrv_stub.o ${FRMLIST} ${DNAME}.o; then
405 echo "linking failed. Exiting."
424echo -n " Building kernel module... "
425echo "" > bus_if.h
426echo "" > device_if.h
427if ! ${MAKE} -f ${MAKEFILE} depend > /dev/null; then
428 echo "build failed. Exiting."
406 echo ""
407 exit
429 echo ""
430 exit
431fi
432if ! ${MAKE} -f ${MAKEFILE} all > /dev/null; then
433 echo "build failed. Exiting."
434 echo ""
435 exit
408else
436else
409 echo "done."
437 if [ -f ${SYSBASE}.ko ]; then
438 ${MV} ${SYSBASE}.ko ${SYSBASE}.kmod
439 echo "done."
440 else
441 echo "build failed. Exiting."
442 echo ""
443 exit
444 fi
410fi
445fi
411echo -n " Linking static kernel module... "
412if ! ${LD} -r -d -warn-common -o ${SYSBASE}.o windrv_stub.o ${FRMLIST} ${DNAME}.o; then
413 echo "linking failed. Exiting."
446echo -n " Cleaning up... "
447if ! ${MAKE} -f ${MAKEFILE} clean cleandepend > /dev/null; then
448 echo "cleanup failed. Exiting."
414 echo ""
415 exit
416else
417 echo "done."
418fi
449 echo ""
450 exit
451else
452 echo "done."
453fi
419echo -n " Cleaning up... "
420${RM} -f bus_if.h device_if.h windrv_stub.o
421${RM} -f ${DNAME}.h ${DNAME}.o
422echo "done."
454${RM} ${MAKEFILE}
455${MV} ${SYSBASE}.kmod ${SYSBASE}.ko
423echo ""
456echo ""
424echo " The file $SYSBASE.ko has been successfully generated."
457echo " The file ${SYSBASE}.ko has been successfully generated."
425echo " You can kldload this module to get started."
426echo ""
458echo " You can kldload this module to get started."
459echo ""
427echo -n " Press any key to exit. "
460echo -n " Press return to exit. "
428read KEYPRESS
429echo ""
430echo ""
461read KEYPRESS
462echo ""
463echo ""
464return
431}
432
433convert_driver () {
434 while : ; do
435 infconv
465}
466
467convert_driver () {
468 while : ; do
469 infconv
436 if [ $INFPATH ] && [ $INFPATH != "" ]; then
470 if [ ${INFPATH} ]; then
437 break
438 fi
439 done
440
441 while : ; do
442 sysconv
471 break
472 fi
473 done
474
475 while : ; do
476 sysconv
443 if [ $SYSPATH ] && [ $SYSPATH != "" ]; then
477 if [ ${SYSPATH} ]; then
444 break
445 fi
446 done
447
448 ndiscvt
449 firmcvt
450 drvgen
478 break
479 fi
480 done
481
482 ndiscvt
483 firmcvt
484 drvgen
485 return
451}
452
453ICONVPATH=/usr/local/bin/iconv
454NDISCVT=/usr/sbin/ndiscvt
486}
487
488ICONVPATH=/usr/local/bin/iconv
489NDISCVT=/usr/sbin/ndiscvt
455STUBFILE=/usr/share/misc/windrv_stub.c
490STUBPATH=/usr/share/misc
491STUBFILE=windrv_stub.c
456DNAME=windrv
492DNAME=windrv
457OBJCOPY=/usr/bin/objcopy
458CC=/usr/bin/cc
459LD=/usr/bin/ld
493CP=/bin/cp
494MV=/bin/mv
460RM=/bin/rm
461TR=/usr/bin/tr
462FILE=/usr/bin/file
495RM=/bin/rm
496TR=/usr/bin/tr
497FILE=/usr/bin/file
498EGREP=/usr/bin/egrep
499MAKE=/usr/bin/make
500BASENAME=/usr/bin/basename
501TOUCH=/usr/bin/touch
502MKTEMP=/usr/bin/mktemp
463
503
504MAKEFILE=`${MKTEMP} /tmp/Makefile.XXXXXX`
505INFFILE=`${MKTEMP} /tmp/ascii_inf.XXXXXX`
506
464INFPATH=""
465FRMLIST=""
466SYSPATH=""
467SYSBASE=""
468FRMBASE=""
469
470while : ; do
471 mainmenu

--- 21 unchanged lines hidden (view full) ---

493 *)
494 header
495 echo ""
496 echo -n " Sorry, I didn't underatand that. Press enter to try again: "
497 read KEYPRESS
498 ;;
499 esac
500done
507INFPATH=""
508FRMLIST=""
509SYSPATH=""
510SYSBASE=""
511FRMBASE=""
512
513while : ; do
514 mainmenu

--- 21 unchanged lines hidden (view full) ---

536 *)
537 header
538 echo ""
539 echo -n " Sorry, I didn't underatand that. Press enter to try again: "
540 read KEYPRESS
541 ;;
542 esac
543done
544exit