ndisgen.sh revision 148350
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 148350 2005-07-23 18:47:18Z dougb $ 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" 190148350Sdougb 191148350Sdougbif [ -z "$INFPATH" ]; then 192148350Sdougb echo "" 193148350Sdougb echo "" 194148350Sdougb echo " A .INF file is most often provided as an ASCII file, however" 195148350Sdougb echo " files with multilanguage support are provided in Unicode format." 196148350Sdougb echo " Please type in the path to your .INF file now." 197148350Sdougb echo "" 198148350Sdougb echo -n " > " 199148350Sdougb read INFPATH 200148350Sdougbfi 201148350Sdougb 202148279Sjkimif [ ${INFPATH} ] && [ -e ${INFPATH} ]; then 203148350Sdougb INFTYPE=`${EGREP} -i -c "Signature|.S.i.g.n.a.t.u.r.e" ${INFPATH}` 204148279Sjkim if [ ${INFTYPE} -le 0 ]; then 205145485Swpaul echo "" 206148279Sjkim echo " I don't recognize this file format. It may not be a valid .INF file." 207145485Swpaul echo "" 208148279Sjkim echo -n " Press enter to try again, or ^C to quit. " 209145485Swpaul read KEYPRESS 210148279Sjkim INFPATH="" 211148279Sjkim return 212148279Sjkim fi 213148279Sjkim 214148350Sdougb INFTYPE=`${EGREP} -i -c "Class.*=.*Net" ${INFPATH}` 215148279Sjkim if [ ${INFTYPE} -gt 0 ]; then 216145485Swpaul echo "" 217145485Swpaul echo " This .INF file appears to be ASCII." 218145485Swpaul echo "" 219148279Sjkim echo -n " Press return to continue... " 220145485Swpaul read KEYPRESS 221148279Sjkim return 222148279Sjkim fi 223148279Sjkim 224148350Sdougb INFTYPE=`${EGREP} -i -c ".C.l.a.s.s.*=.*N.e.t" ${INFPATH}` 225148279Sjkim if [ ${INFTYPE} -gt 0 ]; then 226145485Swpaul echo "" 227145485Swpaul echo " This .INF file appears to be Unicode." 228148279Sjkim if [ -e ${ICONVPATH} ]; then 229145485Swpaul echo " Trying to convert to ASCII..." 230148279Sjkim ${ICONVPATH} -f utf-16 -t utf-8 ${INFPATH} > ${INFFILE} 231148279Sjkim INFPATH=${INFFILE} 232145485Swpaul echo " Done." 233145485Swpaul echo "" 234148279Sjkim echo -n " Press return to continue... " 235145485Swpaul read KEYPRESS 236145485Swpaul else 237145485Swpaul echo " The iconv(1) utility does not appear to be installed." 238145485Swpaul echo " Please install this utility or convert the .INF file" 239145485Swpaul echo " to ASCII and run this utility again." 240145485Swpaul echo "" 241145485Swpaul exit 242145485Swpaul fi 243148279Sjkim return 244148279Sjkim fi 245148279Sjkim 246148279Sjkim echo "" 247148279Sjkim echo " I don't recognize this file format. It may not be a valid .INF file." 248148279Sjkim echo "" 249148279Sjkim echo -n " Press enter to try again, or ^C to quit. " 250148279Sjkim read KEYPRESS 251148279Sjkim INFPATH="" 252145485Swpaulelse 253145485Swpaul echo "" 254148279Sjkim echo " The file '${INFPATH}' was not found." 255145485Swpaul echo "" 256145485Swpaul echo -n " Press enter to try again, or ^C to quit. " 257145485Swpaul read KEYPRESS 258145485Swpaul INFPATH="" 259145485Swpaulfi 260148279Sjkimreturn 261145485Swpaul} 262145485Swpaul 263145485Swpaulsysconv() { 264145485Swpaulheader 265145485Swpaulecho " Driver file validation" 266148350Sdougb 267148350Sdougbif [ ! -r "$SYSPATH" ]; then 268148350Sdougb echo "" 269148350Sdougb echo "" 270148350Sdougb echo " Now you need to specify the name of the Windows(r) driver .SYS" 271148350Sdougb echo " file for your device. Note that if you are running FreeBSD/amd64," 272148350Sdougb echo " then you must provide a driver that has been compiled for the" 273148350Sdougb echo " 64-bit Windows(r) platform. If a 64-bit driver is not available" 274148350Sdougb echo " for your device, you must install FreeBSD/i386 and use the" 275148350Sdougb echo " 32-bit driver instead." 276148350Sdougb echo "" 277148350Sdougb echo " Please type in the path to the Windows(r) driver .SYS file now." 278148350Sdougb echo "" 279148350Sdougb echo -n " > " 280148350Sdougb read SYSPATH 281148350Sdougbfi 282148350Sdougb 283148279Sjkimif [ ${SYSPATH} ] && [ -e ${SYSPATH} ]; then 284145485Swpaul SYSTYPE=`${FILE} ${SYSPATH}` 285145485Swpaul 286145485Swpaul case ${SYSTYPE} in 287145485Swpaul *Windows*) 288145485Swpaul echo "" 289145485Swpaul echo " This .SYS file appears to be in Windows(r) PE format." 290145485Swpaul echo "" 291148279Sjkim echo -n " Press return to continue... " 292145485Swpaul read KEYPRESS 293148279Sjkim SYSBASE=`${BASENAME} ${SYSPATH} | ${TR} '.' '_'` 294145485Swpaul ;; 295145485Swpaul *) 296145485Swpaul echo "" 297145485Swpaul echo " I don't recognize this file format. It may not be a valid .SYS file." 298145485Swpaul echo "" 299145485Swpaul 300145485Swpaul echo -n " Press enter to try again, or ^C to quit. " 301145485Swpaul read KEYPRESS 302145485Swpaul SYSPATH="" 303145485Swpaul ;; 304145485Swpaul esac 305145485Swpaulelse 306145485Swpaul echo "" 307148279Sjkim echo " The file '${SYSPATH}' was not found." 308145485Swpaul echo "" 309145485Swpaul echo -n " Press enter to try again, or ^C to quit. " 310145485Swpaul read KEYPRESS 311145485Swpaul SYSPATH="" 312145485Swpaulfi 313148279Sjkimreturn 314145485Swpaul} 315145485Swpaul 316145485Swpaulndiscvt() { 317145485Swpaulheader 318145485Swpaulecho " Driver file conversion" 319145485Swpaulecho "" 320145485Swpaulecho " The script will now try to convert the .INF and .SYS files" 321145485Swpaulecho " using the ndiscvt(1) utility. This utility can handle most" 322148281Sceriecho " .INF files; however, occasionally it can fail to parse some files" 323145485Swpaulecho " due to subtle syntax issues: the .INF syntax is very complex," 324145485Swpaulecho " and the Windows(r) parser will sometimes allow files with small" 325145485Swpaulecho " syntax errors to be processed correctly which ndiscvt(1) will" 326145485Swpaulecho " not. If the conversion fails, you may have to edit the .INF" 327145485Swpaulecho " file by hand to remove the offending lines." 328145485Swpaulecho "" 329145485Swpaulecho -n " Press enter to try converting the files now: " 330145485Swpaulread KEYPRESS 331145485Swpaulif ! ${NDISCVT} -i ${INFPATH} -s ${SYSPATH} -O -o ${DNAME}.h > /dev/null; then 332145485Swpaul echo "CONVERSION FAILED" 333145485Swpaul exit 334145485Swpaulelse 335145485Swpaul echo "" 336145485Swpaul echo " Conversion was successful." 337145485Swpaul echo "" 338145485Swpaul echo -n " Press enter to continue... " 339145485Swpaul read KEYPRESS 340145485Swpaulfi 341148279Sjkimreturn 342145485Swpaul} 343145485Swpaul 344145485Swpaulfirmcvt() { 345145485Swpaul while : ; do 346145485Swpaulheader 347145485Swpaulecho " Firmware file conversion" 348145485Swpaulecho "" 349145485Swpaulecho " If your driver uses additional firmware files, please list them" 350148281Sceriecho " below. When you're finished, just press enter to continue. (If your" 351145485Swpaulecho " driver doesn't need any extra firmware files, just press enter" 352145485Swpaulecho " to move to the next step.)" 353145485Swpaulecho "" 354145485Swpaul echo -n " > " 355145485Swpaul read FIRMPATH 356145485Swpaul 357148279Sjkim if [ ${FIRMPATH} ]; then 358148279Sjkim if [ ! -e ${FIRMPATH} ]; then 359145485Swpaul echo "" 360148279Sjkim echo " The file '${FIRMPATH}' was not found" 361145485Swpaul echo "" 362145485Swpaul echo -n " Press enter to try again, or ^C to quit. " 363145485Swpaul read KEYPRESS 364145485Swpaul continue 365145485Swpaul fi 366145485Swpaul if ! ${NDISCVT} -f ${FIRMPATH} > /dev/null; then 367145485Swpaul echo "" 368145485Swpaul echo "CONVERSION FAILED" 369145485Swpaul else 370145485Swpaul echo "" 371145485Swpaul echo " Conversion was successful." 372145485Swpaul echo "" 373148279Sjkim FRMBASE=`${BASENAME} ${FIRMPATH}` 374145485Swpaul FRMBASE="${FRMBASE}.o" 375145485Swpaul FRMLIST="${FRMLIST} ${FRMBASE}" 376145485Swpaul fi 377145485Swpaul echo -n " Press enter to continue... " 378145485Swpaul read KEYPRESS 379145485Swpaul else 380145485Swpaul break 381145485Swpaul fi 382145485Swpaul done 383145485Swpaul 384145485Swpaulheader 385145485Swpaulecho "" 386145485Swpaulecho " List of files converted firmware files:" 387145485Swpaulecho "" 388148279Sjkimfor i in ${FRMLIST} 389145485Swpauldo 390145485Swpaul echo " "$i 391145485Swpauldone 392145485Swpaulecho "" 393145485Swpaulecho -n " Press enter to continue... " 394145485Swpaulread KEYPRESS 395148279Sjkimreturn 396145485Swpaul} 397145485Swpaul 398145485Swpauldrvgen () { 399145485Swpaulheader 400145485Swpaulecho " Kernel module generation" 401145485Swpaulecho "" 402145485Swpaulecho "" 403145485Swpaulecho " The script will now try to generate the kernel driver module." 404145485Swpaulecho " This is the last step. Once this module is generated, you should" 405145485Swpaulecho " be able to load it just like any other FreeBSD driver module." 406145485Swpaulecho "" 407145485Swpaulecho " Press enter to compile the stub module and generate the driver" 408145485Swpaulecho -n " module now: " 409145485Swpaulread KEYPRESS 410145485Swpaulecho "" 411148279Sjkimecho -n " Generating Makefile... " 412148279Sjkimecho ".PATH: ${PWD} ${STUBPATH}" > ${MAKEFILE} 413148279Sjkimecho "KMOD= ${SYSBASE}" >> ${MAKEFILE} 414148279Sjkimecho "SRCS+= ${STUBFILE} ${DNAME}.h bus_if.h device_if.h" >> ${MAKEFILE} 415148279Sjkimecho "OBJS+=${FRMLIST} ${DNAME}.o" >> ${MAKEFILE} 416148279Sjkimecho "CFLAGS+= \\" >> ${MAKEFILE} 417148279Sjkimecho " -DDRV_DATA_START=${SYSBASE}_drv_data_start \\" >> ${MAKEFILE} 418148279Sjkimecho " -DDRV_NAME=${SYSBASE} \\" >> ${MAKEFILE} 419148279Sjkimecho " -DDRV_DATA_END=${SYSBASE}_drv_data_end" >> ${MAKEFILE} 420148279Sjkimecho "CLEANFILES+= \\" >> ${MAKEFILE} 421148279Sjkimecho " ${INFFILE} \\" >> ${MAKEFILE} 422148279Sjkimecho " ${DNAME}.h \\" >> ${MAKEFILE} 423148279Sjkimecho " ${DNAME}.o" >> ${MAKEFILE} 424148279Sjkimecho ".include <bsd.kmod.mk>" >> ${MAKEFILE} 425148279Sjkimif [ -f ${MAKEFILE} ]; then 426148279Sjkim echo "done." 427148279Sjkimelse 428148279Sjkim echo "generating Makefile failed. Exiting." 429145485Swpaul echo "" 430145485Swpaul exit 431145485Swpaulfi 432148279Sjkimecho -n " Building kernel module... " 433148279Sjkimecho "" > bus_if.h 434148279Sjkimecho "" > device_if.h 435148279Sjkimif ! ${MAKE} -f ${MAKEFILE} depend > /dev/null; then 436148279Sjkim echo "build failed. Exiting." 437145485Swpaul echo "" 438145485Swpaul exit 439148279Sjkimfi 440148279Sjkimif ! ${MAKE} -f ${MAKEFILE} all > /dev/null; then 441148279Sjkim echo "build failed. Exiting." 442148279Sjkim echo "" 443148279Sjkim exit 444145485Swpaulelse 445148279Sjkim if [ -f ${SYSBASE}.ko ]; then 446148279Sjkim ${MV} ${SYSBASE}.ko ${SYSBASE}.kmod 447148279Sjkim echo "done." 448148279Sjkim else 449148279Sjkim echo "build failed. Exiting." 450148279Sjkim echo "" 451148279Sjkim exit 452148279Sjkim fi 453145485Swpaulfi 454148279Sjkimecho -n " Cleaning up... " 455148279Sjkimif ! ${MAKE} -f ${MAKEFILE} clean cleandepend > /dev/null; then 456148279Sjkim echo "cleanup failed. Exiting." 457145485Swpaul echo "" 458145485Swpaul exit 459145485Swpaulelse 460145485Swpaul echo "done." 461145485Swpaulfi 462148279Sjkim${RM} ${MAKEFILE} 463148279Sjkim${MV} ${SYSBASE}.kmod ${SYSBASE}.ko 464145485Swpaulecho "" 465148279Sjkimecho " The file ${SYSBASE}.ko has been successfully generated." 466145485Swpaulecho " You can kldload this module to get started." 467145485Swpaulecho "" 468148279Sjkimecho -n " Press return to exit. " 469145485Swpaulread KEYPRESS 470145485Swpaulecho "" 471145485Swpaulecho "" 472148279Sjkimreturn 473145485Swpaul} 474145485Swpaul 475145485Swpaulconvert_driver () { 476145485Swpaul while : ; do 477145485Swpaul infconv 478148279Sjkim if [ ${INFPATH} ]; then 479145485Swpaul break 480145485Swpaul fi 481145485Swpaul done 482145485Swpaul 483145485Swpaul while : ; do 484145485Swpaul sysconv 485148279Sjkim if [ ${SYSPATH} ]; then 486145485Swpaul break 487145485Swpaul fi 488145485Swpaul done 489145485Swpaul 490145485Swpaul ndiscvt 491145485Swpaul firmcvt 492145485Swpaul drvgen 493148279Sjkim return 494145485Swpaul} 495145485Swpaul 496145485SwpaulICONVPATH=/usr/local/bin/iconv 497145485SwpaulNDISCVT=/usr/sbin/ndiscvt 498148279SjkimSTUBPATH=/usr/share/misc 499148279SjkimSTUBFILE=windrv_stub.c 500145485SwpaulDNAME=windrv 501148279SjkimCP=/bin/cp 502148279SjkimMV=/bin/mv 503145485SwpaulRM=/bin/rm 504145485SwpaulTR=/usr/bin/tr 505145485SwpaulFILE=/usr/bin/file 506148279SjkimEGREP=/usr/bin/egrep 507148279SjkimMAKE=/usr/bin/make 508148279SjkimBASENAME=/usr/bin/basename 509148279SjkimTOUCH=/usr/bin/touch 510148279SjkimMKTEMP=/usr/bin/mktemp 511145485Swpaul 512148279SjkimMAKEFILE=`${MKTEMP} /tmp/Makefile.XXXXXX` 513148279SjkimINFFILE=`${MKTEMP} /tmp/ascii_inf.XXXXXX` 514148279Sjkim 515145485SwpaulINFPATH="" 516145485SwpaulFRMLIST="" 517145485SwpaulSYSPATH="" 518145485SwpaulSYSBASE="" 519145485SwpaulFRMBASE="" 520145485Swpaul 521148350Sdougbif [ -r "$1" -a -r "$2" ]; then 522148350Sdougb # Looks like the user supplied .INF and .SYS files on the command line 523148350Sdougb INFPATH=$1 524148350Sdougb SYSPATH=$2 525148350Sdougb convert_driver && exit 0 526148350Sdougbfi 527148350Sdougb 528145485Swpaulwhile : ; do 529145485Swpaul mainmenu 530145485Swpaul case ${KEYPRESS} in 531145485Swpaul 1) 532145485Swpaul help1 533145485Swpaul help2 534145485Swpaul help3 535145485Swpaul help4 536145485Swpaul help5 537145485Swpaul ;; 538145485Swpaul 2) 539145485Swpaul firmcvt 540145485Swpaul ;; 541145485Swpaul 3) 542145485Swpaul convert_driver 543145485Swpaul ;; 544145485Swpaul 4) 545145485Swpaul header 546145485Swpaul echo "" 547145485Swpaul echo " Be seeing you!" 548145485Swpaul echo "" 549145485Swpaul exit 550145485Swpaul ;; 551145485Swpaul *) 552145485Swpaul header 553145485Swpaul echo "" 554148281Sceri echo -n " Sorry, I didn't understand that. Press enter to try again: " 555145485Swpaul read KEYPRESS 556145485Swpaul ;; 557145485Swpaul esac 558145485Swpauldone 559148279Sjkimexit 560