Are CD Sectors the same as Disk Sectors?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
tsdnz
Member
Member
Posts: 333
Joined: Sun Jun 16, 2013 4:09 am

Are CD Sectors the same as Disk Sectors?

Post 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
User avatar
iansjack
Member
Member
Posts: 4711
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Are CD Sectors the same as Disk Sectors?

Post by iansjack »

tsdnz
Member
Member
Posts: 333
Joined: Sun Jun 16, 2013 4:09 am

Re: Are CD Sectors the same as Disk Sectors?

Post by tsdnz »

Thanks, a bit of a silly question. I will create another post with a better question.
Casm
Member
Member
Posts: 221
Joined: Sun Oct 17, 2010 2:21 pm
Location: United Kingdom

Re: Are CD Sectors the same as Disk Sectors?

Post 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.
User avatar
Yoda
Member
Member
Posts: 255
Joined: Tue Mar 09, 2010 8:57 am
Location: Moscow, Russia

Re: Are CD Sectors the same as Disk Sectors?

Post 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.
Yet Other Developer of Architecture.
OS Boot Tools.
Russian national OSDev forum.
Casm
Member
Member
Posts: 221
Joined: Sun Oct 17, 2010 2:21 pm
Location: United Kingdom

Re: Are CD Sectors the same as Disk Sectors?

Post 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.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: Are CD Sectors the same as Disk Sectors?

Post 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.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Re: Are CD Sectors the same as Disk Sectors?

Post 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.
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
Casm
Member
Member
Posts: 221
Joined: Sun Oct 17, 2010 2:21 pm
Location: United Kingdom

Re: Are CD Sectors the same as Disk Sectors?

Post 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.
egos
Member
Member
Posts: 612
Joined: Fri Nov 16, 2007 1:59 pm

Re: Are CD Sectors the same as Disk Sectors?

Post 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.
If you have seen bad English in my words, tell me what's wrong, please.
Casm
Member
Member
Posts: 221
Joined: Sun Oct 17, 2010 2:21 pm
Location: United Kingdom

Re: Are CD Sectors the same as Disk Sectors?

Post 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.
egos
Member
Member
Posts: 612
Joined: Fri Nov 16, 2007 1:59 pm

Re: Are CD Sectors the same as Disk Sectors?

Post 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.
If you have seen bad English in my words, tell me what's wrong, please.
Casm
Member
Member
Posts: 221
Joined: Sun Oct 17, 2010 2:21 pm
Location: United Kingdom

Re: Are CD Sectors the same as Disk Sectors?

Post 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.
egos
Member
Member
Posts: 612
Joined: Fri Nov 16, 2007 1:59 pm

Re: Are CD Sectors the same as Disk Sectors?

Post 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).
If you have seen bad English in my words, tell me what's wrong, please.
Casm
Member
Member
Posts: 221
Joined: Sun Oct 17, 2010 2:21 pm
Location: United Kingdom

Re: Are CD Sectors the same as Disk Sectors?

Post by Casm »

egos wrote:All right, it is not one but a few sectors.
The Windows kernel is smaller than that.
Post Reply