(CommandList children: [ (FuncDef name: header body: (BraceGroup children: [ (C {(clear)}) (C {(echo)} {(DQ ('\t=================================================================='))}) (C {(echo)} {(DQ ('\t------------------ Windows(r) driver converter -------------------'))}) (C {(echo)} {(DQ ('\t=================================================================='))}) (C {(echo)} {(DQ )}) ] spids: [108] ) spids: [103 107] ) (FuncDef name: mainmenu body: (BraceGroup children: [ (C {(header)}) (C {(echo)} {(DQ ('\tThis script is designed to guide you through the process'))}) (C {(echo)} {(DQ ('\tof converting a Windows(r) binary driver module and .INF'))}) (C {(echo)} {(DQ ('\tspecification file into a FreeBSD ELF kernel module for use'))}) (C {(echo)} {(DQ ('\twith the NDIS compatibility system.'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tThe following options are available:'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\t1] Learn about the NDIS compatibility system'))}) (C {(echo)} {(DQ ('\t2] Convert individual firmware files'))}) (C {(echo)} {(DQ ('\t3] Convert driver'))}) (C {(echo)} {(DQ ('\t4] Exit'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ('\tEnter your selection here and press return: '))}) (C {(read)} {(KEYPRESS)}) (ControlFlow token:<ControlFlow_Return return>) ] spids: [142] ) spids: [138 141] ) (FuncDef name: help1 body: (BraceGroup children: [ (C {(header)}) (C {(echo)} {(DQ ('\t\t\t\tGeneral information'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tThe NDIS compatibility system is designed to let you use Windows(r)'))}) (C {(echo)} {(DQ ('\tbinary drivers for networking devices with FreeBSD, in cases where'))}) (C {(echo)} {(DQ ('\ta native FreeBSD driver is not available due to hardware manufacturer'))} ) (C {(echo)} {(DQ ('\toversight or stupidity. NDIS stands for Network Driver Interface'))}) (C {(echo)} {(DQ ('\tStandard, and refers to the programming model used to write Windows(r)'))} ) (C {(echo)} { (DQ ('\tnetwork drivers. (These are often called ') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ('NDIS miniport') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (' drivers.)') ) } ) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tIn order to use your network device in NDIS compatibility mode,'))}) (C {(echo)} {(DQ ('\tyou need the Windows(r) driver that goes with it. Also, the driver'))}) (C {(echo)} {(DQ ('\tmust be compiled for the same architecture as the release of FreeBSD'))} ) (C {(echo)} {(DQ ('\tyou have installed. At this time, the i386 and amd64 architectures'))}) (C {(echo)} {(DQ ('\tare both supported. Note that you cannot use a Windows/i386 driver'))}) (C {(echo)} {(DQ ('\twith FreeBSD/amd64: you must obtain a Windows/amd64 driver.'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ('\tPress return to continue... '))}) (C {(read)} {(KEYPRESS)}) (ControlFlow token:<ControlFlow_Return return>) ] spids: [238] ) spids: [233 237] ) (FuncDef name: help2 body: (BraceGroup children: [ (C {(header)}) (C {(echo)} {(DQ ('\t\t\t\tWhere to get drivers'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tIf you purchased your network card separately from your computer,'))}) (C {(echo)} {(DQ ('\tthere should have been a driver distribution CD included with the'))}) (C {(echo)} {(DQ ('\tcard which contains Windows(r) drivers. The NDIS compatibility'))}) (C {(echo)} {(DQ ('\tsystem is designed to emulate the NDIS API of a couple of different'))}) (C {(echo)} {(DQ ('\tWindows(r) releases, however it works best with drivers designed'))}) (C {(echo)} {(DQ ('\tfor NDIS 5.0 or later. Drivers distributed for Windows 2000 should'))}) (C {(echo)} {(DQ ('\twork; however, for best results you should use a driver designed'))}) (C {(echo)} {(DQ ('\tfor Windows XP or Windows Server 2003.'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tIf your card was supplied with your computer, or is a built-in device,'))} ) (C {(echo)} {(DQ ('\tdrivers may have been included on a special driver bundle CD shipped'))} ) (C {(echo)} {(DQ ('\twith the computer.'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ("\tIf you don't have a driver CD, you should be able to find a driver"))}) (C {(echo)} {(DQ ("\tkit on the card or computer vendor's web site."))}) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ('\tPress return to continue... '))}) (C {(read)} {(KEYPRESS)}) (ControlFlow token:<ControlFlow_Return return>) ] spids: [360] ) spids: [356 359] ) (FuncDef name: help3 body: (BraceGroup children: [ (C {(header)}) (C {(echo)} {(DQ ('\t\t\t\tWhat files do I need?'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tIn most cases, you will need only two files: a .INF file and a .SYS'))}) (C {(echo)} {(DQ ('\tfile. The .INF file is a text file used by the Windows(r) installer to'))} ) (C {(echo)} {(DQ ('\tperform the driver installation. It contains information that tells'))}) (C {(echo)} {(DQ ('\tthe installer what devices the driver supports and what registry keys'))} ) (C {(echo)} {(DQ ('\tshould be created to control driver configuration. The .SYS file'))}) (C {(echo)} {(DQ ('\tis the actual driver executable code in Windows(r) Portable Executable'))} ) (C {(echo)} {(DQ ('\t(PE) format. Note that sometimes the .INF file is supplied in Unicode'))} ) (C {(echo)} {(DQ ('\tformat. Unicode .INF files must be converted to ASCII form with the'))}) (C {(echo)} {(DQ ('\ticonv(1) utility before this installer script can use them.'))}) (C {(echo)} {(DQ ('\tOccasionally, a driver may require firmware or register setup'))}) (C {(echo)} {(DQ ('\tfiles that are external to the main .SYS file. These are provided'))}) (C {(echo)} {(DQ ('\ton the same CD with the driver itself, and sometimes have a .BIN'))}) (C {(echo)} {(DQ ('\textension, though they can be named almost anything. You will need'))}) (C {(echo)} {(DQ ('\tthese additional files to make your device work with the NDIS'))}) (C {(echo)} {(DQ ('\tcompatibility system as well.'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ('\tPress return to continue... '))}) (C {(read)} {(KEYPRESS)}) (ControlFlow token:<ControlFlow_Return return>) ] spids: [490] ) spids: [485 489] ) (FuncDef name: help4 body: (BraceGroup children: [ (C {(header)}) (C {(echo)} {(DQ ('\t\t\t\tHow does it all work?'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tThe installer script uses the ndiscvt(1) utility to convert the .INF,'))} ) (C {(echo)} {(DQ ('\t.SYS and optional firmware files into a FreeBSD kernel loadable module'))} ) (C {(echo)} {(DQ ('\t(.ko) file. This module can be loaded via the kldload(8) utility or'))}) (C {(echo)} {(DQ ('\tloaded automatically via the /boot/loader.conf file. The ndiscvt(1)'))}) (C {(echo)} {(DQ ('\tutility extracts the device ID information and registry key data'))}) (C {(echo)} {(DQ ('\tfrom the .INF file and converts it into a C header file. It also uses'))} ) (C {(echo)} {(DQ ('\tthe objcopy(1) utility to convert the .SYS file and optional firmware'))} ) (C {(echo)} {(DQ ('\tfiles into ELF objects. The header file is compiled into a small C'))}) (C {(echo)} {(DQ ('\tstub file which contains a small amount of code to interface with'))}) (C {(echo)} {(DQ ('\tthe FreeBSD module system. This stub is linked together with the'))}) (C {(echo)} {(DQ ('\tconverted ELF objects to form a FreeBSD kernel module. A static ELF'))}) (C {(echo)} {(DQ ('\tobject (.o) file is also created. This file can be linked into a'))}) (C {(echo)} {(DQ ('\tstatic kernel image for those who want/need a fully linked kernel'))}) (C {(echo)} {(DQ ('\timage (possibly for embedded bootstrap purposes, or just plain old'))}) (C {(echo)} {(DQ ('\texperimentation).'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ('\tPress return to continue... '))}) (C {(read)} {(KEYPRESS)}) (ControlFlow token:<ControlFlow_Return return>) ] spids: [622] ) spids: [617 621] ) (FuncDef name: help5 body: (BraceGroup children: [ (C {(header)}) (C {(echo)} {(DQ ('\t\t\t\tPrerequisites'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tConverting a driver requires the following utilities:'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\t- The FreeBSD C compiler, cc(1) (part of the base install).'))}) (C {(echo)} {(DQ ('\t- The FreeBSD linker, ld(1) (part of the base install).'))}) (C {(echo)} {(DQ ('\t- The objcopy(1) utility (part of the base install).'))}) (C {(echo)} {(DQ ('\t- The ndiscvt(1) utility (part of the base install).'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ("\tIf you happen to end up with a .INF file that's in Unicode format,"))}) (C {(echo)} {(DQ ("\tthen you'll also need:"))}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\t- The iconv(1) utility.'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tIf you have installed the X Window system or some sort of desktop'))}) (C {(echo)} {(DQ ('\tenvironment, then iconv(1) should already be present. If not, you'))}) (C {(echo)} {(DQ ('\twill need to install the libiconv package or port.'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ('\tPress return to continue... '))}) (C {(read)} {(KEYPRESS)}) (ControlFlow token:<ControlFlow_Return return>) ] spids: [754] ) spids: [749 753] ) (FuncDef name: infconv body: (BraceGroup children: [ (C {(header)}) (C {(echo)} {(DQ ('\t\t\tINF file validation'))}) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(-z)} {(DQ ($ VSub_Name '$INFPATH'))} {(Lit_Other ']')}) terminator: <Op_Semi ';'> ) ] action: [ (C {(echo)} {(DQ )}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tA .INF file is most often provided as an ASCII file, however'))} ) (C {(echo)} {(DQ ('\tfiles with multilanguage support are provided in Unicode format.'))} ) (C {(echo)} {(DQ ('\tPlease type in the path to your .INF file now.'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ('\t> '))}) (C {(read)} {(INFPATH)}) ] spids: [-1 906] ) ] spids: [-1 961] ) (If arms: [ (if_arm cond: [ (Sentence child: (AndOr children: [ (C {(Lit_Other '[')} {(${ VSub_Name INFPATH)} {(Lit_Other ']')}) (C {(Lit_Other '[')} {(-e)} {(${ VSub_Name INFPATH)} {(Lit_Other ']')}) ] op_id: Op_DAmp ) terminator: <Op_Semi ';'> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:INFTYPE) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(${ VSub_Name EGREP)} {(-i)} {(-c)} {(DQ ('Signature|.S.i.g.n.a.t.u.r.e'))} {(${ VSub_Name INFPATH)} ) ] ) left_token: <Left_Backtick '`'> spids: [992 1008] ) } spids: [991] ) ] spids: [991] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(${ VSub_Name INFTYPE)} {(-le)} {(0)} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (C {(echo)} {(DQ )}) (C {(echo)} { (DQ ( "\tI don't recognize this file format. It may not be a valid .INF file." ) ) } ) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ('\tPress enter to try again, or ^C to quit. '))}) (C {(read)} {(KEYPRESS)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:INFPATH) op: Equal rhs: {(DQ )} spids: [1062] ) ] spids: [1062] ) (ControlFlow token: <ControlFlow_Return return> ) ] spids: [-1 1026] ) ] spids: [-1 1070] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:INFTYPE) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(${ VSub_Name EGREP)} {(-i)} {(-c)} {(DQ ('Class.*=.*Net'))} {(${ VSub_Name INFPATH)} ) ] ) left_token: <Left_Backtick '`'> spids: [1075 1091] ) } spids: [1074] ) ] spids: [1074] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(${ VSub_Name INFTYPE)} {(-gt)} {(0)} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tThis .INF file appears to be ASCII.'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ('\tPress return to continue... '))}) (C {(read)} {(KEYPRESS)}) (ControlFlow token: <ControlFlow_Return return> ) ] spids: [-1 1109] ) ] spids: [-1 1148] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:INFTYPE) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(${ VSub_Name EGREP)} {(-i)} {(-c)} {(DQ ('.C.l.a.s.s.*=.*N.e.t'))} {(${ VSub_Name INFPATH)} ) ] ) left_token: <Left_Backtick '`'> spids: [1153 1169] ) } spids: [1152] ) ] spids: [1152] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(${ VSub_Name INFTYPE)} {(-gt)} {(0)} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tThis .INF file appears to be Unicode.'))}) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(-e)} {(${ VSub_Name ICONVPATH)} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (C {(echo)} {(DQ ('\tTrying to convert to ASCII...'))}) (SimpleCommand words: [ {(${ VSub_Name ICONVPATH)} {(-f)} {(utf-16)} {(-t)} {(utf-8)} {(${ VSub_Name INFPATH)} ] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(${ VSub_Name INFFILE)} spids: [1242] ) ] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:INFPATH) op: Equal rhs: {(${ VSub_Name INFFILE)} spids: [1249] ) ] spids: [1249] ) (C {(echo)} {(DQ ('\tDone.'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ('\tPress return to continue... '))}) (C {(read)} {(KEYPRESS)}) ] spids: [-1 1216] ) ] else_action: [ (C {(echo)} {(DQ ('\tThe iconv(1) utility does not appear to be installed.'))} ) (C {(echo)} {(DQ ('\tPlease install this utility or convert the .INF file'))} ) (C {(echo)} {(DQ ('\tto ASCII and run this utility again.'))}) (C {(echo)} {(DQ )}) (C {(exit)}) ] spids: [1282 1315] ) (ControlFlow token: <ControlFlow_Return return> ) ] spids: [-1 1187] ) ] spids: [-1 1321] ) (C {(echo)} {(DQ )}) (C {(echo)} { (DQ ( "\tI don't recognize this file format. It may not be a valid .INF file." ) ) } ) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ('\tPress enter to try again, or ^C to quit. '))}) (C {(read)} {(KEYPRESS)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:INFPATH) op: Equal rhs: {(DQ )} spids: [1358] ) ] spids: [1358] ) ] spids: [-1 987] ) ] else_action: [ (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ("\tThe file '") (${ VSub_Name INFPATH) ("' was not found."))}) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ('\tPress enter to try again, or ^C to quit. '))}) (C {(read)} {(KEYPRESS)}) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:INFPATH) op:Equal rhs:{(DQ )} spids:[1402])] spids: [1402] ) ] spids: [1362 1406] ) (ControlFlow token:<ControlFlow_Return return>) ] spids: [882] ) spids: [877 881] ) (FuncDef name: sysconv body: (BraceGroup children: [ (C {(header)}) (C {(echo)} {(DQ ('\t\t\tDriver file validation'))}) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(KW_Bang '!')} {(-r)} {(DQ ($ VSub_Name '$SYSPATH'))} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (C {(echo)} {(DQ )}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tNow you need to specify the name of the Windows(r) driver .SYS'))} ) (C {(echo)} {(DQ ('\tfile for your device. Note that if you are running FreeBSD/amd64,'))} ) (C {(echo)} {(DQ ('\tthen you must provide a driver that has been compiled for the'))} ) (C {(echo)} {(DQ ('\t64-bit Windows(r) platform. If a 64-bit driver is not available'))} ) (C {(echo)} {(DQ ('\tfor your device, you must install FreeBSD/i386 and use the'))}) (C {(echo)} {(DQ ('\t32-bit driver instead.'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tPlease type in the path to the Windows(r) driver .SYS file now.'))} ) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ('\t> '))}) (C {(read)} {(SYSPATH)}) ] spids: [-1 1443] ) ] spids: [-1 1532] ) (If arms: [ (if_arm cond: [ (Sentence child: (AndOr children: [ (C {(Lit_Other '[')} {(${ VSub_Name SYSPATH)} {(Lit_Other ']')}) (C {(Lit_Other '[')} {(-e)} {(${ VSub_Name SYSPATH)} {(Lit_Other ']')}) ] op_id: Op_DAmp ) terminator: <Op_Semi ';'> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:SYSTYPE) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(${ VSub_Name FILE)} {(${ VSub_Name SYSPATH)})] ) left_token: <Left_Backtick '`'> spids: [1562 1570] ) } spids: [1561] ) ] spids: [1561] ) (Case to_match: {(${ VSub_Name SYSTYPE)} arms: [ (case_arm pat_list: [{(Lit_Other '*') (Windows) (Lit_Other '*')}] action: [ (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tThis .SYS file appears to be in Windows(r) PE format.'))} ) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ('\tPress return to continue... '))}) (C {(read)} {(KEYPRESS)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:SYSBASE) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(${ VSub_Name BASENAME)} {(${ VSub_Name SYSPATH)}) (C {(${ VSub_Name TR)} {(SQ <.>)} {(SQ <_>)}) ] negated: False ) ] ) left_token: <Left_Backtick '`'> spids: [1623 1645] ) } spids: [1622] ) ] spids: [1622] ) ] spids: [1583 1586 1648 -1] ) (case_arm pat_list: [{(Lit_Other '*')}] action: [ (C {(echo)} {(DQ )}) (C {(echo)} { (DQ ( "\tI don't recognize this file format. It may not be a valid .SYS file." ) ) } ) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ('\tPress enter to try again, or ^C to quit. '))}) (C {(read)} {(KEYPRESS)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:SYSPATH) op: Equal rhs: {(DQ )} spids: [1689] ) ] spids: [1689] ) ] spids: [1651 1652 1694 -1] ) ] spids: [1574 1580 1697] ) ] spids: [-1 1558] ) ] else_action: [ (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ("\tThe file '") (${ VSub_Name SYSPATH) ("' was not found."))}) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ('\tPress enter to try again, or ^C to quit. '))}) (C {(read)} {(KEYPRESS)}) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:SYSPATH) op:Equal rhs:{(DQ )} spids:[1739])] spids: [1739] ) ] spids: [1699 1743] ) (ControlFlow token:<ControlFlow_Return return>) ] spids: [1417] ) spids: [1413 1416] ) (FuncDef name: ndiscvt body: (BraceGroup children: [ (C {(header)}) (C {(echo)} {(DQ ('\t\t\tDriver file conversion'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tThe script will now try to convert the .INF and .SYS files'))}) (C {(echo)} {(DQ ('\tusing the ndiscvt(1) utility. This utility can handle most'))}) (C {(echo)} {(DQ ('\t.INF files; however, occasionally it can fail to parse some files'))}) (C {(echo)} {(DQ ('\tdue to subtle syntax issues: the .INF syntax is very complex,'))}) (C {(echo)} {(DQ ('\tand the Windows(r) parser will sometimes allow files with small'))}) (C {(echo)} {(DQ ('\tsyntax errors to be processed correctly which ndiscvt(1) will'))}) (C {(echo)} {(DQ ('\tnot. If the conversion fails, you may have to edit the .INF'))}) (C {(echo)} {(DQ ('\tfile by hand to remove the offending lines.'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ('\tPress enter to try converting the files now: '))}) (C {(read)} {(KEYPRESS)}) (If arms: [ (if_arm cond: [ (Sentence child: (Pipeline children: [ (SimpleCommand words: [ {(${ VSub_Name NDISCVT)} {(-i)} {(${ VSub_Name INFPATH)} {(-s)} {(${ VSub_Name SYSPATH)} {(-O)} {(-o)} {(${ VSub_Name DNAME) (.h)} ] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(/dev/null)} spids: [1864] ) ] ) ] negated: True ) terminator: <Op_Semi ';'> ) ] action: [(C {(echo)} {(DQ ('CONVERSION FAILED'))}) (C {(exit)})] spids: [-1 1869] ) ] else_action: [ (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tConversion was successful.'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ('\tPress enter to continue... '))}) (C {(read)} {(KEYPRESS)}) ] spids: [1881 1916] ) (ControlFlow token:<ControlFlow_Return return>) ] spids: [1755] ) spids: [1751 1754] ) (FuncDef name: firmcvt body: (BraceGroup children: [ (While cond: [(Sentence child:(C {(Lit_Other ':')}) terminator:<Op_Semi ';'>)] body: (DoGroup children: [ (C {(header)}) (C {(echo)} {(DQ ('\t\t\tFirmware file conversion'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tIf your driver uses additional firmware files, please list them'))} ) (C {(echo)} { (DQ ("\tbelow. When you're finished, just press enter to continue. (If your")) } ) (C {(echo)} {(DQ ("\tdriver doesn't need any extra firmware files, just press enter"))} ) (C {(echo)} {(DQ ('\tto move to the next step.)'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ('\t> '))}) (C {(read)} {(FIRMPATH)}) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(${ VSub_Name FIRMPATH)} {(Lit_Other ']')}) terminator: <Op_Semi ';'> ) ] action: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(KW_Bang '!')} {(-e)} {(${ VSub_Name FIRMPATH)} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (C {(echo)} {(DQ )}) (C {(echo)} { (DQ ("\tThe file '") (${ VSub_Name FIRMPATH) ("' was not found") ) } ) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ('\tPress enter to try again, or ^C to quit. '))} ) (C {(read)} {(KEYPRESS)}) (ControlFlow token: <ControlFlow_Continue continue> ) ] spids: [-1 2025] ) ] spids: [-1 2068] ) (If arms: [ (if_arm cond: [ (Sentence child: (Pipeline children: [ (SimpleCommand words: [ {(${ VSub_Name NDISCVT)} {(-f)} {(${ VSub_Name FIRMPATH)} ] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(/dev/null)} spids: [2085] ) ] ) ] negated: True ) terminator: <Op_Semi ';'> ) ] action: [(C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('CONVERSION FAILED'))})] spids: [-1 2090] ) ] else_action: [ (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tConversion was successful.'))}) (C {(echo)} {(DQ )}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:FRMBASE) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(${ VSub_Name BASENAME)} {(${ VSub_Name FIRMPATH)} ) ] ) left_token: <Left_Backtick '`'> spids: [2129 2137] ) } spids: [2128] ) ] spids: [2128] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:FRMBASE) op: Equal rhs: {(DQ (${ VSub_Name FRMBASE) (.o))} spids: [2140] ) ] spids: [2140] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:FRMLIST) op: Equal rhs: {(DQ (${ VSub_Name FRMLIST) (' ') (${ VSub_Name FRMBASE))} spids: [2149] ) ] spids: [2149] ) ] spids: [2106 2161] ) (C {(echo)} {(-n)} {(DQ ('\tPress enter to continue... '))}) (C {(read)} {(KEYPRESS)}) ] spids: [-1 2007] ) ] else_action: [(ControlFlow token:<ControlFlow_Break break>)] spids: [2178 2184] ) ] spids: [1936 2187] ) ) (C {(header)}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tList of files converted firmware files:'))}) (C {(echo)} {(DQ )}) (ForEach iter_name: i iter_words: [{(${ VSub_Name FRMLIST)}] do_arg_iter: False body: (DoGroup children: [(C {(echo)} {(DQ ('\t')) ($ VSub_Name '$i')})] spids: [2218 2228] ) spids: [2213 -1] ) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ('\tPress enter to continue... '))}) (C {(read)} {(KEYPRESS)}) (ControlFlow token:<ControlFlow_Return return>) ] spids: [1927] ) spids: [1923 1926] ) (FuncDef name: drvgen body: (BraceGroup children: [ (C {(header)}) (C {(echo)} {(DQ ('\t\t\tKernel module generation'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tThe script will now try to generate the kernel driver module.'))}) (C {(echo)} {(DQ ('\tThis is the last step. Once this module is generated, you should'))}) (C {(echo)} {(DQ ('\tbe able to load it just like any other FreeBSD driver module.'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tPress enter to compile the stub module and generate the driver'))}) (C {(echo)} {(-n)} {(DQ ('\tmodule now: '))}) (C {(read)} {(KEYPRESS)}) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ('\tGenerating Makefile... '))}) (SimpleCommand words: [{(echo)} {(DQ ('.PATH: ') (${ VSub_Name PWD) (' ') (${ VSub_Name STUBPATH))}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(${ VSub_Name MAKEFILE)} spids: [2344] ) ] ) (SimpleCommand words: [{(echo)} {(DQ ('KMOD= ') (${ VSub_Name SYSBASE))}] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {(${ VSub_Name MAKEFILE)} spids: [2359] ) ] ) (SimpleCommand words: [ {(echo)} { (DQ ('SRCS+= ') (${ VSub_Name STUBFILE) (' ') (${ VSub_Name DNAME) ('.h bus_if.h device_if.h') ) } ] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {(${ VSub_Name MAKEFILE)} spids: [2379] ) ] ) (SimpleCommand words: [{(echo)} {(DQ ('OBJS+=') (${ VSub_Name FRMLIST) (' ') (${ VSub_Name DNAME) (.o))}] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {(${ VSub_Name MAKEFILE)} spids: [2399] ) ] ) (SimpleCommand words: [{(echo)} {(DQ ('CFLAGS+=\t') (EscapedLiteralPart token:<Lit_EscapedChar '\\\\'>))}] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {(${ VSub_Name MAKEFILE)} spids: [2412] ) ] ) (SimpleCommand words: [ {(echo)} { (DQ ('\t-DDRV_DATA_START=ndis_') (${ VSub_Name SYSBASE) ('_drv_data_start ') (EscapedLiteralPart token:<Lit_EscapedChar '\\\\'>) ) } ] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {(${ VSub_Name MAKEFILE)} spids: [2429] ) ] ) (SimpleCommand words: [ {(echo)} { (DQ ('\t-DDRV_NAME=ndis_') (${ VSub_Name SYSBASE) (' ') (EscapedLiteralPart token:<Lit_EscapedChar '\\\\'>) ) } ] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {(${ VSub_Name MAKEFILE)} spids: [2446] ) ] ) (SimpleCommand words: [{(echo)} {(DQ ('\t-DDRV_DATA_END=ndis_') (${ VSub_Name SYSBASE) (_drv_data_end))}] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {(${ VSub_Name MAKEFILE)} spids: [2462] ) ] ) (SimpleCommand words: [ {(echo)} {(DQ ('CLEANFILES+=\t') (EscapedLiteralPart token:<Lit_EscapedChar '\\\\'>))} ] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {(${ VSub_Name MAKEFILE)} spids: [2475] ) ] ) (SimpleCommand words: [ {(echo)} { (DQ ('\t') (${ VSub_Name INFFILE) (' ') (EscapedLiteralPart token:<Lit_EscapedChar '\\\\'>) ) } ] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {(${ VSub_Name MAKEFILE)} spids: [2492] ) ] ) (SimpleCommand words: [ {(echo)} { (DQ ('\t') (${ VSub_Name DNAME) ('.h ') (EscapedLiteralPart token:<Lit_EscapedChar '\\\\'>) ) } ] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {(${ VSub_Name MAKEFILE)} spids: [2509] ) ] ) (SimpleCommand words: [{(echo)} {(DQ ('\t') (${ VSub_Name DNAME) (.o))}] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {(${ VSub_Name MAKEFILE)} spids: [2525] ) ] ) (SimpleCommand words: [{(echo)} {(DQ ('.include <bsd.kmod.mk>'))}] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {(${ VSub_Name MAKEFILE)} spids: [2537] ) ] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(-f)} {(${ VSub_Name MAKEFILE)} {(Lit_Other ']')}) terminator: <Op_Semi ';'> ) ] action: [(C {(echo)} {(DQ (done.))})] spids: [-1 2556] ) ] else_action: [ (C {(echo)} {(DQ ('generating Makefile failed. Exiting.'))}) (C {(echo)} {(DQ )}) (C {(exit)}) ] spids: [2565 2583] ) (C {(echo)} {(-n)} {(DQ ('\tBuilding kernel module... '))}) (SimpleCommand words: [{(echo)} {(DQ )}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(bus_if.h)} spids:[2598])] ) (SimpleCommand words: [{(echo)} {(DQ )}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(device_if.h)} spids:[2607])] ) (If arms: [ (if_arm cond: [ (Sentence child: (Pipeline children: [ (SimpleCommand words: [{(${ VSub_Name MAKE)} {(-f)} {(${ VSub_Name MAKEFILE)} {(all)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(/dev/null)} spids: [2627] ) ] ) ] negated: True ) terminator: <Op_Semi ';'> ) ] action: [ (C {(echo)} {(DQ ('build failed. Exiting.'))}) (C {(echo)} {(DQ )}) (C {(exit)}) ] spids: [-1 2632] ) ] else_action: [ (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(-f)} {(${ VSub_Name SYSBASE) (.ko)} {(Lit_Other ']')}) terminator: <Op_Semi ';'> ) ] action: [ (C {(${ VSub_Name MV)} {(${ VSub_Name SYSBASE) (.ko)} {(${ VSub_Name SYSBASE) (.kmod)} ) (C {(echo)} {(DQ (done.))}) ] spids: [-1 2667] ) ] else_action: [ (C {(echo)} {(DQ ('build failed. Exiting.'))}) (C {(echo)} {(DQ )}) (C {(exit)}) ] spids: [2692 2711] ) ] spids: [2650 2713] ) (C {(echo)} {(-n)} {(DQ ('\tCleaning up... '))}) (If arms: [ (if_arm cond: [ (Sentence child: (Pipeline children: [ (SimpleCommand words: [ {(${ VSub_Name MAKE)} {(-f)} {(${ VSub_Name MAKEFILE)} {(clean)} {(cleandepend)} ] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(/dev/null)} spids: [2741] ) ] ) ] negated: True ) terminator: <Op_Semi ';'> ) ] action: [ (C {(echo)} {(DQ ('cleanup failed. Exiting.'))}) (C {(echo)} {(DQ )}) (C {(exit)}) ] spids: [-1 2746] ) ] else_action: [(C {(echo)} {(DQ (done.))})] spids: [2764 2773] ) (C {(${ VSub_Name RM)} {(${ VSub_Name MAKEFILE)}) (C {(${ VSub_Name MV)} {(${ VSub_Name SYSBASE) (.kmod)} {(${ VSub_Name SYSBASE) (.ko)}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tThe file ') (${ VSub_Name SYSBASE) ('.ko has been successfully generated.'))} ) (C {(echo)} {(DQ ('\tYou can kldload this module to get started.'))}) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ('\tPress return to exit. '))}) (C {(read)} {(KEYPRESS)}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ )}) (ControlFlow token:<ControlFlow_Return return>) ] spids: [2257] ) spids: [2252 2256] ) (FuncDef name: convert_driver body: (BraceGroup children: [ (While cond: [(Sentence child:(C {(Lit_Other ':')}) terminator:<Op_Semi ';'>)] body: (DoGroup children: [ (C {(infconv)}) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(${ VSub_Name INFPATH)} {(Lit_Other ']')}) terminator: <Op_Semi ';'> ) ] action: [(ControlFlow token:<ControlFlow_Break break>)] spids: [-1 2881] ) ] spids: [-1 2887] ) ] spids: [2864 2890] ) ) (While cond: [(Sentence child:(C {(Lit_Other ':')}) terminator:<Op_Semi ';'>)] body: (DoGroup children: [ (C {(sysconv)}) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(${ VSub_Name SYSPATH)} {(Lit_Other ']')}) terminator: <Op_Semi ';'> ) ] action: [(ControlFlow token:<ControlFlow_Break break>)] spids: [-1 2917] ) ] spids: [-1 2923] ) ] spids: [2900 2926] ) ) (C {(ndiscvt)}) (C {(firmcvt)}) (C {(drvgen)}) (ControlFlow token:<ControlFlow_Return return>) ] spids: [2855] ) spids: [2850 2854] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:ICONVPATH) op:Equal rhs:{(/usr/bin/iconv)} spids:[2944])] spids: [2944] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:NDISCVT) op: Equal rhs: {(/usr/sbin/ndiscvt)} spids: [2947] ) ] spids: [2947] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:STUBPATH) op:Equal rhs:{(/usr/share/misc)} spids:[2950])] spids: [2950] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:STUBFILE) op:Equal rhs:{(windrv_stub.c)} spids:[2953])] spids: [2953] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:DNAME) op:Equal rhs:{(windrv)} spids:[2956])] spids: [2956] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:CP) op:Equal rhs:{(/bin/cp)} spids:[2959])] spids: [2959] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:MV) op:Equal rhs:{(/bin/mv)} spids:[2962])] spids: [2962] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:RM) op:Equal rhs:{(/bin/rm)} spids:[2965])] spids: [2965] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:TR) op:Equal rhs:{(/usr/bin/tr)} spids:[2968])] spids: [2968] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:FILE) op:Equal rhs:{(/usr/bin/file)} spids:[2971])] spids: [2971] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:EGREP) op:Equal rhs:{(/usr/bin/egrep)} spids:[2974])] spids: [2974] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:MAKE) op:Equal rhs:{(/usr/bin/make)} spids:[2977])] spids: [2977] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:BASENAME) op: Equal rhs: {(/usr/bin/basename)} spids: [2980] ) ] spids: [2980] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:TOUCH) op:Equal rhs:{(/usr/bin/touch)} spids:[2983])] spids: [2983] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:MKTEMP) op:Equal rhs:{(/usr/bin/mktemp)} spids:[2986])] spids: [2986] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:MAKEFILE) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(${ VSub_Name MKTEMP)} {(/tmp/Makefile.XXXXXX)})] ) left_token: <Left_Backtick '`'> spids: [2991 2997] ) } spids: [2990] ) ] spids: [2990] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:INFFILE) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(${ VSub_Name MKTEMP)} {(/tmp/ascii_inf.XXXXXX)})] ) left_token: <Left_Backtick '`'> spids: [3000 3006] ) } spids: [2999] ) ] spids: [2999] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:INFPATH) op:Equal rhs:{(DQ )} spids:[3009])] spids: [3009] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:FRMLIST) op:Equal rhs:{(DQ )} spids:[3013])] spids: [3013] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:SYSPATH) op:Equal rhs:{(DQ )} spids:[3017])] spids: [3017] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:SYSBASE) op:Equal rhs:{(DQ )} spids:[3021])] spids: [3021] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:FRMBASE) op:Equal rhs:{(DQ )} spids:[3025])] spids: [3025] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other '[')} {(-r)} {(DQ ($ VSub_Number '$1'))} {(-a)} {(-r)} {(DQ ($ VSub_Number '$2'))} {(Lit_Other ']')} ) terminator: <Op_Semi ';'> ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:INFPATH) op: Equal rhs: {($ VSub_Number '$1')} spids: [3058] ) ] spids: [3058] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:SYSPATH) op: Equal rhs: {($ VSub_Number '$2')} spids: [3062] ) ] spids: [3062] ) (AndOr children:[(C {(convert_driver)})(C {(exit)} {(0)})] op_id:Op_DAmp) ] spids: [-1 3051] ) ] spids: [-1 3074] ) (While cond: [(Sentence child:(C {(Lit_Other ':')}) terminator:<Op_Semi ';'>)] body: (DoGroup children: [ (C {(mainmenu)}) (Case to_match: {(${ VSub_Name KEYPRESS)} arms: [ (case_arm pat_list: [{(1)}] action: [(C {(help1)}) (C {(help2)}) (C {(help3)}) (C {(help4)}) (C {(help5)})] spids: [3098 3099 3117 -1] ) (case_arm pat_list: [{(2)}] action: [(C {(firmcvt)})] spids: [3120 3121 3127 -1] ) (case_arm pat_list: [{(3)}] action: [(C {(convert_driver)})] spids: [3130 3131 3137 -1] ) (case_arm pat_list: [{(4)}] action: [ (C {(header)}) (C {(echo)} {(DQ )}) (C {(echo)} {(DQ ('\tBe seeing you!'))}) (C {(echo)} {(DQ )}) (C {(exit)}) ] spids: [3140 3141 3169 -1] ) (case_arm pat_list: [{(Lit_Other '*')}] action: [ (C {(header)}) (C {(echo)} {(DQ )}) (C {(echo)} {(-n)} {(DQ ("\tSorry, I didn't understand that. Press enter to try again: "))} ) (C {(read)} {(KEYPRESS)}) ] spids: [3172 3173 3199 -1] ) ] spids: [3089 3095 3202] ) ] spids: [3083 3204] ) ) (C {(exit)}) ] )