PDA

View Full Version : Creating VERY Custom Install CD's


diamondsw
Dec 17, 2001, 02:18 AM
After many days of customizing, fiddling, troubleshooting, and burning, I give you instructions on how to create a custom OS X install CD, *and* upgrade the OS that the CD boots off of. (Here's hoping I can post this much!) None of this information should ruffle Apple Legal, but if for some reason it does, please contact me politely, and I'll be glad to pull this post. Just be nice, okay?


Creating a Custom Mac OS X 10.1.1 Install CD

Introduction

Over the past few weeks, it has been discovered that one can very easily create a full install CD from the "Mac OS X 10.1 Update" CD's that Apple gave out some months ago. However, it is posisble to do much more than just convert an update CD to a full install CD. With a little bit of work, you can install any extra package you want as part of that single seamless installer. If you've been frustrated by the bugs in 10.1 regarding Oxford-911 firewire drives (as I have been), you can upgrade the OS on the CD, and allow installations onto these drives. Want to know more? Read on...

(*) Note - I have created all of these instructions from memory (I have checked the pathnames provided, however), so if you do encounter any problems with the instructions, please let me know. Thanks!


Part 1 - Converting the 10.1 Update CD to a full Install CD

This hack has been well documented on the internet, much to Apple's chagrin. I expect that Appe will plug these holes in future updates. So, you may want to get familiar with these steps, as it may not be the last time you create a custom install CD from the original 10.1 update CD.

All of this was made possible by the extensive changes made between version 10.0 and version 10.1 of Mac OS X. Thanks to this, we all recieved complimentary update CD's (or paid $20 for "shipping and handling"), which are now proving to be very useful. These CD's contained the entire 10.1 operating system (which could be verified by erasing the installation volume before setting up 10.1), protected by what turned out to be a very easily defeatable check.

First, some background on installation packages. Mac OS X, unlike the classic Mac OS, includes a built-in Installer program that makes it very easy to perform simple and complex installations, including that of the OS itself. An installation package contains several pieces of information:

a) The name of the package
b) The files to be installed
c) The conditions by which to allow installation
d) Various attributes, including requiring restart, asking for admin privileges, etc.

< Since Apple has been very upset that people are publicizing its gaffe, and since this information is readily available elsewhere, I have not included the exact details here. >

(*) Burning the CD itself can be the most difficult part of this process; at least it was for me. Using a QPS 12/10/32 FireWire burner (Plextor mechanism), I had numerous failures and problems. Some tips in case you run into trouble:

1) Don't verify - the burner frequently stopped responding, eventually producing either a failure to shut down properly or a kernel panic is I unplugged and replugged the drive
2) Manually set the burn speed to the rating of your CD's. Using "maximum possible" ignores the rated speed of the CD media, and burns at whatever your drive is capable of, usually with bad results
3) Use CDRW's if at all possible - you very well may have some coasters, and they might as well be reusable. If they do fail, use Disk Utility to erase them, and use a full erase if quick erase fails to result in a "0.00 byte" CDRW


Part 2 - Adding new packages to the CD

Now that you have a bootable installation CD (or rather, a writable image of one), you can customize it in many ways, but first, you need space. Navigate to "/Volumes/Mac OS X Install CD/System/Installation/Packages/". Your requirements may vary, but I removed all languages and the Additional Printer Drivers. I also removed all extra languages from "/Volumes/Mac OS X Install CD/Welcome to Mac OS X/". This freed up a couple hundred megabytes of space to use for other items.

Adding a package to the OS X Install CD involves three basic steps:

1) Add the package to "/Volumes/Mac OS X Install CD/System/Installation/Packages/"
2) Possibly remove any "InstallationCheck" or "VolumeCheck" files hidden in "Contents/Resources" in the new packages
3) Modify the "OSInstall.list" file inside "OSInstall.mpkg/Contents/Resources"

Steps 1 is easy. Download or copy into place the packages you want installed as part of the CD (or if you want even more, make your own - an exercise for the reader who has developer tools installed).

As far as removing the "InstallationCheck" and "VolumeCheck" files, be very careful. Packages generally have these there for a reason, and it's not impossible for them to actually perform a critical step necessary to install the package (although highly unlikely, since when these scripts are run the Installer does not know whether or not you will proceed with installing the package). However, they can get in the way of a perfectly good install CD. For instance, my goal was to install all updates to OS X that have come out since 10.1. Many of these updates (such as the 10.1.1 Update) check for the existance of 10.1 before they will install. Since this is a fresh install CD, there will be no existing installation, so these checks will fail and give a useless (or misleading) error message. Be careful, and make sure you know what order to install packages in, and what checks to remove. If it helps any, I removed all checks on my CD, and was very careful about installation order. Which brings us to step 3.

The "OSInstall.list" file inside of "OSInstall.mpkg" is what determines what packages are installed, which are default, and which are required. The stock file on the 10.1 Update CD looks like this:

Essentials.pkg:required
BSD.pkg
AdditionalPrinterDrivers.pkg
Japanese.pkg
German.pkg
French.pkg
Spanish.pkg
Italian.pkg
Dutch.pkg

This is a list of all packages to install (the mpkg is defined elsewhere to only look in the same directory it is in, but that's not important here). There are two options that can be added after a package name ":required" or ":unselected". Required packages are always installed, and cannot be skipped in a custom install. Unselected packages are not part of an "Easy Install", and are unselected by default in a custom install. Any package listed without either one is an optional package, but installed by default (as are all of the other packages above).

A critical thing to note is that the order of the packages in this list is the order in which they will install. If you want to install the 10.1.1 Update, for instance, you'll need to place it after Essentials, BSD, Security Update, and Installer Update. This is why I said earlier you can remove the "check" files, as long as you are very careful about the installation order.

For reference, here is the final list on my own personal install CD:

Essentials.pkg:required
BSD.pkg
Japanese.pkg
SecurityUpdate10-19-01.pkg
InstallerUpdate1.0.pkg
MacOSXUpdate10.1.1.pkg
IEUpdate.pkg
iTunes2.pkg
DVDPlayerUpdate.pkg
DevTools.pkg:unselected
Dec2001DevToolsExtras.pkg:unselected
DevSDK.pkg:unselected
DevExamples.pkg:unselected

By default, this will install 10.1, Japanese, the Security Update and Installer Update required by 10.1.1, the 10.1.1 Update, IE 5.1.3 Update, iTunes 2.0.3, and DVD Player 3.0.1 (*). It is able to install (but only via a custom install) the December 2001 Developer Tools. Quite a potent CD!

(*) I have not included the Airport 2.0 Update, since I'm not entirely sure how it deals with the "System/Installation" directory. I'll do further research, or the forthcoming 10.1.2 update may make all of this moot.


Part 3 - Upgrading the CD's boot OS to 10.1.1 (ADVANCED)

I did run into one very infuriating problem, however. The point of this for me was to create a bootable partition on my new FireWire backup drive. Why worry about getting the Finder to work on a CD if you can have an emergency boot parition elsewhere with all of your troubleshooting tools? However, this was a nice new Oxford-911 based drive. The most alert troubleshooters out there already have alarms going off in their heads - Mac OS X 10.1 was partially incompatible with the Oxford-911 chipset. Sure enough, the Install CD, while installing 10.1.1, is booting from 10.1, and my new drive wouldn't show up in the list of available drives to install on. On a whim, I decided to try to upgrade the OS on the CD image. What followed was very interesting and enlightening.

The installation was straightforward enough:

1) Mount the disk image.
2) Open the Security Update package, install on the image.
3) Open the Installer Update package, install on the image.
4) Open the 10.1.1 Update package, install on the image. (*)

(*) Before installing this package, you may want to open its contents and edit "Contents/Resources/English.lproj/MacOSXUpdate10.1.1.info" (assuming English) and change the package flag "RequiresReboot" to "NO". After all, why reboot if you're installing onto a disk image (as opposed to your active hard drive)?

On attempting to boot from this CD, I noticed two oddities immediately:

1) During boot, I saw a "broken system folder" icon after the Happy Mac
2) The mouse wouldn't work. At all. ADB, USB, trackpad, nothing.
3) You *need* the mouse. You can use "Full Keyboard Access" (see the Keyboard preference panel) to get through most of it, but once you try to select your installation disk, you're stuck.

However, my firewire drive was now showing up! So at least that much had worked.

After doing some internet research (Google is a lifesaver), I discovered from "Unsupported Utility X" that these problems were linked to the OS CD only loading the kernel extension (what we used to call drivers) located inside the "/System/Library/Extensions.mkext" file. Apparently, on a normal CD, this includes mouse drivers. The 10.1.1 Update, however, installs new drivers (like the updated FireWire driver) and rebuilds this file without the mouse driver. Conundrum - I couldn't use the "Extensions.mkext" I had (no mouse), but I couldn't use the 10.1 version (no Oxford-911 support). Hmmm...

One attempt (that may or may not have had an ultimate effect - I include it here in case it's useful) was based on the Darwin source code. To generate a fresh "Extensions.mkext" (assuming your image is mounted and has not been renamed), run this command at the command line (without the double quotes):

"/usr/sbin/mkextcache -l -t `arch` -o /Volumes/Mac\ OS\ X\ Install\ CD/System/Library/Extensions.mkext -d /Volumes/Mac\ OS\ X\ Install\ CD/System/Library/Extensions"

By itself, this still did not work. Apparently, the system does not feel a mouse driver should be in this cache. The "Unsupported Utility X" page did mention that the CD boot process differed from the normal process in that it did not check any extensions in the "/System/Library/Extensions" folder, since Apple had included everything needed in the "Extensions.mkext" file (except a working FireWire driver).

The boot process is controlled by various files, but at its most basic it's directed by the various "rc" files in the "/etc" directory. I compared several of these files, and discovered that when "/etc/rc.cdrom" executed "kextd" to load the kernel extensions, it was passing a "-j" argument that other files did not. While I had no idea what the "-j" argument did, I removed it on a hunch that it was causing the CD boot process to not check beyond "Extensions.mkext".

Lo, and behold, when I finished these edits, burned a CD and booted from it, after much CD churning the installer came up. The mouse worked, and with a couple of clicks, I installed a completely up-to-date 10.1.1 system onto my firewire backup drive. Not bad!


Conclusion

So what can you do with all of this? Plenty! You now can create an OS CD that boots with any OS updates applied that you may need (such as future hardware revisions). You can customize the install process to add any components you want, and force installation of them. You can even make your own installation packages for any corporate or third party software you want as part of a basic install. You can probably even delete the "Essentials.pkg" and "BSD.pkg" and install only extra software (such as a standard build of corporate or university applications). When third party disk recovery software comes out, this is a good starting point for creating customized boot CD's.

Tell me what you come up with! Have fun!

[ 12-17-2001: Message edited by: diamondsw ]

Xeo
Dec 17, 2001, 04:52 AM
Very cool stuff. I could have used this information a couple hours ago before I completely reinstalled 10.1.1. It would have saved me from a lot of optimizations.

thePurpleGiant
Dec 17, 2001, 05:58 AM
Good work mate! That has to be the longest post I've ever read!

Thanks for sharing!

As for legal issues, I believe that if anyone wanted to illegally install OS X, they'd download it, or burn a friends copy, rather than go to all that effort to modify an update CD IMHO

Xeo
Dec 17, 2001, 06:35 AM
Originally posted by diamondsw:
<STRONG>As far as removing the "InstallationCheck" and "VolumeCheck" files, be very careful. Packages generally have these there for a reason, and it's not impossible for them to actually perform a critical step necessary to install the package (although highly unlikely, since when these scripts are run the Installer does not know whether or not you will proceed with installing the package). However, they can get in the way of a perfectly good install CD. For instance, my goal was to install all updates to OS X that have come out since 10.1. Many of these updates (such as the 10.1.1 Update) check for the existance of 10.1 before they will install. Since this is a fresh install CD, there will be no existing installation, so these checks will fail and give a useless (or misleading) error message. Be careful, and make sure you know what order to install packages in, and what checks to remove. If it helps any, I removed all checks on my CD, and was very careful about installation order. Which brings us to step 3.</STRONG>So you removed both VolumeCheck and InstallationCheck, right? From which files exactly? Just the Security Update and 10.1.1? Nothing bad happened when you got rid of them? I would think it might be better to leave those files and just get rid of the content, so it can "run" the files normally, but they just don't do anything. Actually, they should just "exit 1;" so they return the value it's looking for.

I dunno, maybe they aren't necessary at all. What do you think?

Xeo
Dec 17, 2001, 06:39 AM
Originally posted by diamondsw:
<STRONG>It is able to install (but only via a custom install) the December 2001 Developer Tools.</STRONG>The "only via custom install" is your own doing right? There is technically no reason we can't install them by default. I would want my CD to have that on by default. In fact, with my own custom installation like this, I'd want it to install everything I put in there by default.

tinrib
Dec 17, 2001, 07:22 AM
Originally posted by Xeo:
<STRONG>The "only via custom install" is your own doing right? There is technically no reason we can't install them by default. I would want my CD to have that on by default. In fact, with my own custom installation like this, I'd want it to install everything I put in there by default.</STRONG>
it's good to know though, how to make something an option. Which is why he made it an option - that's my guess.

Agent69
Dec 17, 2001, 10:08 AM
What I would like to do is stop Internet Explorer and iTunes from getting installed at all. Does anyone see how I could apply these instructions to get this done.


Agent69 :)

Xeo
Dec 17, 2001, 10:45 AM
Originally posted by Agent69:
<STRONG>What I would like to do is stop Internet Explorer and iTunes from getting installed at all. Does anyone see how I could apply these instructions to get this done.


Agent69 :)</STRONG>Just don't install them. When Software update opens and tells you to update, you can select "Make inactive" from a menu. It won't bug you anymore.

Now, to change the subject, I've been reading in the PackageMaker help about scripts. Here is a quote from the help:

If a metapackage contains packages with scripts, the Installer runs a package's scripts before or after it installs that package. It does not batch up all teh scripts for all the packages to run them all at once.This is specifically for scripts that end in .pre_install, .pre_upgrade, .post_install, and .post_upgrade but I think it also might apply to any scripts the package runs. Wouldn't that mean we don't have to remove the check files at all? By the time it runs those scripts, OS X has been installed and therefore the test will work just fine.

If you tested this already and found that those MUST be deleted, please let me know. If you think it's better to modify them to always exit 1; as I suggested before then tell me that too. I don't have time to test it now, but I'll test it later if I don't get a response.

Oink
Dec 17, 2001, 10:45 AM
Will definitely try this.

Currently, I installed OSX and customised a patition to my need and then captured a compressed diskcopy image of the device itself. I burnt this and Apple Software Restore on a CD. Obviously this way, you can't custom install, I see it more of a backup option.

Has anyone figured a way to say, install factory version of Apache from OSX CD withou a complete installation. When I have time, I will look into Charles' Pacifist, but I think it allows you to extract specific files, which is hard to figure out in an numerous files installation like Apache

diamondsw
Dec 17, 2001, 12:09 PM
Cool, I actually contributed something useful. ;)

So you removed both VolumeCheck and InstallationCheck, right? From which files exactly? Just the Security Update and 10.1.1? Nothing bad happened when you got rid of them? I would think it might be better to leave those files and just get rid of the content, so it can "run" the files normally, but they just don't do anything. Actually, they should just "exit 1;" so they return the value it's looking for.

I dunno, maybe they aren't necessary at all. What do you think?


Originally I opened all of these files and changed them to "exit 0;", which worked. However, since I didn't want to have to explain in detail which lines to leave in, what to remove, etc, I also did later tests with all of the files completely removed. Worked like a charm, and much easier to explain.

The "only via custom install" is your own doing right? There is technically no reason we can't install them by default. I would want my CD to have that on by default. In fact, with my own custom installation like this, I'd want it to install everything I put in there by default.

Yes, this was partially as an exercise for myself, but it creates a very nice CD. For a quick easy install, you just get the full updated OS. A couple of clicks, and you get the developer software. However, I have noticed that sometimes my installers ignore the ":unselected" option and select everything. Still working on that.

What I would like to do is stop Internet Explorer and iTunes from getting installed at all. Does anyone see how I could apply these instructions to get this done.

Probably if you created an install package that only had scripts, and those scripts removed the "offending" files. Or you could try to open the Essentials.pkg and remove the originals in the pax archive, but I don't know how feasible that is.

This is specifically for scripts that end in .pre_install, .pre_upgrade, .post_install, and .post_upgrade but I think it also might apply to any scripts the package runs. Wouldn't that mean we don't have to remove the check files at all? By the time it runs those scripts, OS X has been installed and therefore the test will work just fine.

If you tested this already and found that those MUST be deleted, please let me know. If you think it's better to modify them to always exit 1; as I suggested before then tell me that too. I don't have time to test it now, but I'll test it later if I don't get a response.


I tried this - it appears to run all of the "Check" scripts first. Well-meaning, I guess, since you wouldn't want to get all the way through the installer, and it suddenly just fails after half an installation. So yeah, you'll need to delete or otherwise modify these files to disable the checks.

diamondsw
Dec 17, 2001, 12:49 PM
One attempt (that may or may not have had an ultimate effect - I include it here in case it's useful) was based on the Darwin source code. To generate a fresh "Extensions.mkext" (assuming your image is mounted and has not been renamed), run this command at the command line (without the double quotes):

"/usr/sbin/mkextcache -l -t `arch` -o /Volumes/Mac\ OS\ X\ Install\ CD/System/Library/Extensions.mkext -d /Volumes/Mac\ OS\ X\ Install\ CD/System/Library/Extensions"


I just heard from the author of Unsupported Utility X, and this step was indeed not needed. You can either do this or delete Extensions.mkext entirely. The real key is to remove the "-j" argument from kextd in rc.cdrom.

CharlesS
Dec 17, 2001, 03:32 PM
Originally posted by Oink:
<STRONG>Will definitely try this.

Currently, I installed OSX and customised a patition to my need and then captured a compressed diskcopy image of the device itself. I burnt this and Apple Software Restore on a CD. Obviously this way, you can't custom install, I see it more of a backup option.

Has anyone figured a way to say, install factory version of Apache from OSX CD withou a complete installation. When I have time, I will look into Charles' Pacifist, but I think it allows you to extract specific files, which is hard to figure out in an numerous files installation like Apache</STRONG>

The thing you will have to be aware of with Pacifist is that it writes to the /tmp directory, so you will need to mount some drive to /tmp read-write for it to work from a CD. This was necessary to get around some bugs in pax.

Deicide
Dec 17, 2001, 04:37 PM
one question.

Where do you download the IE 5.1.3 Update? I have found an IEUpdate.pkg in the Receipts folder but it seems to small to be it.

[ 12-17-2001: Message edited by: Deicide ]

diamondsw
Dec 17, 2001, 04:54 PM
Where do you download the IE 5.1.3 Update? I have found an IEUpdate.pkg in the Receipts folder but it seems to small to be it.


That one was hard. The only way I found to get it was to get it through Software Update, and force it to quit right as it was about to start installing (but after it had finished downloading the package). Then search the disk for the installed package (it was somewhere like ".Trashes/501/IEUpdate.pkg") and copy it out.

Xeo
Dec 17, 2001, 06:44 PM
Originally posted by Deicide:
<STRONG>one question.

Where do you download the IE 5.1.3 Update? I have found an IEUpdate.pkg in the Receipts folder but it seems to small to be it.

[ 12-17-2001: Message edited by: Deicide ]</STRONG>I got it by killing the 3 processes that run when Software Update is running. I timed it by killing them just as it finished downloading. Then I picked up the .tar file in <font face = "courier">~/Library/Caches/Software\ Update\ Cache/lots/of/garbled/dirs/</font>

Polopo43
Dec 23, 2001, 04:10 AM
Hi !
I am stuck at the point where I have to remove "Installation check" and "Volume Check" from my additional packages.

It won't let me erase them cause they are belonging to root - wheel.
I tried to log into root in the terminal and then using the command "rm" but it says "Read only file".
Please help me !

Thx in advance !
Polopo

Xeo
Dec 23, 2001, 11:50 AM
Originally posted by Polopo43:
<STRONG>Hi !
I am stuck at the point where I have to remove "Installation check" and "Volume Check" from my additional packages.

It won't let me erase them cause they are belonging to root - wheel.
I tried to log into root in the terminal and then using the command "rm" but it says "Read only file".
Please help me !

Thx in advance !
Polopo</STRONG>Using Terminal to delete is the right idea. However, you can't delete them from the .dmg files they start on. They have to be on a read/write volume such as your hard drive or the image you are copying the files to. I copied all the files to my read/write disk image first and then removed all the check files. If you're working from a read/write volume already then I'm confused. Sorry.

Now, to fix something I said earlier, to get the IEUpdate.pkg, you don't need to kill 3 processes and grab it (well you do if you want the .tar)... just install it and before you quit Software Update use the "Save As..." feature in the "Update" menu. That would have saved me a little time earlier. :)

I've already updated my image to have the 10.1.2 combo on it. I'll be testing it out to see if I need any of the other updates first (such as the Installer update and the Security update). Some people have had problems going from 10.1 to 10.1.2 directly with the combo when installing from the HD rather than a CD.

diamondsw
Dec 24, 2001, 02:40 AM
I've already updated my image to have the 10.1.2 combo on it. I'll be testing it out to see if I need any of the other updates first (such as the Installer update and the Security update). Some people have had problems going from 10.1 to 10.1.2 directly with the combo when installing from the HD rather than a CD.


I don't recall where I saw it, but as I was preparing my new update CD, I did see language in the installer that said 10.1.1 was required.

No, wait a minute, I remember, because it was so weird. The installer check scripts only check for 10.1 (according to their comments). However, when you go to select a disk, it says that "10.1.1 or 10.1.2" are required! I tried it, and it will let you install the update again on an already updated system.

Finally, updating the boot OS on the CD to 10.1.2 is difficult, as space starts to run out on the CD image. I learned the hard way not to try copying Essentials.pkg back and forth while not root, and with permissions on the volume turned off. In a nutshell, I whacked the permissions on the package and the install failed. Oh well, the 10.1.1 update was the critical one for me.

As far as creating a CD that will install 10.1.2, no problem, and you should probably keep all of the 10.1.1 related updates. I checked the package, and 10.1.2 does not appear to contain all of the files the other updates did.

[ 12-24-2001: Message edited by: diamondsw ]

Xeo
Dec 24, 2001, 03:54 AM
Originally posted by diamondsw:
[QB]

I don't recall where I saw it, but as I was preparing my new update CD, I did see language in the installer that said 10.1.1 was required.

No, wait a minute, I remember, because it was so weird. The installer check scripts only check for 10.1 (according to their comments). However, when you go to select a disk, it says that "10.1.1 or 10.1.2" are required! I tried it, and it will let you install the update again on an already updated system.

Finally, updating the boot OS on the CD to 10.1.2 is difficult, as space starts to run out on the CD image. I learned the hard way not to try copying Essentials.pkg back and forth while not root, and with permissions on the volume turned off. In a nutshell, I whacked the permissions on the package and the install failed. Oh well, the 10.1.1 update was the critical one for me.

As far as creating a CD that will install 10.1.2, no problem, and you should probably keep all of the 10.1.1 related updates. I checked the package, and 10.1.2 does not appear to contain all of the files the other updates did.But what about the combo update? I'm not using the 10.1.2 update from the Software Update panel. I'm using the 10.1.2 combo update downloaded from Apple's website. This should act like the 10.0.4 combo update which updated 10.0.0, 10.0.1, 10.0.2, or 10.0.3. I would hope that I don't need the security update or the installer update or anything but a fresh copy of 10.1 and this "combo" update will take care of the rest.

Hopefully not just wishful thinking. (can you tell I haven't tried it yet? :))

Polopo43
Dec 26, 2001, 02:52 PM
Thanks for you answer.
The problem was that my .dmg was set to read only. I converted it into read/write with the convert function of disk copy.
Cheers !
Polopo

el chupacabra
Dec 27, 2001, 03:45 AM
Do you know how to do this with an OS 9.1. to OS 9.2 CD?

CharlesS
Dec 27, 2001, 05:51 AM
Originally posted by el chupacabra:
<STRONG>Do you know how to do this with an OS 9.1. to OS 9.2 CD?</STRONG>

You would need some knowledge of how to write Installer scripts. I do not know if it is possible, but if it is, it would require a completely different method than the one described here.

Brit Ben
Jan 8, 2002, 02:41 AM
Originally posted by diamondsw:
<STRONG>
Finally, updating the boot OS on the CD to 10.1.2 is difficult, as space starts to run out on the CD image.

[ 12-24-2001: Message edited by: diamondsw ]</STRONG>

If I can figure out how to grow a dmg file from 650mb to 700mb, I can burn an 80minute CD with 10.1.2 :o)

Thanks for all the work otherwise.

Ben