Jump to content

how do CD's boot?


mattrix

Recommended Posts

Not such a stupid question.

I imagine the bios sees that it is to start a CD, locates the .img file in the [boot] directory, copies that to memory and executes it.

Is there a little program where by you boot to DOS, change to the directory that is the root of the CD files, run the program and it boots the CD files as if they were on the CD? Doesn't seem too difficult.

My situation is I have a HDD with several partitions, the first has Win98 DOS startup (eqiv of bDos, dos.sys, command.com) and I have copied an XP installer to the last partition. This installer does a bit of customizing that won't start from DOS.

 

Link to comment
Share on other sites


But there isn't a simple answer.

CD and DVD's can be "normal", floppy emulation or hard disk emulation.

The BIOS knows that the device is an optical media and chainloads sector 16 (size of sector on optical media is 2048 bytes).

The contents of that boot sector determine what happens next, it can be a "straight" bootsector loading a OS loader or system file or  more complex multibootmanager, like syslinux/isolinux or GRUB/GRUB2/grub4dos that can mount filesystems, etc. before loading the OS. 

But I don't see what the way a CD/DVD can boot has connection to "your situation" :dubbio: (which is not at all clear to me).

If the question i "can I boot from a CD image saved on hard disk as if it was a CD?" the answer is yes, depending on what (which OS) you want to boot syslinux/isolinux, GRUB2 and grub4dos are suitable[1], but you need to provide more details if you need assistance on the exact "howto".

jaclaz

[1] personally I would go for grub4dos which IMNSHO is more flexible/has more features, but it depend on the exact requirements.

 

 

Link to comment
Share on other sites

@jaclaz sorry I wasn't clear.

I want to install XP on a target machine has no floppy and no working CD drive. The installer expects the CD it came on to be booted.

I wasn't sure if loading and executing the .img file was the same as booting the CD, but I figured if it was someone would have written something to do it, but I couldn't find it. I didn't think of grub as being able to chainload the .img file.

I don't know much about grud4dos so your advse is much appreciated.

Partitions are the first has Win98 DOS startup to command.com and the last partition has the XP installer, unpacked. I can move the HDD to another computer to transfer files and create and delete partitions.

PS If I don't know how a CD boots then I don't know what I have to acheive.

But a howto would be nice too! thank you

 

Edited by mattrix
Link to comment
Share on other sites

But the target machine can boot from USB?

Or you want/need to prepare the internal hard disk in such a way that, once transferred, the XP can be installed (or it is already installed)?

Forget (for one moment) anything about the CD.

 

The actual common way to install an XP, well before USB existed, was to copy the \i386 directory off the CD and install the XP by either DOS (via WINNT.EXE) or from another booted windows (via WINNT32,exe), no need of an actual CD drive, if not to get the \i386 directory out of it.

There are/were anyway some limitations by using WINNT.EXE, connected to the OS they are booted from, type of filesystem, sizes of disks, etc.

The simplest, if you can connect that hard disk as secondary disk to a PC running  2K or XP would be running WInnt32 from it, otherwise, using a PE (1.x, aka BartPE or similar, or a later version),

https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/winnt32

 

Later ways to install an XP "directly" from a .iso image of the CD (residing on an external USB device)  were developed.

 

The same methods can be used - with some small modifications - to do the same from a .iso image resident on the internal hard disk.

https://msfn.org/board/topic/149675-install-xp-from-a-iso-file/

https://msfn.org/board/topic/137714-install-xp-from-a-ram-loaded-iso-image/

but they are anyway a complication, when compared to a "plain" WINNT32.exe setup with tempdrive, syspart and makelocalsource parameters.

jaclaz

 

 

 

Link to comment
Share on other sites

2 hours ago, mattrix said:

Partitions are the first has Win98 DOS startup to command.com and the last partition has the XP installer, unpacked. I can move the HDD to another computer to transfer files and create and delete partitions.

I think you can just run XP installer off 98 and select 'clean installation' if that's available. Make sure you move the CD files off that partition first before you do it. (I haven't done a XP installation from windows for a long time, so some of this maybe incorrect)

Link to comment
Share on other sites

The version I'm trying to install does some customisations before the XP install starts. I can manage the install using winnt.exe but the customisations are missing and I get errors trying to locate certain files. This is not a 'plain' install.

I haven't tested the USB yet. I don't know what software to use, that will run on XP. Ventoy looks good but there are reports that it fails installing XP. Several other candidates report the same.

10 hours ago, jaclaz said:

The simplest, if you can connect that hard disk as secondary disk to a PC running  2K or XP would be running WInnt32 from it,

I can connect it to another PC but I've never done an install this way. I'd be scared the install would blindly kill the host OS. Besides I would have to run setup.exe not winnt32.

Tricking it into thinking it was booted from a CD seems a good idea. I am reading the threads you pointed to.

Thank you for your help.

Link to comment
Share on other sites

No,

If you want to install from another system (meaning with the hard disk attached to another PC) you need to use WINNT.EXE or WINNT32.exe, NOT setup.exe, that is the whole point.

What happens with syspart/makelocalsource/noreboot is not an actual install, but rather the creation of the same booting situation as a normal install procedure, that will start only when you reboot on the target machine. 

There is a whole section of the board dedicated to different ways to install XP from USB, Ventoy (which is an exceptionally good software BTW) is simply not suited/tested enough for XP installs, the various methods here have been used successfully for years:

https://msfn.org/board/forum/157-install-windows-from-usb/

You will have anyway issues (that can be worked around) with:
1) drive letters assignment
2) multiboot with the existing OS

hence you need to get familiar with grub4dos, the EXACT way your disk currently boots and how (EXACTLY) it is partitioned makes a difference, as most tools/tutorials are about installing XP from USB on an "empty" disk, and your current situation cause the need to some changes/avoiding automatic settings.

jaclaz

 

 

Edited by jaclaz
Link to comment
Share on other sites

So, if I understand correctly, if I start attached to another computer, then the setup.exe in the root of the ISO will NEVER get executed?

Will winnt32.exe give me any different final result, than starting the install from DOS with winnt.exe?

The old OS is irrelevant, it is nothing more than what format /s does. I'm used to windows shenanigans with drive letters and think I can get around them. So if I install from DOS then no grub4dos is needed?

grub4dos is only needed if I am going to try and boot the install partition as if it were a CD.  Or am I missing something?

I will still look into the USB route, from the link you provided, thanks.

 

Edited by mattrix
Link to comment
Share on other sites

1 hour ago, mattrix said:

Will winnt32.exe give me any different final result, than starting the install from DOS with winnt.exe?

 

The Winnt.exe runs from DOS, this implies FAT16/32  AND NOT Ntfs (but you can convert the volume later), it will be slower in the copying of files.

Beides it misses the features of WINNT32.exe to make an "offline" install (i.e. the syspart/makelocalsource/tempdrive/noreboot/etc):

https://www.informit.com/articles/article.aspx?p=102260&seqNum=6

A "complete" howto (via USB and DOS, well before the "install XP from USB was born) is here (via Wayback Machine):

https://web.archive.org/web/20160417164143/http://www.911cd.net/forums//index.php?showtopic=16713

What happens when you run Winnt.exe (or Winnt32.exe) is basically:
1) the creation on the active, primary partition of the disk of the (temporary) folders:
$WIN_NT$.~BT
$WIN_NT$.~LS
2) the writing of a Disk signature (if there isn't already one)
3) the writing or updating of the MBR boot code
4) the writing or updating of the PBR boot code
5) the creation of a (temporary) BOOT.INI and the copying of NTLDR+NTDETECT.COM in the root of the volume

At next reboot the files in $WIN_NT$.~BT will be used to boot and the ones in $WIN_NT$.~LS will be used to install.

At next reboot the system will actually be installed and the temporary files/folders deleted.

1 hour ago, mattrix said:

The old OS is irrelevant, it is nothing more than what format /s does. I'm used to windows shenanigans with drive letters and think I can get around them. So if I install from DOS then no grub4dos is needed?

Unless I am going to try and boot the install partition as if it were a CD.  Or am I missing something?

Yes and no, drive lettering during the install is not that easy to manage, and it is (slightly) different from when the OS is already installed.

Search for "migrate.inf", you might need to use it.

Besides, you need to be familiar with arcpaths, as - again it depends on the EXACT method and devices involved - there may be the need to change paths in BOOT.INI or txtsetup.sif.

Using grub4dos re-mapping features, most of these issue can be worked around, but it is not the "only" way to deal with (possible, but not necessarily happening) issues with booting and/or drive lettering.

jaclaz

 

Link to comment
Share on other sites

Oh, I can see now why you recommend grub4dos so strongly.

I've got a lot of reading ahead of me. Mostly your links, thankyou for pointing me in the right direction.

Edited by mattrix
Link to comment
Share on other sites

If I unpack an ISO into a partition, there is a [BOOT] directory and inside that a boot.img file. So, if I chainload that file and then boot, will things start running the same as if the CD had been booted?

Can I use the grub4dos environment provided by the USB to do this? Or does grub4dos need to start from the same disk that holds the install files? Can I start the grub4dos environment from DOS after DOS has booted?

When does windows drive lettering become significant? Surely the install is written allowing the CD drive letter to change, for example it would move one letter if windows install created a partition to install to. However the from DOS setup seems to use the DOS lettering to locate the source files, so you need to make sure that the DOS lettering matches the windows lettering.
 

Link to comment
Share on other sites

5 hours ago, mattrix said:

If I unpack an ISO into a partition, there is a [BOOT] directory and inside that a boot.img file. So, if I chainload that file and then boot, will things start running the same as if the CD had been booted?

NO. NO. NO.

Meaning:

NO, there is NO [BOOT] directory on a CD/ISO (but 7-zip will "render" the contents like that),
NO, the boot.img may be a no-emulation boot image or a floppy (or superfloppy) emulation one (or even, in some cases, a hd emulation one)
NO, you cannot chainload that image "by itself".

When you do:

map /mynice.iso (0xff)
map --hook
chainloader (0xff)

you are doing exactly that (chainloading what you see as /[BOOT]/boot.img in 7-zip), but you are doing that "correctly", i.e. in context.

The whole point that you are ignoring is the concept of HAL.

Any NT based system has this intermediate layer (Hardware Abstraction Layer) between a device and the OS.

For each and every device that the BIOS "declares" (no matter if real or virtual) the (in the case of XP) NTDETECT.COM, check it and connects it to the booting OS through a driver.
In the case of a "real" device, the driver is automatically loaded (and thus the device is accessible to the OS) in most cases.
In the case of a "virtual" device the driver is not built-in AND there must be a way to have it "hook" the device presented by BIOS, hence in the given threads either Firadisk or Winvblock drivers are used (these are drivers that can read info from the grubdos settings, one way or the other) OR - if the virtual cd is not the boot device, it is mounted later by using a more normal virtual CD/image driver (such as - commonly - IMDISK).

The point is not (or not only) about drive letter assignment, but rather with having *something* to which a drive letter can be assigned.

jaclaz

 

Link to comment
Share on other sites

2 hours ago, mattrix said:

OK.

I only know what my tools tell me. was just a thought. 

Thanks

matt

Yep :) but your tools may be deceiving :w00t:.

7-zip is basically an archive compressor and file manager (and exceptionally good at those  :thumbup) but it (necessarily and understandably) uses some simplifications in the way it shows data.

If you want to actually see what is in the .iso you need other tools, namely, short of an hex editor, ISOBUSTER (the free version is enough):

https://www.isobuster.com/license-models.php

Back to the topic, specifically, what 7-zip renders as /[BOOT]/boot.img on a XP install CD is what is generally called "Microsoft Corporation.img", it is a no-emulation bootsector, 2048 bytes in size, containing code not entirely unlike the MBR or PBR code that does two things:
1) invokes /I386/BOOTFIX.BIN <- the thing that prompts "press any key to boot from CD"
2) loads /I386/SETUPLDR.BIN

 In grub4dos, this is in practice the same:

map /mynice.iso (0xff)
map --hook
root (0xff)
chainloader /I386/setupldr.bin 

jaclaz

Edited by jaclaz
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...