joncampbell123 / dosbox-x

DOSBox-X fork of the DOSBox project
GNU General Public License v2.0
2.65k stars 376 forks source link

Booting from CD-ROM #182

Open crawlingChaos opened 8 years ago

crawlingChaos commented 8 years ago

Is this currently possible?

I would be interested in working on this if it is not.

joncampbell123 commented 8 years ago

Do you mean El Torito booting?

DOSBox-X already implements an El Torito parser and currently supports the "emulation mode" (using CD-ROM to emulate a bootable floppy). I haven't yet implemented non-emulation booting or HDD emulation mode.

crawlingChaos commented 8 years ago

Yes, I hadn't noticed that it was already supported. Good show.

crawlingChaos commented 8 years ago

Tried booting a Windows 98 iso today and couldn't get anywhere. I know the iso is valid, uses floppy emulation, and it boots fine in kvm.

Steps to reproduce:

imgmount d -t iso ~/Win98.iso -ide 2m imgmount a ~/Win98.iso boot ~/Win98.iso -l a

I get the message: PROGRAM_BOOT_UNABLE

...also tried: imgmount d -t iso ~/Win98.iso -ide 2m imgmount 0 -fs none ~/Win98.iso -el-torito D

This mounts ok, but I have no idea how to boot it.

I tried looking through the code, but the code for the various DOS programs, e.g. imgmount and boot, is a nightmare as everything is just one giant string of if/else statments. Horrifying.

joncampbell123 commented 8 years ago

You got it mostly right. After imgmount 0 you need to boot drive A.

I'll run through a Windows 98 install ISO on my end to make sure it works.

crawlingChaos commented 8 years ago

I couldn't figure out how to get the boot command to work without specifying an image file:

boot ~/Win98.iso -l a

didn't work.

joncampbell123 commented 8 years ago

after imgmounting the -el-torito partition of the ISO, try:

boot -l a

Don't give "boot" the ISO image, just tell it to boot the disk image you imgmounted from the el-torito section of the CD-ROM drive.

crawlingChaos commented 8 years ago

boot -l a

That worked, thanks. Weird, I was certain I'd tried that.

aybe commented 6 years ago

TODO add to FAQ and close

rogergithubbing commented 4 years ago

Hello,... After mounting my iso image with: imgmount 0 -fs none my_bootcd.iso -el-torito D

I get: "-el-torito CD-ROM drive specified is not actually a CD-ROM drive"

I've tried LOTS of different iso bootable images: windows 98, hirens boot cd , ultimate boot cd... none of them work, I'm exhausted.

If I continue, and I type "boot -l a", dosbox-x shows me another error (it was expected, of course):

"Unable to boot off of drive A"

What can I do to boot from a iso-bootable cd image ?

Thanks

joncampbell123 commented 4 years ago

You need to mount the ISO to a drive letter first like a normal CD-ROM, then imgmount to a floppy drive with the --el-torito option that refers to the CD-ROM drive letter, then boot the floppy drive.

El Torito booting so far only supports the floppy emulation mode.

Torinde commented 1 year ago

El Torito specification (got link from here)

joncampbell123 commented 1 year ago

El Torito specification (got link from here)

I use a copy i put on Hackipedia here: http://hackipedia.org/browse.cgi/Computer/Platform/PC%2c%20IBM%20compatible/BIOS/Boot/CDROM%2c%20El%20Torito

maxpat78 commented 9 months ago

@Torinde @joncampbell123 Things are in fact more complicated than it seems.

Some notes.

NT bootable CD-ROMs with "No Emulation" El Torito boot sectors have the bootstrap code in 7C00H as usual, and then perform INT13:42H calls to load the CD root directory sectors and search for NTLDR and/or I386\SETUPLDR.BIN.

I've tried a patch to DosBox-X BOOT and INT13:42H handler, and got the Win2K SETUPLDR.BIN loaded: but Setup locks at disk detection phase due to INT13:15H problems.

More in general, DOSBox-X maintain two different arrays of mounted images (imageDiskList[] and Drives[]) and, since a CD-ROM is in the latter only, every time something has to check for CD presence, it has also to examine both.

Actually, I don't know if and how perform such changes to code, since I haven't a general perspective on DOSBox-X deep functioning.

Torinde commented 9 months ago

Will adding "HDD emulation" mode first help in some way (learning-wise maybe)? Maybe you can check how the current "FDD emulation" is structured and change it from 00H to 80H? For testing - Rufus supports that mode.

From Wikipedia: "For modern computers the "no emulation" mode is generally the more reliable method. The BIOS will assign a BIOS drive number to the CD drive. The drive number (for INT 13H) assigned is any of 80hex (hard disk emulation), 00hex (floppy disk emulation) or an arbitrary number if the BIOS should not provide emulation."

maxpat78 commented 9 months ago

@Torinde you can try to compile and run my branch https://github.com/maxpat78/dosbox-x/tree/eltorito_noemul.

I've tested it with NT4 CD-ROM, and it ends with a "Can't find txtsetup.sif" error, probable symptom that SETUPLDR.BIN can't access the CD-ROM in the proper way (I've slighly changed my previous code to avoid the aforementioned INT15H problems and get to such point): image

maxpat78 commented 9 months ago

Developer notes

Under Bochs debugger, SETUPLDR is found calling INT 13:4B01h ("get El Torito CD-ROM emulation status") at some point (i.e. after INT13:42h has been called to load 7 sectors); DOSBox-X never reaches that code, instead, since INT13_DiskHandler is never called with AH=4B. Reason unknown.

Obviously, Bochs succeeds. And it seems Bochs never calls other special functions (AH=4A or AH=4C, I mean), so DOSBox-X should reach that code, too!

Look at cdrom_boot: fixed structures needed in BIOS area?

FreeDOS Live CD boots with minimal changes to my previous code (55 AA magic word is not checked by BS).

Torinde commented 9 months ago

@maxpat78, can you please create a release or artifact for Windows?