![]() |
Mar 19 2004, 07:28 PM
Post
#1
|
|
|
Member ![]() ![]() Group: Members Posts: 67 Joined: 7-June 03 Member No.: 900 |
What: Passing parameters to memdisk
Why: To link CDShell and the DOS boot floppy so a choice in CDShell's menu will react differently on the floppy image. This way you can have just one floppy image with a appropriate autoexec.bat witch will launch the program you told CDShell. Actualy, I have 3 floppy images instead of ~20. Before, I had one for Partition Magic, one for F-Prot, one for Win98 Boot disk, one for... Now I have one witch look on the cd and launch the appropriate apps (2 other floppy images are from tom's "The most GNU/Linux on 1 floppy disk" and from memtest86 witch, for tom's, uses a linux image, and memtest86 don't like having memory managers...) What you'll need: -A dos boot floppy. I used my old Win98 floppy. You could use FreeDos (I think, I didn't try...) -An utility to compress cab files (I used PowerArchiever2003) or zip (WinRAR) witchever you prefer... -Something to uncompress cabs and/or zips in dos -Anything else you've had to create your CD. -All the following tools: CDShell F-Prot for DOS v3.14e (free for personnal use) Virus definitions Macro virus definitions FreeDos's Utilities: Unzip Find Keyb Syslinux WinImage (to edit your floppy image) I'll assume you want Partition Magic and F-Prot to be run from CDShell and <cdroot> will mean the root of your cd... 1- Compress you programs For Partition Magic you'll need all the files from the 2 floppies created on the installation of the program. Compress them in zip or cab. Put the new file in <cdroot>\utils\cabs For F-Prot, download the dos version, extract it, and go delete the virus definition files. Those files are the 4 SIGN* files and the 2 MACRO* files. Repack everything. It should be around ~500 kb (not ~2 Mb). Download the fresh virus definitions (2 files: virus and macros) and copy them (don't extract, don't rename, don't touch... 2- Floppy image Create your floppy image. You'll need to have some things in it. Be sure to have/put a copy of: unzip.exe extract.exe find.com mdiskchk.com mscdex.exe restart.com xmsdsk.exe keyb.exe key\<language> The keyb.exe is just to have the keyboard you want. All you need is keyb.exe and key\<your language>. Flush all the rest. My language is CF.key Look for the FreeDos links I gave, they point to archive witch contains many things... just extract the .exe. You'll find mdiskchk.com from the syslinux package under sample\ Create a file called Cmdline.bat containing this and put it in the floppy image: QUOTE (Cmdline.bat) SET run=%6 Now you'll want to edit your config.sys and autoexec.bat for the serious thing... 3- Editing config.sys this will edit the way dos will react... search the web for more info on it. Here's mine: QUOTE (config.sys) device=oakcdrom.sys /D:mscd001 device=himem.sys /testmem:off FILES=60 BUFFERS=40 lastdrive=z dos=high,umb stacks=9,256 lastdrive=z 4- Editing autoexec.bat Begin with an echo off: CODE @echo off If you want to have your keyboard settings, make a call to keyb: CODE keyb a:\key\cf.key (change cf.key to your's)Some dos commands: CODE SET EXPAND=YES SET DIRCMD=/O:N We now set some variables so we can keep track of the CD and Ramdrive driver loading... CODE set RAMDRIVE=empty set CDROM=empty Set the new path: CODE set PATH=%path%;A:\ Now the part where we check the parameter we gave to memdisk... CODE A:\mdiskchk | FIND "run=" > A:\TEMP.BAT CALL A:\TEMP.BAT The first line will call mdiskchck witch returns: QUOTE (mdiskchk) Drive 00 is MEMDISK 2.08: and pipe the result into the find command witch will find the line containing the "run=" string. The outpout is redirected to A:\temp.bat witch will containt only the last line quoted. Calling temp.bat will run the batch file. Since it contain "Cmdline = BOOT_..." it will try to execute the "cmdline" command, witch doesn't exists, and pass the rest of the line as the parameter. That's why we created a file Cmdline.bat earlier. This file will make the variable "run" contain the 6th parameter giving to Cmdline.bat, witch is the rigth side of the "run=" (1st is "BOOT_IMAGE", 2nd is "/BOOT/modules/memdisk", 3rd is "initrd", 4th is "/utils/img/floppy.img", 5th is "run" and 6th is "pqpm8"). So now we have a environment variable containing the parameter we gave to isolinux when loading from CDShell. Lets use it...Address = 0x03d60000, len = 2880 sectors, chs = 80/2/18 Cmdline = BOOT_IMAGE=/BOOT/modules/memdisk initrd=/utils/img/floppy.img run=pqpm8 We'll need CD-ROM support and a ramdrive. But maybe we don't want it. So lets make it optionnal. We will jump to the section named %run%: CODE GOTO %run% Lets continue linearly in the autoexec.bat file. We'll make a section to load CD drivers: CODE :CDROM SET CDROM=L LH A:\MSCDEX.EXE /D:mscd001 /L:%CDROM% > NUL IF NOT "%run%"=="" GOTO %run% We'll use variables for the CDROM letter, so it will be possible to call it later. The second line install CD support. The last line will jump to the %run% section. Let's make a ramdrive: CODE :RAMDRIVE SET RAMDRIVE=R XMSDSK 16384 %RAMDRIVE%: /y > NUL SET TEMP=%RAMDRIVE%:\ SET TMP=%RAMDRIVE%:\ SET path=%PATH%;%RAMDRIVE%:\;%RAMDRIVE%:\cmospwd;%RAMDRIVE%:\gdisk IF NOT "%run%"=="" GOTO %run% We make a 16Mb (16384 kb) ramdrive to be sure everything will fit. The path are adjusted to utilities we want. After this the bat jumps to the %run% section but we will continue forward. We now include the sections of each application we want. Here are some exemples: CODE :WIN98NOCD IF "%RAMDRIVE%"=="empty" GOTO RAMDRIVE set CDROM= cls echo. echo Windows 98SE v4.10.2222 (MS-DOS v7.10 A) Boot disk echo without CD-ROM support echo. GOTO end This will create a ramdrive (the first line) but will not install CD support. It is useless since we booted from CD, I admit, but Win98 boot disk have this option and I want to show that its possible not to load everything but only what we want. the "end" section is the end of the autoexec.bat CODE :WIN98 This will do the same exept it will load the cd drivers and the will extract the utils.cab file (containing format.com, edit.com, etc.) into the ramdrive.IF "%CDROM%"=="empty" GOTO CDROM IF "%RAMDRIVE%"==" empty " GOTO RAMDRIVE cls echo Extraction des utilitaires dans le RamDrive (%RAMDRIVE%:) extract /y /e /l %RAMDRIVE%: %CDROM%:\utils\cabs\utils.cab > NUL cls echo. echo Windows 98SE v4.10.2222 (MS-DOS v7.10 A) Boot disk echo with CD-ROM support (%CDROM%:\) echo. echo Utilities loaded in %RAMDRIVE%:\ echo. GOTO end We want Partition magic also: CODE :pqpm8 IF "%CDROM%"=="vide" GOTO CDROM IF "%RAMDRIVE%"=="vide" GOTO RAMDRIVE extract /y /e /l %RAMDRIVE%: %CDROM%:\utils\cabs\pqpm8.cab > NUL %RAMDRIVE%:\PQMAGIC.exe goto QUIT This will load the ramdrive, the cd drivers, extract the <cdroot>\utils\cabs\pqpm8.cab into the ramdrive and execute pqmagic.exe. After your done, jomping to "quit" will reboot. And F-Prot: CODE :FPROT IF "%CDROM%"=="vide" GOTO CDROM IF "%RAMDRIVE%"=="vide" GOTO RAMDRIVE cls echo Extracting F-Prot Anti-Virus echo Please wait... extract /y /e /l %RAMDRIVE%: %CDROM%:\utils\cabs\fprot.cab > NUL unzip %CDROM%:\utils\cabs\fp-def.zip -d %RAMDRIVE%:\ > NUL unzip %CDROM%:\utils\cabs\macrdef2.zip -d %RAMDRIVE%:\ > NUL %RAMDRIVE%:\f-prot.exe GOTO QUIT This will extract the <cdroot>\utils\cabs\fprot.cab file we created earlier into the ramdrive. It will also extract the virus definitions. Its usefull because all you have to do to update the definitions is download a newer one and replace the 2 files. I've tried to make the batch file looks on the (physical) floppy for a new one but fp-def.zip is too big to fit on a floppy (~1.6MB) ... If you have a copy of NTFSDOS Pro, you can use it like this: CODE :FPNTFS5 IF "%CDROM%"=="vide" GOTO CDROM IF "%RAMDRIVE%"=="vide" GOTO RAMDRIVE cls echo F-Prot Anti-Virus with NTFSDOS Pro v5.0 echo Please wait... extract /y /e /l %RAMDRIVE%: %CDROM%:\utils\cabs\ntfsdos.cab > NUL extract /y /e /l %RAMDRIVE%: %CDROM%:\utils\cabs\fprot.cab > NUL unzip %CDROM%:\utils\cabs\fp-def.zip -d %RAMDRIVE%:\ > NUL unzip %CDROM%:\utils\cabs\macrdef2.zip -d %RAMDRIVE%:\ > NUL %RAMDRIVE%: ntfspro /T:-5:00 "/s%RAMDRIVE%:\f-prot.exe" GOTO QUIT This will do the same but extract the ntfsdospro files too, run it and give as parameters the f-prot executable. Finaly we "close" autoexec.bat: CODE :QUIT restart :end If you jump to "QUIT" you will reboot the computer. If you jump to "end" it will get back to the command prompt. Now put your new modified autoexec.bat in your floppy image. Let's talk about CDShell. 5- CDShell Make a nice menu as you like it. Say the menu ask you to press the "1" key to run pqpm, you'll have: CODE if $lastkey == key[1]; then isolinux /boot/modules/memdisk initrd=/utils/img/floppy.img run=pqpm8 Or to run a Win98 boot disk (2= without cd, 3= with cd): CODE if $lastkey == key[2]; then isolinux /boot/modules/memdisk initrd=/utils/img/floppy.img run=WIN98NOCD if $lastkey == key[3]; then isolinux /boot/modules/memdisk initrd=/utils/img/floppy.img run=WIN98 Or F-Prot: CODE if $lastkey == key[4]; then isolinux /boot/modules/memdisk initrd=/utils/img/floppy.img run=FPROT if $lastkey == key[5]; then isolinux /boot/modules/memdisk initrd=/utils/img/floppy.img run=FPNTFS5 etc. All you need is call isolinux with those parameters and autoexec.bat will do the job. I saved ~30 Mb on my CD (Now under 650Mb! Wouhou! If you call isolinux with other parameters, change the Cmdline.bat file to fit your needs, or put your parameters on the right side of "run=" I hope it will be usefull to some people out there! If there is typos/errors please post a reply and I'll correct it. Edit (25 03 2004): -Changed the url links for updated one (thanks Bernd!) -Corrected some bad characters ("?") when pasted from Word. If you see others, don't take it as "?" but as a Word's special character... Replace with "...", "<<" or " ' " |
|
|
|
big_gie A Guide To Pass Parameters To Memdisk Mar 19 2004, 07:28 PM
Bernd Blaauw FIND: http://www.coli.uni-sb.de/~eric/stuff/soft..... Mar 19 2004, 07:56 PM
Mike Wow, nice work big_gie and Bernd! Mar 24 2004, 10:50 PM
evilvoice big_gie...can you do me a favor and post what you ... Mar 26 2004, 01:15 AM
big_gie I wasn't sure if my restart.com came with the ... Mar 26 2004, 07:56 AM
evilvoice you are right big_gie...restart.com is in ebd.cab Mar 26 2004, 09:01 AM
xpmule hey can anyone provide more info on this concept ?... Mar 28 2004, 03:46 AM
big_gie Hum..
Your autoexec.bat seems ok, your cdshell sc... Mar 28 2004, 10:47 AM
evilvoice its because in your autoexec.bat where you have se... Mar 28 2004, 10:52 AM
Bernd Blaauw you are mistaking
CALL batfile.bat (returns to p... Mar 28 2004, 11:22 AM
Bernd Blaauw the trick is the following:
original cmdline.bat ... Mar 28 2004, 11:49 AM
Bernd Blaauw the trick is the following:
original cmdline.bat ... Mar 28 2004, 11:54 AM
xpmule First off.. Thanks for the fast reply/help..
... Mar 28 2004, 01:00 PM
evilvoice uhm xpmule...you might wanna make sure your autoex... Mar 28 2004, 03:04 PM
xpmule sweeeeet !
She works.. thats so cool !
Tha... Mar 29 2004, 12:16 AM
evilvoice well technically its supposed to have mouse suppor... Mar 29 2004, 01:41 AM
Bernd Blaauw I'll try to correct my code.
but I thought
1... Mar 29 2004, 07:42 AM
xpmule Back again..
About the "PQPM8" mouse iss... Mar 29 2004, 11:05 AM
Bernd Blaauw MDISKCHK returns my parameters in another order.
C... Mar 29 2004, 01:09 PM
Bernd Blaauw ok, I made this stuff independent of the position,... Mar 29 2004, 01:39 PM
evilvoice hmm well Bernd...he did say to use cdshell but ... Mar 29 2004, 02:08 PM
evilvoice also, something else im thinking about...I notice ... Mar 30 2004, 02:45 AM
xpmule well.. back again on this post..
I thought i was i... Mar 30 2004, 07:25 AM
evilvoice hmmm...to comment more on my post above...if we se... Mar 30 2004, 07:53 AM
Bernd Blaauw thanks for the idea of removing FIND.
quite intri... Mar 30 2004, 10:39 AM
evilvoice actually...yea if anyone hates getting the error m... Mar 31 2004, 01:53 AM
big_gie Hi guys, sorry for the lack of post, I was a bit b... Mar 31 2004, 05:04 PM
evilvoice well there is one more option, which i just though... Mar 31 2004, 05:20 PM
gmkrishn Passing parameters to DOS can help you do wonderfu... Mar 31 2004, 06:18 PM
gmkrishn And before I forget, while we are still talking ab... Mar 31 2004, 06:37 PM
evilvoice 1 question for you gmkrishn...not that I mind this... Apr 1 2004, 08:07 AM
gmkrishn Most of us use such a CD to do many things, OS Ins... Apr 1 2004, 04:36 PM
Bernd Blaauw problem also asked per email,
but:
how to let get... Apr 13 2004, 07:16 PM
JJA Where's the file mdiskchk.exe? Mar 9 2005, 10:25 AM
Björn_2 QUOTE You'll find mdiskchk.com from the syslin... Mar 21 2005, 04:07 PM
The BlackBull Can anybody post the final version of autoexec.bat... Jul 31 2005, 10:06 AM
d4vr0s I'm just starting to play with this idea.
Here... Aug 9 2005, 09:34 PM![]() ![]() |
| Lo-Fi Version | Time is now: 9th February 2010 - 10:35 AM |