Page 1 of 2
Are CD Sectors the same as Disk Sectors?
Posted: Mon Jun 24, 2013 12:06 am
by tsdnz
Hi Guys, I am approaching my OS boot records slightly different.
Can someone tell me if the CD boots from sector 0.
And if so does someone have code in windows to write directly to the sectors?
Regards, Alistair
Re: Are CD Sectors the same as Disk Sectors?
Posted: Mon Jun 24, 2013 12:11 am
by iansjack
Re: Are CD Sectors the same as Disk Sectors?
Posted: Mon Jun 24, 2013 12:34 am
by tsdnz
Thanks, a bit of a silly question. I will create another post with a better question.
Re: Are CD Sectors the same as Disk Sectors?
Posted: Wed Jun 26, 2013 5:09 pm
by Casm
Somebody else has posted a very similar question to this. The answer is that CD sectors are 2048 bytes, and there is no boot sector. The job of the boot sector on a hard disk consists of not much more than getting a second stage loader into memory. In the case of CDs, that second stage loader is loaded directly by the BIOS. The structures which allow the BIOS to identify the file to load are a bit complicated to program yourself, and it is easier to use a utility program like mkisofs on Linux, or a (not free) program like Power ISO with Windows.
Re: Are CD Sectors the same as Disk Sectors?
Posted: Thu Jun 27, 2013 1:24 am
by Yoda
Actually, there is boot sector for ISO-9660 file system no emulation mode in CD-ROM image. But it is not in the particular fixed location and you can't incorporate it to the image after its creation (at least this is not a simple task). The boot sector must be prepared in advance and put onto the image when you prepare image. Read ISO-9660 documentation and El Torito specifications.
Re: Are CD Sectors the same as Disk Sectors?
Posted: Thu Jun 27, 2013 7:24 am
by Casm
Yoda wrote:Actually, there is boot sector for ISO-9660 file system no emulation mode in CD-ROM image. But it is not in the particular fixed location and you can't incorporate it to the image after its creation (at least this is not a simple task). The boot sector must be prepared in advance and put onto the image when you prepare image. Read ISO-9660 documentation and El Torito specifications.
I have read the El Torito specification, and although the first 16 sectors of the ISO-9660 file system were in theory reserved for boot code, they have never been used for that purpose.
Re: Are CD Sectors the same as Disk Sectors?
Posted: Thu Jun 27, 2013 9:55 am
by Combuster
and although the first 16 sectors of the ISO-9660 file system were in theory reserved for boot code, they have never been used for that purpose.
They have, just not on x86. PA-RISC does it for example.
Re: Are CD Sectors the same as Disk Sectors?
Posted: Thu Jun 27, 2013 10:23 am
by Brynet-Inc
Linux distributions have started abusing the reserved area at the start of an ISO-9660 filesystem to implement hybrid images that can be written to USB flash drives, I'm not sure of the details but the gist of it is a special MBR is stuffed in the first 512 bytes.. which either parses the ISO-9660 filesystem, or has a sector number hardcoded for the second stage bootloader.
It's annoying though because people have started assuming that any ISO image can be written to a USB flash drive and booted, which is obviously not true.
Re: Are CD Sectors the same as Disk Sectors?
Posted: Thu Jun 27, 2013 11:25 am
by Casm
Brynet-Inc wrote:Linux distributions have started abusing the reserved area at the start of an ISO-9660 filesystem to implement hybrid images that can be written to USB flash drives, I'm not sure of the details but the gist of it is a special MBR is stuffed in the first 512 bytes.. which either parses the ISO-9660 filesystem, or has a sector number hardcoded for the second stage bootloader.
It's annoying though because people have started assuming that any ISO image can be written to a USB flash drive and booted, which is obviously not true.
I can't remember what Apple uses the reserved sectors for, but it isn't boot code.
Re: Are CD Sectors the same as Disk Sectors?
Posted: Fri Jun 28, 2013 5:35 am
by egos
Casm wrote:In the case of CDs, that second stage loader is loaded directly by the BIOS.
We call it a first stage boot loader because usually it has small size (2-4 kb) and it is used to load second stage boot loader.
I can't remember what Apple uses the reserved sectors for, but it isn't boot code.
Usually it uses HFS+/ISO9660 hybrid. And if HFS wrapper was applied then boot blocks (1st kb) can contain boot code.
Re: Are CD Sectors the same as Disk Sectors?
Posted: Fri Jun 28, 2013 9:44 am
by Casm
egos wrote:We call it a first stage boot loader because usually it has small size (2-4 kb) and it is used to load second stage boot loader.
You can call it whatever you like, but it is not a boot sector. It is an ordinary file; albeit a hidden one - and you could make it the one and only stage if you wanted to.
Re: Are CD Sectors the same as Disk Sectors?
Posted: Fri Jun 28, 2013 9:50 am
by egos
Casm wrote:You can call it whatever you like, but it is not a boot sector. It is an ordinary file; albeit a hidden one
You are mistaken. Read the Spec. again.
Re: Are CD Sectors the same as Disk Sectors?
Posted: Fri Jun 28, 2013 10:08 am
by Casm
egos wrote:You are mistaken. Read the Spec. again.
"The El Torito specification allows for the loading of FFFF sectors"
That is not a boot sector. It is a complete program - larger than MS-DOS programs used to be. Since all files on a CD are contiguous, it doesn't even have that to make it different.
Re: Are CD Sectors the same as Disk Sectors?
Posted: Fri Jun 28, 2013 12:55 pm
by egos
All right, it is not one but a few sectors. Although, for example, MS can call 3-sector boot record a boot sector. We call ISO boot image (I mean boot record) a boot sector because our ISO boot loaders (and many others) occupy only one physical sector (4 emulated sectors). Anyway it is not a file. And I was saying about destination (first stage boot loader), not about location (boot sector).
Re: Are CD Sectors the same as Disk Sectors?
Posted: Fri Jun 28, 2013 1:37 pm
by Casm
egos wrote:All right, it is not one but a few sectors.
The Windows kernel is smaller than that.