Create DOS floppy image while booted into DOS using existing files on HD
#1
Posted 03 November 2010 - 04:40 PM
I'm hoping someone can provide a solution or point me in the right direction.
What I'm trying to do is from within DOS create a bootable DOS image file (e.g. dosboot.img - 1.44MB) using files from my DOS environment as the source.
Currently I can create bootable DOS images fine from within Windows using WinImage or similar tools, but I want to be able to create these images from within DOS because it will be much more efficient than going back and forth between DOS and Windows to do my boot testing and image creation and modifications.
I don't believe tools like rawrite or dd will work because they don't specify a set of files (or a directory) as a source. I guess I need something like mkisofs for DOS, but a tool which will create a floppy image file instead of an ISO-9660 file. I saw some of Bart's tools which looked promising (e.g. mkbt, etc..) but sadly they do not seem to work in real-mode DOS, only in a DOS-shell within Windows.
I found this thread from searching and was hopeful it would provide a solution, but I think the ideas in here relate to creating an image file from an actual floppy, not from files on the hard drive:
http://www.boot-land...showtopic=11716
Anyone know how I can accomplish my goal???
Thanks very much.
#2
Posted 03 November 2010 - 05:46 PM
1. Boot from a hard disk to DOS
2. run a program to make a bootable 1.44MB floppy disk IMG file from source files
3. write that 1.44MB IMG file to a floppy disk
4. boot from the floppy disk
or are you booting from a floppy disk, using files from a hard disk or network and storing the image on a hard disk or network?
Sorry, please explain the scenario.
PS why not use an emulator like QEMU in windows to boot from a floppy image?
S
#3
Posted 03 November 2010 - 06:00 PM
Thx for the message.
Let me try to clarify what I want...
1. Boot from a hard disk OR from an image file (on a USB stick) to DOS (e.g. I have some DOS floppy image files and HD image files which I currently boot from using grub4dos)
2. <just what you said above> e.g. create a 1.44MB floppy disk IMG file from source files; additionally I'd like to be able to create arbitrarily sized IMG files, but a boot floppy image (1.44MB) is sufficient to start; (I've succeeded in creating bootable hard drive image files which I can boot to, but only using BSD or Linux and I want to be able to create the bootable images from within DOS)
3. I don't need to write the created IMG file to floppy; I just want to be able to create the image file so I can copy it back to my USB stick or otherwise access it on the hard drive later (e.g. from a bootloader such as grub/grub4dos/syslinux)
4. Boot using image file created in step 2
Hope that helps clarify. Let me know if you have any other questions and I'll be happy to try and clarify further.
Thanks a lot,
fmbOOtfan
#4
Posted 03 November 2010 - 06:30 PM
#5
Posted 03 November 2010 - 07:55 PM
Anyway, DCOPY:
http://users.telenet...plications.html
Should be able to do some of it.
You need anyway to experiment if that works with a "mounted" image, such as one from Frank Uberto's XMSDSK:
http://www.simtel.ne...ct/view/id/4825
or from SRDISK:
http://sourceforge.n...rojects/srdisk/
Or, even better with one of the "lesser known" companion apps to SHSUCDX:
http://adoxa.110mb.com/shsucdx/
namely SHSUFDRV:
http://adoxa.110mb.c...fdrv/index.html
Or you can use grub.exe to map an image to a floppy device and re-start DOS.
Something that may also come handy can be found here (courtesy of the Wayback Machine):
http://web.archive.o...ipcord/rawrite/
http://web.archive.o...ipcord/rawrite/
Particularly fakedisk:
http://web.archive.o...te/fakedisk.zip
and dosdf:
http://web.archive.o...trial/dosdf.zip
Check also this seemingly unrelated thread:
http://www.msfn.org/...howtopic=140391
Wonko
#6
Posted 03 November 2010 - 09:51 PM
Ok, i see what you want to do. Presumably you cannot run an emulator under Windows?
I can run a DOS emulator under Windows such as a DOS instance within VirtualBox, but I still want to be able to create the new images while booted into DOS. I've been trying to get QEMU the last few days to try that but the qemu.org and qemu.com sites both seem to be down! :-/
#7
Posted 03 November 2010 - 09:58 PM
First thing WHICH DOS?
Anyway, DCOPY:
http://users.telenet...plications.html
Should be able to do some of it.
You need anyway to experiment if that works with a "mounted" image, such as one from Frank Uberto's XMSDSK:
http://www.simtel.ne...ct/view/id/4825
or from SRDISK:
http://sourceforge.n...rojects/srdisk/
Or, even better with one of the "lesser known" companion apps to SHSUCDX:
http://adoxa.110mb.com/shsucdx/
namely SHSUFDRV:
http://adoxa.110mb.c...fdrv/index.html
Or you can use grub.exe to map an image to a floppy device and re-start DOS.
Something that may also come handy can be found here (courtesy of the Wayback Machine):
http://web.archive.o...ipcord/rawrite/
http://web.archive.o...ipcord/rawrite/
Particularly fakedisk:
http://web.archive.o...te/fakedisk.zip
and dosdf:
http://web.archive.o...trial/dosdf.zip
Check also this seemingly unrelated thread:
http://www.msfn.org/...howtopic=140391
Wonko
For this stuff I'm using MS-DOS 6.22.
Thanks for that list of utils Wonko. I'm going to look into them to see if they can help fulfill my goal... back to the DOS lab...
#8
Posted 03 November 2010 - 10:24 PM
#9
Posted 03 November 2010 - 10:59 PM
Check also this seemingly unrelated thread:
http://www.msfn.org/...howtopic=140391
Wonko
@Wonko, I read page 1 of that thread regarding Win98Live but couldn't see the relevance to my question. Could you enlighten me? Thanks.
#10
Posted 04 November 2010 - 08:02 AM
If ye can get hold of a boot sector, you can create a complete floppy under DOS. You could, for example, have a DOS rexx batch that runs under REXX (eg IBM's rexx, regina rexx or quercus rexx, even something like brexx), that reads the boot sector, and then creates a floppy disk directly from it.
No need to actually create floppies. Save this as a rexx script, and run it under a rexx processor. The format is mkdisk [i]maker[i] diskimage, eg mkdisk pcdos IBMMAGIC.DSK.
You inject the files in order, and the thing becomes bootable.
/* rexx mkfloppy - Wendy Krieger - an os2 fan 2*/ numeric digits 40 parse upper arg maker outfile select when maker = 'MSDOS' then call msdos when maker = 'PCDOS' then call pcdos when maker = 'MSWIN' then call mswin otherwise; call ttyhelp; end call charout outfile, bs /* fat = '1200'x * 2, starts with 'F0 FFFF'*/ fat = 'F0FFFF'x || copies('00'x, 4605) call charout outfile, fat call charout outfile, fat /* root directory */ fat = copies('00'x, 7168) call charout outfile, fat /* blank space 1457664 = 512 * 2843 */ sector = copies('F6'x, 512) chunk = copies(sector, 219) do n=1 to 13; call charout outfile, chunk; end exit add: parse arg tail; bs = bs || tail; return nex: nop; return msdos:; bs = '' call add "EB3C904D53444F53352E30000201010002E000400BF009001200020000000000"x call add "000000000000290F0C180C4E4F204E414D45202020204641543132202020FA33"x call add "C08ED0BC007C1607BB780036C5371E561653BF3E7CB90B00FCF3A4061FC645FE"x call add "0F8B0E187C884DF9894702C7073E7CFBCD13727933C03906137C74088B0E137C"x call add "890E207CA0107CF726167C03061C7C13161E7C03060E7C83D200A3507C891652"x call add "7CA3497C89164B7CB82000F726117C8B1E0B7C03C348F7F30106497C83164B7C"x call add "00BB00058B16527CA1507CE89200721DB001E8AC0072168BFBB90B00BEE67DF3"x call add "A6750A8D7F20B90B00F3A67418BE9E7DE85F0033C0CD165E1F8F048F4402CD19"x call add "585858EBE88B471A48488A1E0D7C32FFF7E30306497C13164B7CBB0007B90300"x call add "505251E83A0072D8B001E85400595A5872BB05010083D200031E0B7CE2E28A2E"x call add "157C8A16247C8B1E497CA14B7CEA00007000AC0AC07429B40EBB0700CD10EBF2"x call add "3B16187C7319F736187CFEC288164F7C33D2F7361A7C8816257CA34D7CF8C3F9"x call add "C3B4028B164D7CB106D2E60A364F7C8BCA86E98A16247C8A36257CCD13C30D0A"x call add "4E6F6E2D53797374656D206469736B206F72206469736B206572726F720D0A52"x call add "65706C61636520616E6420707265737320616E79206B6579207768656E207265"x call add "6164790D0A00494F2020202020205359534D53444F53202020535953000055AA"x return mswin: ; bs = '' call add "EB3C904D53444F53372E31000201010002E000400BF009001200020000000000"x call add "00000000000029FF64A0392020202020202020202020464154313220202033C9"x call add "8ED1BCFC7B1607BD7800C576001E561655BF2205897E00894E02B10BFCF3A406"x call add "1FBD007CC645FE0F384E247D208BC199E87E0183EB3A66A11C7C663B078A57FC"x call add "750680CA0288560280C31073ED33C9FE06D87D8A461098F7661603461C13561E"x call add "03460E13D18B7611608946FC8956FEB82000F7E68B5E0B03C348F7F30146FC11"x call add "4EFE61BF0007E82801723E382D741760B10BBED87DF3A661743D4E740983C720"x call add "3BFB72E7EBDDFE0ED87D7BA7BE7F7DAC9803F0AC9840740C487413B40EBB0700"x call add "CD10EBEFBE827DEBE6BE807DEBE1CD165E1F668F04CD19BE817D8B7D1A8D45FE"x call add "8A4E0DF7E10346FC1356FEB104E8C20072D7EA00027000525006536A016A1091"x call add "8B4618A22605969233D2F7F691F7F64287CAF7761A8AF28AE8C0CC020ACCB801"x call add "02807E020E7504B4428BF48A5624CD136161720A40750142035E0B497577C303"x call add "1801270D0A496E76616C69642073797374656D206469736BFF0D0A4469736B20"x call add "492F4F206572726F72FF0D0A5265706C61636520746865206469736B2C20616E"x call add "64207468656E20707265737320616E79206B65790D0A0000494F202020202020"x call add "5359534D53444F532020205359537F010041BB000760666A00E93BFF000055AA"x return pcdos:; bs='' call add "EB3C9049424D2020372E30000201010002E000400BF009001200020000000000"x call nex "00000000000029D4116F224449534B202020202020314641543132202020FA33"x call add "000000000000290C140E6120202020202020202020204641543132202020FA33"x call add "C08ED0BC007C1607BB780036C5371E561653BF3E7CB90B00FCF3A4061FC645FE"x call add "0F8B0E187C884DF9894702C7073E7CFBCD13727933C03906137C74088B0E137C"x call add "890E207CA0107CF726167C03061C7C13161E7C03060E7C83D200A3507C891652"x call add "7CA3497C89164B7CB82000F726117C8B1E0B7C03C348F7F30106497C83164B7C"x call add "00BB00058B16527CA1507CE89200721DB001E8AC0072168BFBB90B00BEE67DF3"x call add "A6750A8D7F20B90B00F3A67418BE9E7DE85F0033C0CD165E1F8F048F4402CD19"x call add "585858EBE88B471A48488A1E0D7C32FFF7E30306497C13164B7CBB0007B90300"x call add "505251E83A0072D8B001E85400595A5872BB05010083D200031E0B7CE2E28A2E"x call add "157C8A16247C8B1E497CA14B7CEA00007000AC0AC07429B40EBB0700CD10EBF2"x call add "3B16187C7319F736187CFEC288164F7C33D2F7361A7C8816257CA34D7CF8C3F9"x call add "C3B4028B164D7CB106D2E60A364F7C8BCA86E98A16247C8A36257CCD13C30D0A"x call add "4E6F6E2D53797374656D206469736B206F72206469736B206572726F720D0A52"x call add "65706C61636520616E6420707265737320616E79206B6579207768656E207265"x call add "6164790D0A0049424D42494F2020434F4D49424D444F532020434F4D000055AA"x return ttyhelp: call lineout, 'MKDISK can make blank 1440k floppies for MSDOS, PCDOS, or Win9x' call lineout, '' call lineout, ' MKDISK maker output-file' call lineout, '' call lineout, ' msdos MS-DOS 3.x - 6.22 (io.sys, msdos.sys)' call lineout, ' mswin Windows 95-ME (io.sys, msdos.sys)' call lineout, ' pcdos PC-DOS 3.3 - 7.00 (ibmbio.com, ibmdos.com)' call lineout, '' call lineout, ' To make the disk bootable, the files in brackets need to be injected' call lineout, ' in the order listed.' exit; return
#11
Posted 04 November 2010 - 10:43 AM
Well, read the WHOLE thread.@Wonko, I read page 1 of that thread regarding Win98Live but couldn't see the relevance to my question. Could you enlighten me? Thanks.
Extract (and other tools) is mentioned starting on page 4:
http://www.msfn.org/...o...40391&st=79
If you don't have a rexx processor , you can use a batch making use of echoo.com, you can get it from inside one of my batches:
http://www.boot-land...?showtopic=3191
or from here, where also some details are given:
http://www.boot-land...?...25149&st=24
OT , but not much and NOT for use under DOS, but ONLY on 2K/XP, this small batch may be of use:
http://www.forensicf...m...opic&t=4805
Wonko
#12
Posted 05 November 2010 - 10:17 PM
Thx for the tips. I will check out your suggestions and update the thread, probably sometime next week. So far I can report that I've had some success using qemu and it's built-in read/write ability to handle img files.
Have a nice weekend!
#13
Posted 03 December 2010 - 11:41 PM
I succeeded in fulfilling my goal using a couple of methods. These all assume one is starting with a valid bootable MS-DOS/Win9x floppy, though by using method #3 a fresh floppy image can be made from scratch with a boot sector and adding the OS source files in the correct order. However, I did not create the fresh boot floppy from within DOS using this method. All methods should constrict the user to only writing within the FDD 1.44MB structure due to the starting floppy container size.
1) Using qemu, boot a MS-DOS floppy image file (e.g. DOS 6.22/Win9x startup disk) and modify the environment within the booted MS-DOS. Since the image file is r/w the changes are saved to the file even after shutting down or rebooting. This is probably the easiest solution I found to accomplish what I wanted.
2) Using a real floppy diskette, boot an old computer using the floppy drive and make any wanted modifications to the floppy. Then use the rawrite2 DOS utility to write an image file of the floppy to a hard drive (e.g. rawrite2 a: c:\floppy.img). Simply reverse the process to update or write a new floppy with the latest img file. This solution is nice when dealing with a real floppy disk or for making several different image files from small successive changes to the real floppy.
3) Under Linux or BSD associate a bootable floppy image with a loop device (using losetup) and then mount the image using the proper notation with the loop option (mount -o loop). Make changes to the mounted image file (e.g. /mnt) and these will be saved as long as the file is mounted r/w. A bootable floppy image can be made from scratch by creating the appropriate sized file using mformat or dd and embedding the boot sector into the image using mformat from a known working boot sector (the first 512 bytes of any MS-DOS boot floppy). Then simply copy io.sys, msdos.sys and command.com (in that order) into the mounted image (e.g. /mnt), unmount, and you've got a bootable floppy image.
Thanks for all the initial advice!
Edited by fmbOOtfan, 03 December 2010 - 11:42 PM.
#14
Posted 04 December 2010 - 12:37 PM
JFYI, you can use grub4dos on *ANY* computer to map a bootable DOS floppy image and an "empty" floppy image and transfer whatever from the first to the second.
If your "source" does not fit in a floppy, you can use a bigger floppy size or a HD image.
Wonko
#15
Posted 05 December 2010 - 12:02 AM
Happy you found your way.
JFYI, you can use grub4dos on *ANY* computer to map a bootable DOS floppy image and an "empty" floppy image and transfer whatever from the first to the second.
If your "source" does not fit in a floppy, you can use a bigger floppy size or a HD image.
Wonko
Hi Wonko,
I saw your initial suggestion about that but wasn't exactly sure how to go about it. I'm a fan of grub4dos and use it extensively. It would be a great tool for this purpose and I imagine your suggestion involves mapping an image file to a drive with the map command and copying using dd, but I'm not sure and still learning exactly how to use dd correctly within grub4dos.
I'd be happy to see an example of how you would do this!
Cheers!
#16
Posted 05 December 2010 - 09:54 AM
The general idea is:
create two floppy images:
- dos71.ima
- empty.ima
#1 is DOS 7.1 (or Freedos) bootable floppy, containing all the files you need, let's call it build envronement.
#2 is an empty image.
Like:
find --set-root /dos71.ima map /dos71.ima (fd0) map /empty.ima (fd1) map --hook root (fd0) chainloader /io.sys boot
Now you should have a "normal" DOS environment (loaded from A:\ ) and an available "target" loaded as B:\ .
You can now Format /s the target, copy to it (or expand from compressed archive) from A:\ whatever you need, etc.
Since you are using 6.22 which is not chainloadable directly, you will need:
find --set-root /dos622.ima map /dos622.ima (fd0) map /empty.ima (fd1) map --hook root (fd0) chainloader +1 boot
instead, but not really a problem.
To create the "base" empty image you can either start form scratch, with something like fsz (part of the DSFOK ops kit):
http://members.ozema...eezip/freeware/
or simply make a copy of the "dos71.ima" or of the "dos622.ima" which you can later simply format or "00" wipe with any of the available tools.
The limit of grub4dos dd is that target must exist.
From pure DOS, you can still use the poorman's way to create files with ECHO or ECHOO.COM and a batch file or one of the apps I gave you a "hint" to before.
Wonko
#17
Posted 05 December 2010 - 10:46 AM
The general idea is:
create two floppy images:
- dos71.ima
- empty.ima
#1 is DOS 7.1 (or Freedos) bootable floppy, containing all the files you need, let's call it build envronement.
#2 is an empty image.
Like:find --set-root /dos71.ima (fd0) map /dos71.ima (fd0) map /empty.ima (fd1) map --hook root (fd0) chainloader /io.sys boot
Hi Mr Sane
I tried this but had some problems!
First, minor typo in first line (remove the (fd0))
Second, even if I add map --floppies=2 DOS seems to think drive B and A are same drive (if i format B it says it is a MIRROR drive) - could it be that it has same signature as A: - so I should not use a copy of dos622.ima as the file source for empty.ima???
lastly changes to A: or B: are not persistent
???
#18
Posted 05 December 2010 - 10:59 AM
Sure, my badFirst, minor typo in first line (remove the (fd0))
Correcting previous post.
Yep, Volume number, NOT "signature", it is possible.Second, even if I add map --floppies=2 DOS seems to think drive B and A are same drive (if i format B it says it is a MIRROR drive) - could it be that it has same signature as A: - so I should not use a copy of dos622.ima as the file source for empty.ima???
This is strange.lastly changes to A: or B: are not persistent
Which DOS are you testing?
which EXACT grub4dos version?
EDIT:
confirmed:
- DOS 7.1
- grub4dos 0.4.4 16-10-2009 (aka "current release")
No problem with same Volume label AND serial for the two floppy images.
BTW I am using as "base" a floppy with "GRLDR " in the BPB so, with reference to the other thread it seems that the "check" is not active on floppies
EDIT2:
confirmed also with "plain" Win98 floppy images.
Wonko
#19
Posted 05 December 2010 - 11:59 AM
Works fine if I boot for real!
#20
Posted 05 December 2010 - 12:20 PM
Not at all.It is Qemu Manager!
Works fine if I boot for real!
Q: WHERE do you think I do my tests?
A. On Qemu (+Qemu Manager)
Last issued command:
"D:\Qemuman7\qemu\qemu.exe" -L "D:\Qemuman7\qemu" -M "pc" -m 32 -cpu "qemu32" -vga cirrus -serial vc -parallel vc -name "DOS_Floppy" -drive "file=D:\Qemuman7\images\mhdd.raw,index=0,media=disk" -boot order=cad,menu=off -soundhw es1370 -enable-kqemu -net nic,vlan=0,macaddr=52-54-00-9F-1D-0F,model=rtl8139 -net user,vlan=0 -hwnd 249498086 -monitor telnet:127.0.0.1:60016,server,nowait -localtime
(just default settings).
mhdd.raw is DOS 7.1 bootable and contains grub.exe and a few floppy images, including the dos71.ima and empty.ima, BOTH created by simply copying a "standard" Win98SE.img.
Wonko
#21
Posted 05 December 2010 - 12:40 PM
"C:\Program Files (x86)\QemuManager\qemu\qemu.exe" -L "C:\Program Files (x86)\QemuManager\qemu" -M "pc" -m 32 -cpu "qemu32" -vga cirrus -serial vc -parallel vc -name "DOS622" -drive "file=\\.\PhysicalDrive1,index=0,media=disk" -boot order=dc,menu=off -soundhw es1370 -enable-kqemu -net nic,vlan=0,macaddr=52-54-00-F2-F8-23,model=rtl8139 -net user,vlan=0 -hwnd 263772 -monitor telnet:127.0.0.1:60007,server,nowait -localtime
My image is 6.22 from bootdisk.com
grub4dos 0.4.5a installed to MBR on USB stick.
I boot to USB stick set in Qemu Manager as //physical drive1 (I do not boot from floppy image) and run menu.lst from USB stick.
If I boot to floppy image directly (floppy image on my hard disk) then it works fine.
files on USB drive:
grldr
menu.lst
dos622.ima
empty.ima
menu.lst:
title DOS 6.22 find --set-root /dos622.ima map /dos622.ima (fd0) map /empty.ima (fd1) map --hook root (fd0) map --floppies=2 chainloader +1 boot
#22
Posted 05 December 2010 - 12:49 PM
I am not booting from floppy image, either, I am booting from a hard disk image, it should be the same than your mapping to \\.\PhysicalDrive(I do not boot from floppy image) and run menu.lst from USB stick.
If I boot to floppy image directly (floppy image on my hard disk) then it works fine.
I am not using a menu.lst, but that shuldn't make any difference.
I am not using an installed grub4dos, but rathe boot to DOS 7.1 from hd image and then run grub.exe from it - again this should be NOT a difference
Just for the record, you DO NOT need a boot command in a menu.lst entry.
It seems to me that there remains TWO variable involved (which may be connected to the difference between Qemu and "real"):
- version of grub4dos
- version of DOS
Can you try with a DOS7.1 image, such as a Win98 image and with 0.4.5a?
Can you try with a DOS7.1 image, such as a Win98 image and with 0.4.4?
Can you try with the DOS 6.22 image, and with 0.4.4?
Additionally, try with grub.exe (as opposed to installed grlsr.mbr + grldr) but I don't think it could be the culprit.
Wonko
#23
Posted 05 December 2010 - 12:55 PM
IO.SYS
COMMAND.COM
booted to it in QEMU
got C: prompt
Then did echo.>AAAAAAAA
then CTRL.C to clear buffers
then DIR
no file AAAAAAAA !!!
I think difference is I am booting to a USB \\physicaldevice - maybe this is set to readonly by default?
#24
Posted 05 December 2010 - 01:19 PM
I think difference is I am booting to a USB \\physicaldevice - maybe this is set to readonly by default?
Hmmm.
Possible, but it doesn't look like it from the docs.
It's a bit of time I used the \\.\PhysicalDrive mapping in Qemu, but I don't recall such an issue, but then again I'm getting old and forgetful, so don't count to much on what I remember.
Wonko
#25
Posted 05 December 2010 - 01:22 PM
So far, readonly=on option is used when qemu supports -device. However,
there are qemu versions which support readonly option with -drive
although they don't have support for -device.
I tried adding the ,readonly=off param to the -file line but it complained about it (guess the version I have is not patched)?
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users