ndisgen.sh revision 148281
1145485Swpaul#!/bin/sh 2145485Swpaul# 3145485Swpaul# Copyright (c) 2005 4145485Swpaul# Bill Paul <wpaul@windriver.com>. All rights reserved. 5145485Swpaul# 6145485Swpaul# Redistribution and use in source and binary forms, with or without 7145485Swpaul# modification, are permitted provided that the following conditions 8145485Swpaul# are met: 9145485Swpaul# 1. Redistributions of source code must retain the above copyright 10145485Swpaul# notice, this list of conditions and the following disclaimer. 11145485Swpaul# 2. Redistributions in binary form must reproduce the above copyright 12145485Swpaul# notice, this list of conditions and the following disclaimer in the 13145485Swpaul# documentation and/or other materials provided with the distribution. 14145485Swpaul# 3. All advertising materials mentioning features or use of this software 15145485Swpaul# must display the following acknowledgement: 16145485Swpaul# This product includes software developed by Bill Paul. 17145485Swpaul# 4. Neither the name of the author nor the names of any co-contributors 18145485Swpaul# may be used to endorse or promote products derived from this software 19145485Swpaul# without specific prior written permission. 20145485Swpaul# 21145485Swpaul# THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND 22145485Swpaul# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23145485Swpaul# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24145485Swpaul# ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD 25145485Swpaul# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26145485Swpaul# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27145485Swpaul# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28145485Swpaul# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29145485Swpaul# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30145485Swpaul# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31145485Swpaul# THE POSSIBILITY OF SUCH DAMAGE. 32145485Swpaul# 33145485Swpaul# $FreeBSD: head/usr.sbin/ndiscvt/ndisgen.sh 148281 2005-07-22 10:35:34Z ceri $ 34145485Swpaul# 35145485Swpaul 36145485Swpaulheader () { 37145485Swpaulclear 38145485Swpaulecho " ==================================================================" 39145485Swpaulecho " ------------------ Windows(r) driver converter -------------------" 40145485Swpaulecho " ==================================================================" 41145485Swpaulecho "" 42145485Swpaul} 43145485Swpaul 44145485Swpaulmainmenu() { 45145485Swpaulheader 46148281Sceriecho " This script is designed to guide you through the process" 47145485Swpaulecho " of converting a Windows(r) binary driver module and .INF" 48145485Swpaulecho " specification file into a FreeBSD ELF kernel module for use" 49145485Swpaulecho " with the NDIS compatibility system." 50145485Swpaulecho "" 51145485Swpaulecho " The following options are available:" 52145485Swpaulecho "" 53145485Swpaulecho " 1] Learn about the NDIS compatibility system" 54145485Swpaulecho " 2] Convert individual firmware files" 55145485Swpaulecho " 3] Convert driver" 56145485Swpaulecho " 4] Exit" 57145485Swpaulecho "" 58145485Swpaulecho -n " Enter your selection here and press return: " 59145485Swpaulread KEYPRESS 60148279Sjkimreturn 61145485Swpaul} 62145485Swpaul 63145485Swpaul 64145485Swpaulhelp1 () { 65145485Swpaulheader 66145485Swpaulecho " General information" 67145485Swpaulecho "" 68145485Swpaulecho " The NDIS compatibility system is designed to let you use Windows(r)" 69145485Swpaulecho " binary drivers for networking devices with FreeBSD, in cases where" 70145485Swpaulecho " a native FreeBSD driver is not available due to hardware manufacturer" 71145485Swpaulecho " oversight or stupidity. NDIS stands for Network Driver Interface" 72145485Swpaulecho " Standard, and refers to the programming model used to write Windows(r)" 73145485Swpaulecho " network drivers. (These are often called \"NDIS miniport\" drivers.)" 74145485Swpaulecho "" 75145485Swpaulecho " In order to use your network device in NDIS compatibility mode," 76145485Swpaulecho " you need the Windows(r) driver that goes with it. Also, the driver" 77145485Swpaulecho " must be compiled for the same architecture as the release of FreeBSD" 78145485Swpaulecho " you have installed. At this time, the i386 and amd64 architectures" 79145485Swpaulecho " are both supported. Note that you cannot use a Windows/i386 driver" 80145485Swpaulecho " with FreeBSD/amd64: you must obtain a Windows/amd64 driver." 81145485Swpaulecho "" 82148279Sjkimecho -n " Press return to continue... " 83145485Swpaulread KEYPRESS 84148279Sjkimreturn 85145485Swpaul} 86145485Swpaul 87145485Swpaulhelp2() { 88145485Swpaulheader 89145485Swpaulecho " Where to get drivers" 90145485Swpaulecho "" 91145485Swpaulecho " If you purchased your network card separately from your computer," 92145485Swpaulecho " there should have been a driver distribution CD included with the" 93145485Swpaulecho " card which contains Windows(r) drivers. The NDIS compatibility" 94145485Swpaulecho " system is designed to emulate the NDIS API of a couple of different" 95145485Swpaulecho " Windows(r) releases, however it works best with drivers designed" 96145485Swpaulecho " for NDIS 5.0 or later. Drivers distributed for Windows 2000 should" 97148281Sceriecho " work; however, for best results you should use a driver designed" 98145485Swpaulecho " for Windows XP or Windows Server 2003." 99145485Swpaulecho "" 100145485Swpaulecho " If your card was supplied with your computer, or is a built-in device," 101145485Swpaulecho " drivers may have been included on a special driver bundle CD shipped" 102145485Swpaulecho " with the computer." 103145485Swpaulecho "" 104145485Swpaulecho " If you don't have a driver CD, you should be able to find a driver" 105145485Swpaulecho " kit on the card or computer vendor's web site." 106145485Swpaulecho "" 107148279Sjkimecho -n " Press return to continue... " 108145485Swpaulread KEYPRESS 109148279Sjkimreturn 110145485Swpaul} 111145485Swpaul 112145485Swpaulhelp3 () { 113145485Swpaulheader 114145485Swpaulecho " What files do I need?" 115145485Swpaulecho "" 116145485Swpaulecho " In most cases, you will need only two files: a .INF file and a .SYS" 117145485Swpaulecho " file. The .INF file is a text file used by the Windows(r) installer to" 118145485Swpaulecho " perform the driver installation. It contains information that tells" 119148279Sjkimecho " the installer what devices the driver supports and what registry keys" 120145485Swpaulecho " should be created to control driver configuration. The .SYS file" 121145485Swpaulecho " is the actual driver executable code in Windows(r) Portable Executable" 122148281Sceriecho " (PE) format. Note that sometimes the .INF file is supplied in Unicode" 123145485Swpaulecho " format. Unicode .INF files must be converted to ASCII form with the" 124145485Swpaulecho " iconv(1) utility before this installer script can use them." 125145485Swpaulecho " Occasionally, a driver may require firmware or register setup" 126145485Swpaulecho " files that are external to the main .SYS file. These are provided" 127145485Swpaulecho " on the same CD with the driver itself, and sometimes have a .BIN" 128145485Swpaulecho " extension, though they can be named almost anything. You will need" 129145485Swpaulecho " these additional files to make your device work with the NDIS" 130145485Swpaulecho " compatibility system as well." 131145485Swpaulecho "" 132148279Sjkimecho -n " Press return to continue... " 133145485Swpaulread KEYPRESS 134148279Sjkimreturn 135145485Swpaul} 136145485Swpaul 137145485Swpaulhelp4 () { 138145485Swpaulheader 139145485Swpaulecho " How does it all work?" 140145485Swpaulecho "" 141145485Swpaulecho " The installer script uses the ndiscvt(1) utility to convert the .INF," 142145485Swpaulecho " .SYS and optional firmware files into a FreeBSD kernel loadable module" 143145485Swpaulecho " (.ko) file. This module can be loaded via the kldload(8) utility or" 144145485Swpaulecho " loaded automatically via the /boot/loader.conf file. The ndiscvt(1)" 145145485Swpaulecho " utility extracts the device ID information and registry key data" 146145485Swpaulecho " from the .INF file and converts it into a C header file. It also uses" 147145485Swpaulecho " the objcopy(1) utility to convert the .SYS file and optional firmware" 148145485Swpaulecho " files into ELF objects. The header file is compiled into a small C" 149145485Swpaulecho " stub file which contains a small amount of code to interface with" 150145485Swpaulecho " the FreeBSD module system. This stub is linked together with the" 151145485Swpaulecho " converted ELF objects to form a FreeBSD kernel module. A static ELF" 152145485Swpaulecho " object (.o) file is also created. This file can be linked into a" 153145485Swpaulecho " static kernel image for those who want/need a fully linked kernel" 154145485Swpaulecho " image (possibly for embedded bootstrap purposes, or just plain old" 155145485Swpaulecho " experimentation)." 156145485Swpaulecho "" 157148279Sjkimecho -n " Press return to continue... " 158145485Swpaulread KEYPRESS 159148279Sjkimreturn 160145485Swpaul} 161145485Swpaul 162145485Swpaulhelp5 () { 163145485Swpaulheader 164145485Swpaulecho " Prerequisites" 165145485Swpaulecho "" 166145485Swpaulecho " Converting a driver requires the following utilities:" 167145485Swpaulecho "" 168145485Swpaulecho " - The FreeBSD C compiler, cc(1) (part of the base install)." 169145485Swpaulecho " - The FreeBSD linker, ld(1) (part of the base install)." 170145485Swpaulecho " - The objcopy(1) utility (part of the base install)." 171145485Swpaulecho " - The ndiscvt(1) utility (part of the base install)." 172145485Swpaulecho "" 173148281Sceriecho " If you happen to end up with a .INF file that's in Unicode format," 174145485Swpaulecho " then you'll also need:" 175145485Swpaulecho "" 176145485Swpaulecho " - The iconv(1) utility." 177145485Swpaulecho "" 178145485Swpaulecho " If you have installed the X Window system or some sort of desktop" 179145485Swpaulecho " environment, then iconv(1) should already be present. If not, you" 180145485Swpaulecho " will need to install the libiconv package or port." 181145485Swpaulecho "" 182148279Sjkimecho -n " Press return to continue... " 183145485Swpaulread KEYPRESS 184148279Sjkimreturn 185145485Swpaul} 186145485Swpaul 187145485Swpaulinfconv () { 188145485Swpaulheader 189145485Swpaulecho " INF file validation" 190145485Swpaulecho "" 191145485Swpaulecho "" 192145485Swpaulecho " A .INF file is most often provided as an ASCII file, however" 193145485Swpaulecho " files with multilanguage support are provided in Unicode format." 194145485Swpaulecho " Please type in the path to your .INF file now." 195145485Swpaulecho "" 196145485Swpaulecho -n " > " 197145485Swpaulread INFPATH 198148279Sjkimif [ ${INFPATH} ] && [ -e ${INFPATH} ]; then 199148279Sjkim INFTYPE=`${EGREP} -i -c "^Signature|^.S.i.g.n.a.t.u.r.e" ${INFPATH}` 200148279Sjkim if [ ${INFTYPE} -le 0 ]; then 201145485Swpaul echo "" 202148279Sjkim echo " I don't recognize this file format. It may not be a valid .INF file." 203145485Swpaul echo "" 204148279Sjkim echo -n " Press enter to try again, or ^C to quit. " 205145485Swpaul read KEYPRESS 206148279Sjkim INFPATH="" 207148279Sjkim return 208148279Sjkim fi 209148279Sjkim 210148279Sjkim INFTYPE=`${EGREP} -i -c "^Class.*=.*Net" ${INFPATH}` 211148279Sjkim if [ ${INFTYPE} -gt 0 ]; then 212145485Swpaul echo "" 213145485Swpaul echo " This .INF file appears to be ASCII." 214145485Swpaul echo "" 215148279Sjkim echo -n " Press return to continue... " 216145485Swpaul read KEYPRESS 217148279Sjkim return 218148279Sjkim fi 219148279Sjkim 220148279Sjkim INFTYPE=`${EGREP} -i -c "^.C.l.a.s.s.*=.*N.e.t" ${INFPATH}` 221148279Sjkim if [ ${INFTYPE} -gt 0 ]; then 222145485Swpaul echo "" 223145485Swpaul echo " This .INF file appears to be Unicode." 224148279Sjkim if [ -e ${ICONVPATH} ]; then 225145485Swpaul echo " Trying to convert to ASCII..." 226148279Sjkim ${ICONVPATH} -f utf-16 -t utf-8 ${INFPATH} > ${INFFILE} 227148279Sjkim INFPATH=${INFFILE} 228145485Swpaul echo " Done." 229145485Swpaul echo "" 230148279Sjkim echo -n " Press return to continue... " 231145485Swpaul read KEYPRESS 232145485Swpaul else 233145485Swpaul echo " The iconv(1) utility does not appear to be installed." 234145485Swpaul echo " Please install this utility or convert the .INF file" 235145485Swpaul echo " to ASCII and run this utility again." 236145485Swpaul echo "" 237145485Swpaul exit 238145485Swpaul fi 239148279Sjkim return 240148279Sjkim fi 241148279Sjkim 242148279Sjkim echo "" 243148279Sjkim echo " I don't recognize this file format. It may not be a valid .INF file." 244148279Sjkim echo "" 245148279Sjkim echo -n " Press enter to try again, or ^C to quit. " 246148279Sjkim read KEYPRESS 247148279Sjkim INFPATH="" 248145485Swpaulelse 249145485Swpaul echo "" 250148279Sjkim echo " The file '${INFPATH}' was not found." 251145485Swpaul echo "" 252145485Swpaul echo -n " Press enter to try again, or ^C to quit. " 253145485Swpaul read KEYPRESS 254145485Swpaul INFPATH="" 255145485Swpaulfi 256148279Sjkimreturn 257145485Swpaul} 258145485Swpaul 259145485Swpaulsysconv() { 260145485Swpaulheader 261145485Swpaulecho " Driver file validation" 262145485Swpaulecho "" 263145485Swpaulecho "" 264145485Swpaulecho " Now you need to specify the name of the Windows(r) driver .SYS" 265145485Swpaulecho " file for your device. Note that if you are running FreeBSD/amd64," 266145485Swpaulecho " then you must provide a driver that has been compiled for the" 267145485Swpaulecho " 64-bit Windows(r) platform. If a 64-bit driver is not available" 268145485Swpaulecho " for your device, you must install FreeBSD/ia32 and use the" 269145485Swpaulecho " 32-bit driver instead." 270145485Swpaulecho "" 271145485Swpaulecho " Please type in the path to the Windows(r) driver .SYS file now." 272145485Swpaulecho "" 273145485Swpaulecho -n " > " 274145485Swpaulread SYSPATH 275148279Sjkimif [ ${SYSPATH} ] && [ -e ${SYSPATH} ]; then 276145485Swpaul SYSTYPE=`${FILE} ${SYSPATH}` 277145485Swpaul 278145485Swpaul case ${SYSTYPE} in 279145485Swpaul *Windows*) 280145485Swpaul echo "" 281145485Swpaul echo " This .SYS file appears to be in Windows(r) PE format." 282145485Swpaul echo "" 283148279Sjkim echo -n " Press return to continue... " 284145485Swpaul read KEYPRESS 285148279Sjkim SYSBASE=`${BASENAME} ${SYSPATH} | ${TR} '.' '_'` 286145485Swpaul ;; 287145485Swpaul *) 288145485Swpaul echo "" 289145485Swpaul echo " I don't recognize this file format. It may not be a valid .SYS file." 290145485Swpaul echo "" 291145485Swpaul 292145485Swpaul echo -n " Press enter to try again, or ^C to quit. " 293145485Swpaul read KEYPRESS 294145485Swpaul SYSPATH="" 295145485Swpaul ;; 296145485Swpaul esac 297145485Swpaulelse 298145485Swpaul echo "" 299148279Sjkim echo " The file '${SYSPATH}' was not found." 300145485Swpaul echo "" 301145485Swpaul echo -n " Press enter to try again, or ^C to quit. " 302145485Swpaul read KEYPRESS 303145485Swpaul SYSPATH="" 304145485Swpaulfi 305148279Sjkimreturn 306145485Swpaul} 307145485Swpaul 308145485Swpaulndiscvt() { 309145485Swpaulheader 310145485Swpaulecho " Driver file conversion" 311145485Swpaulecho "" 312145485Swpaulecho " The script will now try to convert the .INF and .SYS files" 313145485Swpaulecho " using the ndiscvt(1) utility. This utility can handle most" 314148281Sceriecho " .INF files; however, occasionally it can fail to parse some files" 315145485Swpaulecho " due to subtle syntax issues: the .INF syntax is very complex," 316145485Swpaulecho " and the Windows(r) parser will sometimes allow files with small" 317145485Swpaulecho " syntax errors to be processed correctly which ndiscvt(1) will" 318145485Swpaulecho " not. If the conversion fails, you may have to edit the .INF" 319145485Swpaulecho " file by hand to remove the offending lines." 320145485Swpaulecho "" 321145485Swpaulecho -n " Press enter to try converting the files now: " 322145485Swpaulread KEYPRESS 323145485Swpaulif ! ${NDISCVT} -i ${INFPATH} -s ${SYSPATH} -O -o ${DNAME}.h > /dev/null; then 324145485Swpaul echo "CONVERSION FAILED" 325145485Swpaul exit 326145485Swpaulelse 327145485Swpaul echo "" 328145485Swpaul echo " Conversion was successful." 329145485Swpaul echo "" 330145485Swpaul echo -n " Press enter to continue... " 331145485Swpaul read KEYPRESS 332145485Swpaulfi 333148279Sjkimreturn 334145485Swpaul} 335145485Swpaul 336145485Swpaulfirmcvt() { 337145485Swpaul while : ; do 338145485Swpaulheader 339145485Swpaulecho " Firmware file conversion" 340145485Swpaulecho "" 341145485Swpaulecho " If your driver uses additional firmware files, please list them" 342148281Sceriecho " below. When you're finished, just press enter to continue. (If your" 343145485Swpaulecho " driver doesn't need any extra firmware files, just press enter" 344145485Swpaulecho " to move to the next step.)" 345145485Swpaulecho "" 346145485Swpaul echo -n " > " 347145485Swpaul read FIRMPATH 348145485Swpaul 349148279Sjkim if [ ${FIRMPATH} ]; then 350148279Sjkim if [ ! -e ${FIRMPATH} ]; then 351145485Swpaul echo "" 352148279Sjkim echo " The file '${FIRMPATH}' was not found" 353145485Swpaul echo "" 354145485Swpaul echo -n " Press enter to try again, or ^C to quit. " 355145485Swpaul read KEYPRESS 356145485Swpaul continue 357145485Swpaul fi 358145485Swpaul if ! ${NDISCVT} -f ${FIRMPATH} > /dev/null; then 359145485Swpaul echo "" 360145485Swpaul echo "CONVERSION FAILED" 361145485Swpaul else 362145485Swpaul echo "" 363145485Swpaul echo " Conversion was successful." 364145485Swpaul echo "" 365148279Sjkim FRMBASE=`${BASENAME} ${FIRMPATH}` 366145485Swpaul FRMBASE="${FRMBASE}.o" 367145485Swpaul FRMLIST="${FRMLIST} ${FRMBASE}" 368145485Swpaul fi 369145485Swpaul echo -n " Press enter to continue... " 370145485Swpaul read KEYPRESS 371145485Swpaul else 372145485Swpaul break 373145485Swpaul fi 374145485Swpaul done 375145485Swpaul 376145485Swpaulheader 377145485Swpaulecho "" 378145485Swpaulecho " List of files converted firmware files:" 379145485Swpaulecho "" 380148279Sjkimfor i in ${FRMLIST} 381145485Swpauldo 382145485Swpaul echo " "$i 383145485Swpauldone 384145485Swpaulecho "" 385145485Swpaulecho -n " Press enter to continue... " 386145485Swpaulread KEYPRESS 387148279Sjkimreturn 388145485Swpaul} 389145485Swpaul 390145485Swpauldrvgen () { 391145485Swpaulheader 392145485Swpaulecho " Kernel module generation" 393145485Swpaulecho "" 394145485Swpaulecho "" 395145485Swpaulecho " The script will now try to generate the kernel driver module." 396145485Swpaulecho " This is the last step. Once this module is generated, you should" 397145485Swpaulecho " be able to load it just like any other FreeBSD driver module." 398145485Swpaulecho "" 399145485Swpaulecho " Press enter to compile the stub module and generate the driver" 400145485Swpaulecho -n " module now: " 401145485Swpaulread KEYPRESS 402145485Swpaulecho "" 403148279Sjkimecho -n " Generating Makefile... " 404148279Sjkimecho ".PATH: ${PWD} ${STUBPATH}" > ${MAKEFILE} 405148279Sjkimecho "KMOD= ${SYSBASE}" >> ${MAKEFILE} 406148279Sjkimecho "SRCS+= ${STUBFILE} ${DNAME}.h bus_if.h device_if.h" >> ${MAKEFILE} 407148279Sjkimecho "OBJS+=${FRMLIST} ${DNAME}.o" >> ${MAKEFILE} 408148279Sjkimecho "CFLAGS+= \\" >> ${MAKEFILE} 409148279Sjkimecho " -DDRV_DATA_START=${SYSBASE}_drv_data_start \\" >> ${MAKEFILE} 410148279Sjkimecho " -DDRV_NAME=${SYSBASE} \\" >> ${MAKEFILE} 411148279Sjkimecho " -DDRV_DATA_END=${SYSBASE}_drv_data_end" >> ${MAKEFILE} 412148279Sjkimecho "CLEANFILES+= \\" >> ${MAKEFILE} 413148279Sjkimecho " ${INFFILE} \\" >> ${MAKEFILE} 414148279Sjkimecho " ${DNAME}.h \\" >> ${MAKEFILE} 415148279Sjkimecho " ${DNAME}.o" >> ${MAKEFILE} 416148279Sjkimecho ".include <bsd.kmod.mk>" >> ${MAKEFILE} 417148279Sjkimif [ -f ${MAKEFILE} ]; then 418148279Sjkim echo "done." 419148279Sjkimelse 420148279Sjkim echo "generating Makefile failed. Exiting." 421145485Swpaul echo "" 422145485Swpaul exit 423145485Swpaulfi 424148279Sjkimecho -n " Building kernel module... " 425148279Sjkimecho "" > bus_if.h 426148279Sjkimecho "" > device_if.h 427148279Sjkimif ! ${MAKE} -f ${MAKEFILE} depend > /dev/null; then 428148279Sjkim echo "build failed. Exiting." 429145485Swpaul echo "" 430145485Swpaul exit 431148279Sjkimfi 432148279Sjkimif ! ${MAKE} -f ${MAKEFILE} all > /dev/null; then 433148279Sjkim echo "build failed. Exiting." 434148279Sjkim echo "" 435148279Sjkim exit 436145485Swpaulelse 437148279Sjkim if [ -f ${SYSBASE}.ko ]; then 438148279Sjkim ${MV} ${SYSBASE}.ko ${SYSBASE}.kmod 439148279Sjkim echo "done." 440148279Sjkim else 441148279Sjkim echo "build failed. Exiting." 442148279Sjkim echo "" 443148279Sjkim exit 444148279Sjkim fi 445145485Swpaulfi 446148279Sjkimecho -n " Cleaning up... " 447148279Sjkimif ! ${MAKE} -f ${MAKEFILE} clean cleandepend > /dev/null; then 448148279Sjkim echo "cleanup failed. Exiting." 449145485Swpaul echo "" 450145485Swpaul exit 451145485Swpaulelse 452145485Swpaul echo "done." 453145485Swpaulfi 454148279Sjkim${RM} ${MAKEFILE} 455148279Sjkim${MV} ${SYSBASE}.kmod ${SYSBASE}.ko 456145485Swpaulecho "" 457148279Sjkimecho " The file ${SYSBASE}.ko has been successfully generated." 458145485Swpaulecho " You can kldload this module to get started." 459145485Swpaulecho "" 460148279Sjkimecho -n " Press return to exit. " 461145485Swpaulread KEYPRESS 462145485Swpaulecho "" 463145485Swpaulecho "" 464148279Sjkimreturn 465145485Swpaul} 466145485Swpaul 467145485Swpaulconvert_driver () { 468145485Swpaul while : ; do 469145485Swpaul infconv 470148279Sjkim if [ ${INFPATH} ]; then 471145485Swpaul break 472145485Swpaul fi 473145485Swpaul done 474145485Swpaul 475145485Swpaul while : ; do 476145485Swpaul sysconv 477148279Sjkim if [ ${SYSPATH} ]; then 478145485Swpaul break 479145485Swpaul fi 480145485Swpaul done 481145485Swpaul 482145485Swpaul ndiscvt 483145485Swpaul firmcvt 484145485Swpaul drvgen 485148279Sjkim return 486145485Swpaul} 487145485Swpaul 488145485SwpaulICONVPATH=/usr/local/bin/iconv 489145485SwpaulNDISCVT=/usr/sbin/ndiscvt 490148279SjkimSTUBPATH=/usr/share/misc 491148279SjkimSTUBFILE=windrv_stub.c 492145485SwpaulDNAME=windrv 493148279SjkimCP=/bin/cp 494148279SjkimMV=/bin/mv 495145485SwpaulRM=/bin/rm 496145485SwpaulTR=/usr/bin/tr 497145485SwpaulFILE=/usr/bin/file 498148279SjkimEGREP=/usr/bin/egrep 499148279SjkimMAKE=/usr/bin/make 500148279SjkimBASENAME=/usr/bin/basename 501148279SjkimTOUCH=/usr/bin/touch 502148279SjkimMKTEMP=/usr/bin/mktemp 503145485Swpaul 504148279SjkimMAKEFILE=`${MKTEMP} /tmp/Makefile.XXXXXX` 505148279SjkimINFFILE=`${MKTEMP} /tmp/ascii_inf.XXXXXX` 506148279Sjkim 507145485SwpaulINFPATH="" 508145485SwpaulFRMLIST="" 509145485SwpaulSYSPATH="" 510145485SwpaulSYSBASE="" 511145485SwpaulFRMBASE="" 512145485Swpaul 513145485Swpaulwhile : ; do 514145485Swpaul mainmenu 515145485Swpaul case ${KEYPRESS} in 516145485Swpaul 1) 517145485Swpaul help1 518145485Swpaul help2 519145485Swpaul help3 520145485Swpaul help4 521145485Swpaul help5 522145485Swpaul ;; 523145485Swpaul 2) 524145485Swpaul firmcvt 525145485Swpaul ;; 526145485Swpaul 3) 527145485Swpaul convert_driver 528145485Swpaul ;; 529145485Swpaul 4) 530145485Swpaul header 531145485Swpaul echo "" 532145485Swpaul echo " Be seeing you!" 533145485Swpaul echo "" 534145485Swpaul exit 535145485Swpaul ;; 536145485Swpaul *) 537145485Swpaul header 538145485Swpaul echo "" 539148281Sceri echo -n " Sorry, I didn't understand that. Press enter to try again: " 540145485Swpaul read KEYPRESS 541145485Swpaul ;; 542145485Swpaul esac 543145485Swpauldone 544148279Sjkimexit 545