/******************************************************************* * CID Install S3 Drivers on for PS/2 Model 76i/77i * * * * This program performs the following steps: * * * * 1. Does the equivalent of running INST7677.EXE: * * - Unpacks DMQS (*.DGS) files to the \XVA directory on the * * the target drive. * * - Installs the VESA BIOS Extension * * - Updates CONFIG.SYS and AUTOEXEC.BAT * * - Creates \XVA\SETUP.PRO set up for the monitor specified * * in the response file. * * * * 2. Invokes S3INST if /S2: parameter is not specified. * * * * 3. Only when /S2 is specified: * * a. Unpacks CID enabled S3 install routine from OS/2 drivers * * diskette (SVGACID.DLL). * * b. Modifies \OS2\INSTALL\PSS3.DSC to support CID installation * * * * 4. Instructs CID to reboot the system and call back * * * * 5. Invokes DSPINSTL. Use /S2: parameter to override the default * * source directory (...\IMG\S37677\S3_OS2). * * * * 6. Set the display resolution based on responsefile input. * * * * 7. Installs APM drivers if selected in responsefile. The files * * are loaded from ...\IMG\S37677\S3_APM * * * * The program will exit with return code 0 if not invoked on * * a PS/2 Model 76i/77i running OS/2 on the target drive. This * * can be overridden by using keyword AbiosOverride=YES in the * * response file. * * * * Syntax: S37677 /S:sourcepath /T:targetdrive /R:responsefile * * /L1:errorlog /L2:historylog /S2:AlternateS3path * * * * Use /S2: to specify alternate source of OS/2 S3 driver files. * * Required if you install on OS/2 2.11 or OS/2 2.1 with SP. * * * * * * Response File format: * * * * Monitor=Monitor name * * AbiosOverride=[YES|NO] * * InstallApm=[YES|NO] * * Resolution=[0|1|2] * * * * PREPARING THE CODE SERVER: * * ------------------------- * * * * Unpack the APM files to a diskette before preparing your * * code server if you wish to install APM. * * * * 1. Run S37677 /PREPARE * * * * 2. Insert the following lines in the Product Data section of * * your LCU command file (NOTE: You probably have to change * * some parameters for your environment). Add the /S2 parameter * * if you wish to install S3 drivers supplied with OS/2 2.11 * * or ServicePak instead of the ones shipped with the system. * * * * x.s37677 = 12 * * x.12.name='S37677' * * x.12.statevar = 'CAS_' || x.12.name * * x.12.instprog = 'x:\img\s37677\s37677.CMD', * * ' /s:x:\img\s37677 ' , * * ' /t:' || bootdrive, * * ' /l1:y:\logs\S37677\'client'.L1 ', * * ' /l2:y:\logs\S37677\'client'.L2 ', * * ' /r:' * * x.12.rspdir = 'Y:\' * * x.12.default = 'monitor.rsp' * * * * 3. Insert the following lines in the Installation section of * * your LCU command file: * * * * when OVERALL_STATE = 2 then do * * if RunInstall(x.S37677) == BAD_RC then exit * * call SysSleep 30 * * Call CheckBoot * * end * * * * 4. Update the NUM_INSTALL_PROGS parameter in your LCU command * * file. * * * * 6. Modify the default response file (monitor.rsp) to reflect * * your environment. * * * * * * Written by: * * Jacob Lindgreen, PS Nordic, IBM Denmark * * JACOBL at DKIBMVM2 * * DKIBMGSP at IBMMAIL * * * *******************************************************************/ ErrorLog='CON' HistoryLog='CON' arg args /***************************************************** * Get commandline parameters * *****************************************************/ do i=1 to words(args) parm=translate(word(args, i)) select when parm = '?' then signal help when pos('/S:', parm) > 0 then parse var parm '/S:'Sourcepath when pos('/T:', parm) > 0 then parse var parm '/T:'Targetdrive when pos('/R:', parm) > 0 then parse var parm '/R:'Responsefile when pos('/L1:', parm) > 0 then parse var parm '/L1:'ErrorLog when pos('/L2:', parm) > 0 then parse var parm '/L2:'HistoryLog when pos('/S2:', parm) > 0 then parse var parm '/S2:'Source2path when pos('/PREPARE', parm) > 0 then do call PrepareServer exit end otherwise do say 'Bad parameter:' parm say '' signal help end end end /****************************************************************** * Check that we are actually running in CID environment. * * Exit with rc=1604x if not. * ******************************************************************/ State = value('CAS_S37677',,'OS2ENVIRONMENT') if State = '' then do say 'Non-CID install not supported.' exit c2d('1604'x, 2) end pip = '2>>'ErrorLog '1>>'HistoryLog call LoadResponseFile Responsefile /****************************************************************** * Check that \OS2\ABIOS.SYS is configured for Model 76i/77i. * * Exit with rc=0 (OK) if not. This will allow CID to continue * * on non-S3 systems. * * Response file keyword AbiosOverride=Yes will override this test.* ******************************************************************/ if translate(GetKeyword('ABIOSOVERRIDE'))<>'YES' then do if \ CheckAbios(Targetdrive) then do '@echo This system is not recognised as a PS/2 Model 76i or 77i running OS/2' pip exit 0 end end TargetDrive = strip(Targetdrive, 't', '\') Sourcepath = strip(Sourcepath, 't', '\') Source2path = strip(Source2path) Source2path = strip(Source2path, 't', '\') XVAPath = TargetDrive || '\XVA' if Source2path = '' then S3OS2 = Sourcepath || '\S3_OS2' else S3OS2 = Source2Path S3DOS = Sourcepath || '\S3_DOS' S3APM = Sourcepath || '\S3_APM' /****************************************************************** * Run install programs based on current install state. * * Install DMQS files, run S3INST, and reboot on first invocation. * * Run DSPINSTL on second invocation. * ******************************************************************/ S3INST = 'CMD /C' S3OS2 || '\S3INST' S3OS2 Targetdrive '/CID' pip DSPINSTL = 'CMD /C' TargetDrive || '\OS2\INSTALL\DSPINSTL /PK:SVGA /SK:NONE /S:'|| S3OS2 '/T:' || Targetdrive '/MC:8' pip select when State='0' then do call InstallXVA if Source2path = '' then S3INST else do '@ECHO Unpacking S3 CID Install DLL routine.' pip '@UNPACK' SourcePath || '\S3_OS2\CID' TargetDrive '/N:SVGACID.DLL' pip '@ECHO Updating S3 install profile to support CID Install' pip call UpdateDscFile TargetDrive end ExitCode = C2D('FF01'x, 2) end when State='1' then do DSPINSTL /* Install S3 Drivers */ ExitCode = rc if ExitCode = 0 then do NewResolution = translate(GetKeyword('RESOLUTION')) if NewResolution <> '' then do call SetResolution NewResolution end if translate(GetKeyword('INSTALLAPM')) = 'YES' then do call InstallApm S3APM, TargetDrive end end end end exit ExitCode /************************************************************** * LoadResponseFile FileName * * Loads response file statements to ResponseFileKeywords stem * * Comments (*) are ignored. * **************************************************************/ LoadResponseFile: parse arg FileName i = 1 do while lines(FileName) Line = strip(linein(FileName)) if Line <> '' & left(Line, 1) <> '*' then do ResponseFileKeywords.i = Line i = i + 1 end end ResponseFileKeywords.0 = i - 1 call charout FileName return /************************************************************** * GetKeyword(Keyword) * * Reads Keyword from ResponseFileKeywords * **************************************************************/ GetKeyword: procedure expose ResponseFileKeywords. parse arg Keyword do i = 1 to ResponseFileKeywords.0 line=ResponseFileKeywords.i parse var line Key'='KeyValue if translate(Keyword) = translate(Key) then do return KeyValue end end return '' /************************************************************** * InstallXVA * * Installs XVA Files * **************************************************************/ InstallXVA: /***************************************************** * Copy files * *****************************************************/ '@ECHO Starting DMQS File Install' pip '@ECHO Creating' XVAPath 'directory' pip '@MD' XVAPath pip '@ECHO Copying DMQS files' pip call UnpackDmqs S3DOS || '\E8F9M.DGS', XVAPath '@COPY' S3DOS || '\IDLST.GML' XVAPath pip '@CMD /C ' || S3DOS || '\EXPAND' S3DOS || '\XVAVESA.CO_' XVAPath || '\XVAVESA.COM' '@ECHO DMQS File Install Done' pip Monitor = GetKeyword('MONITOR') call ScanIdlist Monitor call CreateSetupPro MonitorId, MonitorDescription /***************************************************** * Update CONFIG.SYS * *****************************************************/ CfgFile = Targetdrive || '\CONFIG.SYS' CfgBackup = left(CfgFile, pos('.',CfgFile)) || 'XVA' '@ECHO Creating backup of CONFIG.SYS' pip '@COPY' CfgFile CfgBackup pip NewLines.0 = 1 NewLines.1 = 'SET DMQSPATH=' || XVAPath '@echo Updating CONFIG.SYS' pip call UpdateConfig CfgFile /***************************************************** * Update AUTOEXEC.BAT * *****************************************************/ AutoFile = Targetdrive || '\AUTOEXEC.BAT' AutoBackup = left(AutoFile, pos('.',AutoFile)) || 'XVA' '@ECHO Creating backup of AUTOEXEC.BAT' pip '@COPY' AutoFile AutoBackup pip NewLines.0 = 2 NewLines.1 = '@SET DMQSPATH=' || XVAPath NewLines.2 = '@' || XVAPath || '\XVAVESA.COM' '@echo Updating AUTOEXEC.BAT' pip call UpdateConfig AutoFile return /***************************************************** * UnpackDmqs Sourcefile TargetDir * * * * Unpacks the master .DGS file on the DOS S3 Driver * * Diskette to the target directory. * * * * File size is stored at offset 34 * * Monitor Id is stored at offset 36 * * * *****************************************************/ UnpackDmqs: parse arg DgsFile, TargetDir rc = stream(DgsFile, 'C', 'Open Read') do while chars(DgsFile) > 0 rc = stream(DgsFile, 'c', 'seek +34') Size = c2d(charin(DgsFile,,1)) Size = Size + 256 * c2d(charin(DgsFile,,1)) Id = c2d(charin(DgsFile,,1)) Id = Id + 256 * c2d(charin(DgsFile,,1)) rc = stream(DgsFile, 'c', 'Seek -38') DgsData = charin(DgsFile,,Size) NewDgsFile = TargetDir'\MON'd2x(Id, 4)'.DGS' rc = stream(NewDgsFile, 'c', 'Open write') rc = charout(NewDgsFile, DgsData) rc = stream(NewDgsFile, 'c', 'Close') end rc = stream(DgsFile, 'c', 'Close') return /***************************************************** * UpdateConfig FileName, NewLines * * Inserts NewLines.0 lines at beginning of Filename * *****************************************************/ UpdateConfig: parse arg FileName i = 1 do while lines(FileName) CfgLine.i = linein(FileName) i = i + 1 end CfgLine.0 = i - 1 call charout FileName call lineout Filename,,1 do i = 1 to NewLines.0 call lineout FileName, NewLines.i end do i = 1 to CfgLine.0 call lineout FileName, CfgLine.i end call charout FileName return /************************************************************** * ScanIdlist MonitorName * * Scans the IDLST.GML file and loads first matching monitor * * description. * * Sets MonitorId and MonitorDescription vars. * * Defaults to 8514 parameters * **************************************************************/ ScanIdlist: parse arg MonitorName IdFile=XVAPath || '\IDLST.GML' MonitorId = 'F0F0' /* Default ID */ MonitorDescription = 'IBM 8514' /* Default description */ do while lines(IdFile) Line = strip(linein(IdFile)) if pos(translate(MonitorName),translate(Line)) > 0 then do parse var Line ''MonitorDescription leave end end call charout IdFile return /************************************************************** * CreateSetupPro Id, Description * * Creates \XVA\SETUP.PRO on target drive * **************************************************************/ CreateSetupPro: parse arg Id, Description SetupFile = XVAPath || '\SETUP.PRO' '@echo Creating' SetupFile pip '@del' SetupFile '1>NUL 2>NUL' call lineout SetupFile,,1 call lineout SetupFile, '/******************************************************************************' call lineout SetupFile, '/*' call lineout SetupFile, '/* FILENAME: SETUP.PRO' call lineout SetupFile, '/*' call lineout SetupFile, '/* DESCRIPTION: Profile to set DMQS preferences on current system.' call lineout SetupFile, '/*' call lineout SetupFile, '/* LAST MODIFIED:' date('E') 'at' time('N') 'by S37677.CMD' call lineout SetupFile, '/*' call lineout SetupFile, '/******************************************************************************' call lineout SetupFile, '' call lineout SetupFile, '/******************************************************************************' call lineout SetupFile, '' || Description call lineout SetupFile, '' call lineout SetupFile, '/******************************************************************************' call charout SetupFile return /************************************************************** * CheckAbios drive * * Validates that the \OS2\ABIOS.SYS file on the target drive * * is for a PS/2 Model 76i/77i. * * This is done by reading the first line of the file and * * checking that SF8xxxxx.BIO is active. * **************************************************************/ CheckAbios: procedure arg Drive AbiosFile = Drive || '\OS2\ABIOS.SYS' if lines(AbiosFile) then do Line = strip(translate(linein(AbiosFile))) if Line = 'SF8B000.BIO' then return 1 end return 0 /************************************************************** * UpdateDscFile Drive * * Modifies \OS2\INSTALL\PSS3.DSC to support the SVGACID.DLL * * file shipped with the S3 Drivers Diskette. * * This step is required to prevent pop-up during execution * * of DSPINSTL. * **************************************************************/ UpdateDscFile: parse arg Drive '@ECHO Starting .DSC file update' pip DscFile = Drive || '\OS2\INSTALL\PSS3.DSC' DscBackup = left(DscFile, pos('.',DscFile)) || 'BAK' '@ECHO Creating backup copy of' DscFile pip '@COPY' DscFile DscBackUp pip '@ECHO Updating' DscFile pip i = 1 do while lines(DscFile) DscLine.i = Linein(DscFile) i = i + 1 end DscLine.0 = i - 1 call charout DscFile '@DEL' DscFile '1>NUL 2>NUL' Count = 0 do i = 1 to DscLine.0 FirstChar = left(strip(DscLine.i),1) if FirstChar = '"' & Count=1 then do call lineout DscFile, '"SVGACID.DLL"' Count = Count + 1 end else do if FirstChar = '"' then Count = Count + 1 call lineout DscFile, DscLine.i end end call charout DscFile '@ECHO .DSC file update done' pip return /************************************************************** * SetResolution Resolution * * Sets the graphics resolution. Input is based on the * * Resolution keyword in the response file. * * Requires REXX Utilities (REXXUTIL.DLL). * * * * Valid parms: * * 0 = Do not change * * 1 = 640x480x256 * * 2 = 1024x768x256 * **************************************************************/ SetResolution: procedure expose pip parse arg Resolution select when Resolution = '1' then ResString = '80020000'x || 'E0010000'x || '00010000'x || '01000000'x || '40000000'x when Resolution = '2' then ResString = '00040000'x || '00030000'x || '00010000'x || '01000000'x || '40000000'x otherwise return end '@ECHO Setting Display Resolution' pip call RxFuncAdd "SysIni", "RexxUtil", "SysIni" call SysIni 'USER', 'PM_DISPLAYDRIVERS', 'DEFAULTSYSTEMRESOLUTION', ResString '@ECHO Display Resolution set' pip return /************************************************************** * InstallApm Source Target * * Installs the S3 APM Drivers * * Requires that "Install Utilities" are installed with OS/2 * * (Uses \OS2\INSTALL\RSPDDI.EXE) * **************************************************************/ InstallApm: procedure expose pip parse arg SourceDir, Target '@ECHO Starting APM Install' pip '@ECHO Removing existing APM statements from CONFIG.SYS' pip '@'SourceDir || '\REMAPM' pip /* Remove current APM driver */ '@ECHO Installing APM files' pip '@RSPDDI' SourceDir Target pip /* Install based on .DDP file */ '@ECHO Adding Options page to APM notebook' pip '@INSTOPT' pip /* Add Options page to APM notebook */ '@ECHO APM Install done' pip return /************************************************************** * PrepareServer * * Prepares Code Server for S3 CID Install * **************************************************************/ PrepareServer: parse source . . ProgName do while queued() > 0 pull . end say '' say 'Enter name of your CID\IMG directory: (Ex: F:\CID\IMG)' say '' pull CidDir CidDir = strip(CidDir, 't', '\') '@MD' CidDir || '\S37677' '@MD' CidDir || '\S37677\S3_DOS' '@MD' CidDir || '\S37677\S3_OS2' '@MD' CidDir || '\S37677\S3_APM' '@COPY' Progname CidDir || '\S37677' do while queued() > 0 pull . end say '' say 'Insert Local Bus Graphics Device Drivers DOS and Windows 3.1 Diskette' say 'in drive A: and press Enter.' pull . '@COPY A:\*.*' CidDir || '\S37677\S3_DOS' do while queued() > 0 pull . end say '' say 'Insert Local Bus Graphics Device Drivers OS/2 2.1 Diskette' say 'in drive A: and press Enter.' pull . '@COPY A:\*.*' CidDir || '\S37677\S3_OS2' do while queued() > 0 pull . end say '' say 'Do you want to install S3 Power Management Drivers (Y/N)?' pull ApmReply if translate(ApmReply) = 'Y' then do PrepareApm = 1 do while queued() > 0 pull . end say '' say 'Insert OS/2 S3 Advanced Power Management Driver Diskette' say 'in drive A: and press Enter.' pull . '@COPY A:\*.*' CidDir || '\S37677\S3_APM' end else PrepareApm=0 call BuildResponseFile CidDir || '\S37677\MONITOR.RSP', CidDir || '\S37677\S3_DOS\IDLST.GML' return /************************************************************** * BuildResponseFile * * Builds the default response file based on IDLST.GML input. * **************************************************************/ BuildResponseFile: parse arg ResponseFile, IdFile '@del' ResponseFile '1>nul 2>nul' do while queued() pull . end say '' say 'Enter default monitor name [9524]:' say '' pull MonitorName MonitorName = strip(MonitorName) if MonitorName = '' then MonitorName = '9524' call lineout ResponseFile,,1 call lineout ResponseFile, '******************************************************************************' call lineout ResponseFile, '*' call lineout ResponseFile, '* Monitor' call lineout ResponseFile, '*' call lineout ResponseFile, '* Specifies which monitor to configure for.' call lineout ResponseFile, '*' call lineout ResponseFile, '* Model 76i/77i.' call lineout ResponseFile, '*' call lineout ResponseFile, '* Valid names (Partial name will select the first match)' call lineout ResponseFile, '*' do while lines(IdFile) Line = strip(linein(IdFile)) parse var Line ''MonitorDescription call lineout ResponseFile, '* ' MonitorDescription end call lineout ResponseFile, '******************************************************************************' call lineout ResponseFile, '' call lineout ResponseFile, 'Monitor=' || MonitorName call lineout ResponseFile, '' call lineout ResponseFile, '' call lineout ResponseFile, '******************************************************************************' call lineout ResponseFile, '*' call lineout ResponseFile, '* ABIOS Override' call lineout ResponseFile, '*' call lineout ResponseFile, '* Specifies whether the ABIOS check should be overridden.' call lineout ResponseFile, '* Doing so will force install on all systems, not just PS/2' call lineout ResponseFile, '* Model 76i/77i.' call lineout ResponseFile, '*' call lineout ResponseFile, '* Valid Parms:' call lineout ResponseFile, '*' call lineout ResponseFile, '* YES=Override ABIOS check and force Install.' call lineout ResponseFile, '* NO=Exit Install if ABIOS check fails. (Default).' call lineout ResponseFile, '*' call lineout ResponseFile, '*' call lineout ResponseFile, '*' call lineout ResponseFile, '******************************************************************************' call lineout ResponseFile, '' call lineout ResponseFile, '*AbiosOverride=Yes' call lineout ResponseFile, '' call lineout ResponseFile, '******************************************************************************' call lineout ResponseFile, '*' call lineout ResponseFile, '* Resolution' call lineout ResponseFile, '*' call lineout ResponseFile, '* Sets the display resolution.' call lineout ResponseFile, '*' call lineout ResponseFile, '* Valid Parms:' call lineout ResponseFile, '*' call lineout ResponseFile, '* 0 = Do not change. (Default).' call lineout ResponseFile, '* 1 = 640x480x256' call lineout ResponseFile, '* 2 = 1024x768x1024' call lineout ResponseFile, '*' call lineout ResponseFile, '******************************************************************************' call lineout ResponseFile, '' call lineout ResponseFile, '*Resolution=2' call lineout ResponseFile, '' if PrepareApm=1 then do call lineout ResponseFile, '******************************************************************************' call lineout ResponseFile, '*' call lineout ResponseFile, '* APM Support' call lineout ResponseFile, '*' call lineout ResponseFile, '* Specifies whether to install the S3 APM drivers.' call lineout ResponseFile, '*' call lineout ResponseFile, '* Valid Parms:' call lineout ResponseFile, '*' call lineout ResponseFile, '* YES=Install S3 APM Drivers.' call lineout ResponseFile, '* NO=Do not install. (Default).' call lineout ResponseFile, '*' call lineout ResponseFile, '*' call lineout ResponseFile, '******************************************************************************' call lineout ResponseFile, '' call lineout ResponseFile, 'InstallAPM=Yes' end call charout IdFile call charout ResponseFile '@echo Default response file' ResponseFile 'created.' return /************************************************************** * Help * * Prints help text and exits * **************************************************************/ help: parse upper source . . ProgName ProgName = filespec("name", ProgName) ProgName = left(ProgName, pos('.', ProgName) - 1) say '' say ProgName || ':' say '' say 'CID Enabled S3 Driver Installation for PS/2 Model 76i/77i.' say '' say 'Syntax:' say ProgName '/S:path /T:d: /R:file /L1:path /L2:path [/PREPARE]' say '' say ' Parameter Description Default' say ' --------- ----------- -------' say ' /S:path Source directory' say ' /T:d: Target drive C:' say ' /R:file Fully qualified response file name See LCU command file' say ' /L1:path Path to error log Display' say ' /L2:path Path to history log Display' say ' /S2:path Path to alternate source of S3 files' say ' - Use when installing on level 6200' say ' /PREPARE Prepare code server' say '' say 'Jacob Lindgreen, PS Nordic, IBM Denmark' say 'JACOBL at DKIBMVM2' say 'DKIBMGSP at IBMMAIL' say '' exit c2d('1604'x,2)