Hello Listers, Recently there was a bit of discussion on HFS-Wrappers on the hfs-user mailing list and how it allows a computer with HFS (but no HFS Plus support) to start up or display a ReadMe to the user to improve the user-experience. The tech. notes (TN 1150: HFS Plus Volume Format) says that the HFS wrapper volume contains five files in the root folder - a ReadMe, System and Finder, Desktop DB and Desktop DF.
I'm a third-party developer creating an HFS-Plus volume (non-bootable) interested in extending the functionality of my HFS-Plus volume to include a Wrapper as well. I want to know whether:
1) these 5 files are actually necessary or it would suffice if only the ReadMe is present ? 2) would this mean that the Desktop DB and DF files would be present twice (on an Apple-initialized volume) ? - once in the HFS-Wrapper and once in the HFS-Plus catalog ? 3) is there any documentation from Apple which describes how this ReadMe file is stored up in the Wrapper's catalog (I gathered it's not hidden) in order to function as expected ?... reverse-engineering can be painful sometimes.. 4) are the contents of the ReadMe file fixed or could I write anything I want into it ?
Would be glad of any tips/suggestions ! -Nandini
***Every day is a new beginning..a brand new start, to bring joy and fulfilment to the sad and weary heart***
1. You'll probably need at least 3: the ReadMe (or whatever file you like to have shown) and the Desktop DB and Desktop DF. The latter two are there to make the Finder happy; if they're not present the Finder will try to create them and will end up creating them somewhere in the bowels of whatever system happens to be running because they can't be created on the read-only disk. The wrapper also has no space available, typically. Altogether much better to have a skeleton Desktop DB and Desktop DF there. You can copy them from any freshly initialized HFS floppy: the Desktop DB will have a few blocks of valid data in a small file, the Desktop DF file should be zero length in all likelihood.
I'm not entirely sure why the System and Finder files are there; they might be there to placate simple-minded software that checks for them when deciding whether the volume is potentially bootable. If your wrapped HFS+ volume is unbootable anyway, I bet you can get away without them.
2. Yes, there are two completely unrelated sets of Desktop DB and Desktop DF files. The ones in the wrapper are ordinarily ignored because it's the "wrapped" HFS+ volume that's actually mounted. The ones in the wrapper can be empty - their content is largely irrelevant.
3. The ReadMe file is stored as an ordinary file on a plain HFS volume. Nothing special (that's the whole point - it's there for the consumption of systems that only know about HFS).
4. You can not only write anything you like in the ReadMe file, you can call the file anything you want, have anything else you want besides (wanna throw in a QuickTime movie of yourself? No problem!). It's strictly cosmetic, solely for the benefit of the poor human who suddenly can't find the hard drive's contents on this system.
The most interesting part of the wrapper volume is the pointer to the HFS+ volume embedded. I believe the blocks used by the HFS+ volume are usually specified as used up by the "Bad block" file on the wrapper volume, so the wrapper volume looks like a large volume with a few files, no free space, and a ton of bad blocks.
Hope that helps, -Pat Dirks.
On Wednesday, May 1, 2002, at 11:46 PM, Entwicklung wrote:
Hello Listers, Recently there was a bit of discussion on HFS-Wrappers on the hfs-user mailing list and how it allows a computer with HFS (but no HFS Plus support) to start up or display a ReadMe to the user to improve the user-experience. The tech. notes (TN 1150: HFS Plus Volume Format) says that the HFS wrapper volume contains five files in the root folder - a ReadMe, System and Finder, Desktop DB and Desktop DF. I'm a third-party developer creating an HFS-Plus volume (non-bootable) interested in extending the functionality of my HFS-Plus volume to include a Wrapper as well. I want to know whether: 1) these 5 files are actually necessary or it would suffice if only the ReadMe is present ? 2) would this mean that the Desktop DB and DF files would be present twice (on an Apple-initialized volume) ? - once in the HFS-Wrapper and once in the HFS-Plus catalog ? 3) is there any documentation from Apple which describes how this ReadMe file is stored up in the Wrapper's catalog (I gathered it's not hidden) in order to function as expected ?... reverse-engineering can be painful sometimes.. 4) are the contents of the ReadMe file fixed or could I write anything I want into it ? Would be glad of any tips/suggestions ! -Nandini ***Every day is a new beginning..a brand new start, to bring joy and fulfilment to the sad and weary heart***
Thanks for the reply ! Regarding 'bad blocks' - I haven't really marked any 'bad blocks' until now and am not too sure I know how it is done... will have to read up on that. Any idea what happens if I don't mark the blocks of the embedded volume as 'bad blocks' but just mark them as allocated in the allocation bitmap of the HFS-Wrapper ? Could this be a potential cause of any problems ?
TIA, Nandini
***Every day is a new beginning..a brand new start, to bring joy and fulfilment to the sad and weary heart***
----- Original Message ----- From: Patrick Dirks To: Entwicklung Cc: darwin-development@lists.apple.com ; studentdev@lists.apple.com ; hfs-user@lists.mars.org Sent: Thursday, May 02, 2002 9:13 AM Subject: Re: [hfs-user] HFS-Plus and Wrappers
1. You'll probably need at least 3: the ReadMe (or whatever file you like to have shown) and the Desktop DB and Desktop DF. The latter two are there to make the Finder happy; if they're not present the Finder will try to create them and will end up creating them somewhere in the bowels of whatever system happens to be running because they can't be created on the read-only disk. The wrapper also has no space available, typically. Altogether much better to have a skeleton Desktop DB and Desktop DF there. You can copy them from any freshly initialized HFS floppy: the Desktop DB will have a few blocks of valid data in a small file, the Desktop DF file should be zero length in all likelihood.
I'm not entirely sure why the System and Finder files are there; they might be there to placate simple-minded software that checks for them when deciding whether the volume is potentially bootable. If your wrapped HFS+ volume is unbootable anyway, I bet you can get away without them.
2. Yes, there are two completely unrelated sets of Desktop DB and Desktop DF files. The ones in the wrapper are ordinarily ignored because it's the "wrapped" HFS+ volume that's actually mounted. The ones in the wrapper can be empty - their content is largely irrelevant.
3. The ReadMe file is stored as an ordinary file on a plain HFS volume. Nothing special (that's the whole point - it's there for the consumption of systems that only know about HFS).
4. You can not only write anything you like in the ReadMe file, you can call the file anything you want, have anything else you want besides (wanna throw in a QuickTime movie of yourself? No problem!). It's strictly cosmetic, solely for the benefit of the poor human who suddenly can't find the hard drive's contents on this system.
The most interesting part of the wrapper volume is the pointer to the HFS+ volume embedded. I believe the blocks used by the HFS+ volume are usually specified as used up by the "Bad block" file on the wrapper volume, so the wrapper volume looks like a large volume with a few files, no free space, and a ton of bad blocks.
Hope that helps, -Pat Dirks.
On Wednesday, May 1, 2002, at 11:46 PM, Entwicklung wrote:
Hello Listers, Recently there was a bit of discussion on HFS-Wrappers on the hfs-user mailing list and how it allows a computer with HFS (but no HFS Plus support) to start up or display a ReadMe to the user to improve the user-experience. The tech. notes (TN 1150: HFS Plus Volume Format) says that the HFS wrapper volume contains five files in the root folder - a ReadMe, System and Finder, Desktop DB and Desktop DF.
I'm a third-party developer creating an HFS-Plus volume (non-bootable) interested in extending the functionality of my HFS-Plus volume to include a Wrapper as well. I want to know whether:
1) these 5 files are actually necessary or it would suffice if only the ReadMe is present ? 2) would this mean that the Desktop DB and DF files would be present twice (on an Apple-initialized volume) ? - once in the HFS-Wrapper and once in the HFS-Plus catalog ? 3) is there any documentation from Apple which describes how this ReadMe file is stored up in the Wrapper's catalog (I gathered it's not hidden) in order to function as expected ?... reverse-engineering can be painful sometimes.. 4) are the contents of the ReadMe file fixed or could I write anything I want into it ?
Would be glad of any tips/suggestions ! -Nandini
***Every day is a new beginning..a brand new start, to bring joy and fulfilment to the sad and weary heart***
Only if you let some Disk Utility loose on it and it figures out those blocks aren't supposed to be marked in use because they're not claimed by any file...
Why don't you look at a freshly initialized HFS+ volume to see what all this is supposed to look like. See if you can account for every bit set on the volume - should be an interesting exercise!
-Pat.
On Thursday, May 2, 2002, at 12:13 AM, Entwicklung wrote:
Thanks for the reply ! Regarding 'bad blocks' - I haven't really marked any 'bad blocks' until now and am not too sure I know how it is done... will have to read up on that. Any idea what happens if I don't mark the blocks of the embedded volume as 'bad blocks' but just mark them as allocated in the allocation bitmap of the HFS-Wrapper ? Could this be a potential cause of any problems ? TIA, Nandini ***Every day is a new beginning..a brand new start, to bring joy and fulfilment to the sad and weary heart***
----- Original Message ----- From: Patrick Dirks To: Entwicklung Cc: darwin-development@lists.apple.com ; studentdev@lists.apple.com ; hfs-user@lists.mars.org Sent: Thursday, May 02, 2002 9:13 AM Subject: Re: [hfs-user] HFS-Plus and Wrappers
- You'll probably need at least 3: the ReadMe (or whatever file you like to have shown) and the Desktop DB and Desktop DF. The latter two are there to make the Finder happy; if they're not present the Finder will try to create them and will end up creating them somewhere in the bowels of whatever system happens to be running because they can't be created on the read-only disk. The wrapper also has no space available, typically. Altogether much better to have a skeleton Desktop DB and Desktop DF there. You can copy them from any freshly initialized HFS floppy: the Desktop DB will have a few blocks of valid data in a small file, the Desktop DF file should be zero length in all likelihood.
I'm not entirely sure why the System and Finder files are there; they might be there to placate simple-minded software that checks for them when deciding whether the volume is potentially bootable. If your wrapped HFS+ volume is unbootable anyway, I bet you can get away without them.
Yes, there are two completely unrelated sets of Desktop DB and Desktop DF files. The ones in the wrapper are ordinarily ignored because it's the "wrapped" HFS+ volume that's actually mounted. The ones in the wrapper can be empty - their content is largely irrelevant.
The ReadMe file is stored as an ordinary file on a plain HFS volume. Nothing special (that's the whole point - it's there for the consumption of systems that only know about HFS).
You can not only write anything you like in the ReadMe file, you can call the file anything you want, have anything else you want besides (wanna throw in a QuickTime movie of yourself? No problem!). It's strictly cosmetic, solely for the benefit of the poor human who suddenly can't find the hard drive's contents on this system.
The most interesting part of the wrapper volume is the pointer to the HFS+ volume embedded. I believe the blocks used by the HFS+ volume are usually specified as used up by the "Bad block" file on the wrapper volume, so the wrapper volume looks like a large volume with a few files, no free space, and a ton of bad blocks.
Hope that helps, -Pat Dirks.
On Wednesday, May 1, 2002, at 11:46 PM, Entwicklung wrote:
Hello Listers, Recently there was a bit of discussion on HFS-Wrappers on the hfs-user mailing list and how it allows a computer with HFS (but no HFS Plus support) to start up or display a ReadMe to the user to improve the user-experience. The tech. notes (TN 1150: HFS Plus Volume Format) says that the HFS wrapper volume contains five files in the root folder - a ReadMe, System and Finder, Desktop DB and Desktop DF. I'm a third-party developer creating an HFS-Plus volume (non-bootable) interested in extending the functionality of my HFS-Plus volume to include a Wrapper as well. I want to know whether: 1) these 5 files are actually necessary or it would suffice if only the ReadMe is present ? 2) would this mean that the Desktop DB and DF files would be present twice (on an Apple-initialized volume) ? - once in the HFS-Wrapper and once in the HFS-Plus catalog ? 3) is there any documentation from Apple which describes how this ReadMe file is stored up in the Wrapper's catalog (I gathered it's not hidden) in order to function as expected ?... reverse-engineering can be painful sometimes.. 4) are the contents of the ReadMe file fixed or could I write anything I want into it ? Would be glad of any tips/suggestions ! -Nandini ***Every day is a new beginning..a brand new start, to bring joy and fulfilment to the sad and weary heart***
On Thursday, May 2, 2002, at 12:13 AM, Entwicklung wrote:
Regarding 'bad blocks' - I haven't really marked any 'bad blocks' until now and am not too sure I know how it is done... will have to read up on that.
You create one or more records in the Extents Overflow B-tree for file ID 5 (kHFSBadBlockFileID), fork 0 (i.e. the data fork). Since there is no entry for the bad blocks "file" in either the MDB or catalog, the first record would have its startBlock set to 0 (i.e. offset of 0 blocks into the "file"). If you need other discontiguous bad block extents, you would create additional records.
Any idea what happens if I don't mark the blocks of the embedded volume as 'bad blocks' but just mark them as allocated in the allocation bitmap of the HFS-Wrapper ? Could this be a potential cause of any problems ?
It might confuse older disk repair utilities that only see the wrapper, or are trying to repair the wrapper as a plain HFS volume. For read-only media, it probably isn't a serious problem. For writable media, you would run the risk of having such a utility "repair" the bitmap by unsetting the bits for the embedded volume, and potentially overwriting part of the embedded volume when writing to the wrapper.
-Mark
(I will probably get rejected from the lists I'm not on. If you are on multiple lists, please forward as appropriate)
On Thursday, May 2, 2002, at 02:46 AM, Entwicklung wrote:
Recently there was a bit of discussion on HFS-Wrappers on
the hfs-user mailing list and how it allows a computer with HFS (but no HFS Plus support) to start up or display a ReadMe to the user to improve the user-experience.
The HFS Wrapper is used to boot various Mac OS's on Old World machines. It serves no purpose on New World machines (except people with Dual G4's running Mac OS 7, probably ;-) ) More info below
The tech. notes (TN 1150: HFS Plus Volume Format) says that the HFS wrapper volume contains five files in the root folder - a ReadMe, System and Finder, Desktop DB and Desktop DF.
Contains is probably a strong word. It happens to contain the above files. The System file is needed for Old World booting. The Finder is probably there to present a cohesive "System Folder" to old Mac OS's, in case they start freaking out because of a straw System file. For Mac OS X-created wrappers, the Finder file is 0 bytes (in data and resource forks) with the correct type/creator (FNDR/MACS).
I'm a third-party developer creating an HFS-Plus volume (non-bootable) interested in extending the functionality of my HFS-Plus volume to include a Wrapper as well. I want to know whether:
Unfortunately, a wrapper alone will not get you close to bootability for Old World machines. For OS 9 (both old and new world), you will need to also set the boot blocks (the first 1KB of the filesystem). For Mac OS X, you would be set.
- is there any documentation from Apple which describes how this ReadMe file
is stored up in the Wrapper's catalog (I gathered it's not hidden) in order to function as expected ?... reverse-engineering can be painful sometimes..
It's just a file. You might learn a lot be reading the code for newfs_hfs in the diskdev_cmds project of Darwin. It shows how it creates the readme (the text is statically compiled into the newfs_hfs binary).
You might also be interested in checking out the bless-2 tag of the bless project from Dariwn CVS. In particular, look at bless/libbless/HFSWrapper/BLMountHFSWrapper.c and friends, which are basically abstractions that read the MDB, toggle the mdb->drEmbedSigWord to be kHFSSigWord, and writes it back out. Subsequent mounts of the volume will end up actually mounting the wrapper. Coming soon to an OS near you will be the capability of mounting the wrapper as part of mount_hfs, which will require new diskdev_cmds and xnu builds.
So, what is the System file doing there, and what does it do?
No Old World machine shipped with the ability to parse HFS+ volumes. However, Mac OS 8.6 (?) and later could boot from HFS+. How was that possible? Basically, the Mac OS ROM (which lived in actual ROM) would see the boot volume and find this HFS Wrapper thingy, which looked like an ordinary HFS volume. It would load the System file at that point, however, the System file in the wrapper is not a full OS System. It's just enough of a stub to add code to provide a bare-bones, read-only HFS+ implementation. This would go into the embedded HFS+ volume, read the HFS+ Volume Header and catalog, find the blessed folder, navigate to it, and load up the real System file. The real system file has the full-fledged read-write HFS+ volume code, at which point the OS can start it's thing. For Old World machines, if you want it to run OS 9, you need a wrapper, and unless you know better, use the apple-provided stub system file (licensing withstanding. I don't know those issues).
Does this apply to OS X/Darwin? To some extent yes. Apple Install CDs (Both commercial Mac OS X and the Darwin 1.4.1 distribution) have custom system files in the wrapper that patch Open Firmware to teach it how to boot Mac OS X and trigger a reboot. This is essentially how you can hold 'C' on an Old World machine and get it to boot a Mac OS X CD. The patches are similar (identical?) to the ones used to boot A/UX, and essentially tell Open Firmware to look in the partition map for disk block offsets containing executable code that should be used in the bootstrapping of the OS. After this code is loaded the booting process is pretty similar between old world and new world.
Do you need this System file to boot Mac OS X on Old World computers? strictly no, if they have already been patched. But if PRAM is zapped for some reason, you might want your volume to repatch OF.
Shantonu
At 8:46 AM +0200 5/2/02, Entwicklung wrote:
I'm a third-party developer creating an HFS-Plus volume (non-bootable) interested in extending the functionality of my HFS-Plus volume to include a Wrapper as well. I want to know whether:
Are you programatically creating the filesystem yourself? If so, Patrick and Shantonu gave you a good start worth of info.
But if so, why? Wouldn't it be easier just to run newfs_hfs?
-pmb
Are you programatically creating the filesystem yourself?
Yes.
If so, Patrick and Shantonu gave you a good start worth of info.
Yes..Patrick and Shantonu : Thanks for the tips !
But if so, why? Wouldn't it be easier just to run newfs_hfs?
Probably - but my project has to do with studying various FS-formats, implementing them 'optimally' (however fuzzy the term may be :)) and comparing them - that's why.
-Nandini