Section 5.1. The Hardware Boot Process


5.1. The Hardware Boot Process

When you press the Power-On button on your Mac, a small hardware program embedded in the main logic board of your machine, known as the POST (Power-On Self Test) , is activated. The first thing the POST does is power up and then initializes the CPU. Next the POST performs some tests on the core system components, such as the memory, to make sure the system can boot. If everything checks out OK, the POST starts a program called Open Firmware , located on a reprogrammable chip on the motherboard. It's at this point in the boot process that you hear the famous Mac chime.

Open Firmware's first job is to find the various hardware devices attached to the motherboard of the machine. This includes internal hardware such as video cards and hard drives as well as external hardware connected via the FireWire, USB, and SCSI buses. As Open Firmware discovers the various hardware devices, it organizes them into a device tree, which makes it easier for the higher levels of the system to access those devices.

So What's Open Firmware?

You're no doubt familiar with the terms software and hardware. But firmware ? Well, when chip designers make a mistake in a hardware program, they pretty much have to throw away the chip and start over. This is quite unlike software, where all you need to do is replace the instructions without throwing away a physical device. The solution that hardware designers came up with is to create a chip that can be reprogrammed. The instructions on the chip are permanently stored on it, so it's not quite software. But they can be changed. Being neither hardware nor software, they settled on the name firmware.

Open Firmware is the name given to the IEEE standard for a machine-independent BIOS that grew out of the boot code used in workstations and servers from Sun Microsystems. What separates it from other BIOS implementations is that it uses a bytecode representation of the Forth language. This allows the same code to run on different processors without change, which lets hardware makers provide on-card drivers that will work on PowerPC, Sparc, and Intel x86 architectures. In addition, Open Firmware provides a mechanism for each piece of hardware to describe itself so that the host system can best use it.

You can find out more information about Open Firmware at http://www.openfirmware.org.


After Open Firmware finds the hardware, it looks for an operating system to boot. It first checks its own configuration for the boot device. Assuming the configured device is a disk and is attached, Open Firmware then looks on the disk for the blessed operating system booter and loads and boots the system. If a bootable operating system isn't present on the configured device, Open Firmware conducts a search of any other drives attached to your system. Finally, if no boot device is found, you're presented with a folder icon with a blinking question mark indicating that no boot system could be found.

If you previously used Mac OS 9 (or earlier versions of the Mac OS), chances are you've seen the flashing question mark a few times. It wasn't uncommon for something to get corrupted, causing Open Firmware not to find Mac OS 9's System folder on startup. This doesn't happen as oftenif everwith Mac OS X, thankfully.


5.1.1. Taking a Peek at Open Firmware

Even though you will rarely (if ever) need to deal directly with Open Firmware, you can take a quick peek at its configuration using the nvram command-line tool. Example 5-1 shows the use of this command and a bit of its output (slightly abbreviated).

Example 5-1. Looking at Open Firmware's configuration
 $ nvram -p oem-banner? false boot-script virt-size -1 output-device screen output-device-1 scca input-device keyboard input-device-1 scca mouse-device mouse selftest-#megs 0 boot-volume 3 boot-device mac-io/ata-4@1f000/@0:10,\\:tbxi boot-screen boot-args default-server-ip default-gateway-ip default-router-ip default-client-ip default-subnet-mask default-mac-address? false screen-#columns 100 screen-#rows 40 scroll-lock true skip-netboot? false diag-switch? false boot-command mac-boot ram-size 0x30000000

Notice the boot-device line in the output. This tells Open Firmware what device it should boot from. In this case, Open Firmware is set to boot from the ATA-based disk drive. This string is different depending on what kind of bus (ATA or SCSI) your hard drive is attached to and what partition on the drive you are booting from.

The nvram command can also be used to set these values if you have an administrator account on the system. To set a particular value in Open Firmware, you would use the following syntax:

 sudo nvram name=value

If you want to set a large number of values at once, you can load them from a text file. The file must consist of a list of name=value statements. The syntax for loading the contents of the file into Open Firmware is:

 sudo nvram -f filename

Resetting Open Firmware

It should go without saying, but mucking about with your Open Firmware settings can put your system into a fairly odd state. Luckily, if you go overboard and your Open Firmware settings get messed up, there's an easy way to reset things, commonly referred to as "Zapping the PRAM ." To do this, hold down Option--P-R while booting your machine. Hold these keys down until you've heard the system startup chime two or three times, and then let go of the keys to boot your system.


5.1.2. Updating Firmware

Every so often, an update to Mac OS X is released that requires a firmware upgrade for certain machines in order to work correctly. Since Open Firmware is used primarily at boot time, not having up-to-date firmware can result in a machine that won't bootit'll get stuck at a gray screen instead. You should be sure to read the release notes for any major update to Mac OS X to see if you need a firmware update before installing it.

Another place to look for documentation about firmware updates is on Apple's support web site at http://www.info.apple.com. To quickly see the pages dealing with firmware updates required for Mac OS X, enter Mac OS X Firmware Update in the Search Apple Support box. These pages tell you how to determine whether the firmware on your Mac needs to be upgraded before you install a new operating system.

There are two ways to determine the firmware version you have:

  • The first is to use the System Profiler application (see Chapter 12 for details on System Profiler).

  • The second is to access Open Firmware directly.

5.1.3. Accessing Open Firmware

If the nvram command doesn't give you enough access to the firmware of the system, you can access it directly by holding down the Option--O-F keys as you boot your machine. This drops you right into Open Firmware's command line, as shown in Example 5-2.

Example 5-2. The Open Firmware command-line interface
 Apple PowerBook3,1 4.1.8f5 BootROM built on 03/21/01 at 11:49:53 Copyright 1994-2001 Apple Computer, Inc. All Rights Reserved Welcome to Open Firmware, the system time and date is: 22:51:00 09/21/2003 To continue booting, type 'mac-boot' and press return. To shut down, type 'shut-down' and press return. ok 0 > _

The first line of output tells you the model of your computer, followed by the version of your firmware. In this case, the computer is an Apple PowerBook3,1, and the firmware version is 4.1.8f5.

Macintosh Model Names

When you see your Mac's model name in Open Firmware or in System Profiler as something like "PowerBook3,1" you might wonder how that maps to its more well-known name of "PowerBook G3 (FireWire)." It refers to the machine using the latter name while Open Firmware and the system internals know it as the shorter, more concise nameand there's no direct mapping between the two names to be found on the Apple web site.

There is a file, however, on your hard drive that gives the mappings between these names (/System/Library/SystemProfiler/SPPlatformReporter.spreporter/Contents/Resources/Eng-lish.lproj/Localizable.strings). This is a Unicode file, so you'll need to open it in TextEdit (using the open -efilename command, which forces a file to be opened in TextEdit) or some other editor that understands the Unicode text encoding.


After the banner is printed, you are at the Open Firmware prompt (>), a pretty limited place unless you really know what you are doing. Table 5-1 lists a few of the commands that you can use. If you get yourself in a real jam, Example 5-3 shows how to reset your firmware and restart the system.

Table 5-1. Open Firmware commands

Key

Description

printenv

Prints all the variables held in firmware

namevalue

Sets a variable to the given value

password

Sets an Open Firmware password

reset-nvram

Clears the variables in firmware and replaces them with default values

reset-all

Causes the machine to reboot

mac-boot

Causes the machine to continue booting into the configured system

shut-down

Shuts down the machine


Example 5-3. Resetting Open Firmware and restarting the system
 0 > reset-nvram 0> reset-all

5.1.4. Setting the Boot Disk

To set the disk that you want to boot from, use the Startup Disk preference panel in System Preferences. When you launch this tool, as shown in Figure 5-1, it will allow you to choose from all of the Mac OS system folders on the hard drives attached to your machine. If there is a Mac OS X Server offering NetBoot or NetInstall services, you will see its available bootable images as well. If such a server is not detected, you still have the option to boot from a network volume by choosing the Network Start-up item.

Figure 5-1. The Startup Disk preference panel


When you select an operating system to boot from in the Startup Disk preference panel, two things happen. First, Open Firmware is programmed with the location of the boot device. Second, a small bit of information is written to the boot blocks of the hard disk that contains the system indicating where on the drive the boot program for the operating system is located. This second step, known as blessing the system, allows more than one OS to be installed on a hard drive or partition. This means you can boot into either Mac OS X or Mac OS 9, even if they are both installed on the same volume.

Booting Mac OS 9

In January 2002, Apple began shipping all new Macs with Mac OS X as their default operating system. Shortly thereafter, at Apple's World Wide Developer Conference (WWDC), Steve Jobs gave a mock eulogy for Mac OS 9, stressing to developers the importance of Mac OS X. However, in January 2003, the final change was made: new Macs would only boot into Mac OS X, leaving Classic the only way to run older Mac apps. While this change might have left some users with legacy Mac software in the cold, it reflects Apple's dedication to the Mac OS X platform. Sometimes, you just have to give up the past and move on to bigger and better things.


5.1.4.1. Blessed system disk

To look at the startup settings for your machine from the command line, use the bless command. For example, to take a look at the various settings of the drive from which you are currently running, execute bless as shown in Example 5-4.

Example 5-4. Executing bless to examine boot settings
 $ sudo bless -info -bootBlocks finderinfo[0]: 2483 => Blessed System Folder is /System/Library/CoreServices finderinfo[1]: 0 => No Startup App folder (ignored anyway) finderinfo[2]: 0 => Open-folder linked list empty finderinfo[3]: 0 => No OS 9 + X blessed 9 folder finderinfo[4]: 0 => Unused field unset finderinfo[5]: 2483 => OS X blessed folder is /System/Library/CoreServices 64-bit VSDB volume id: 0x1BD7BA028DDA6A89

Try changing the settings around in your Startup Disk preference panel and reentering this command to see what changes. You may have to switch out of the Startup Disk preference panel for it to save your modifications. There's quite a bit more you can do with the bless command, such as blessing a particular folder or partition on your disk. See the bless manpage for details.

5.1.5. Changing the Boot Disk at Boot Time

Sometimes you will want to boot from some device other than the default. Usually this happens when you need to boot from a DVD or a FireWire drive to replace or repair your primary OS installation. You can use the following options to choose the boot disk you want to use:

  • To boot from a DVD, hold down the C key as you boot.

  • To boot from a NetBoot server, hold down the N key as you boot.

  • To see the local drives that contain a bootable partition, hold down the Option key as you boot, which invokes an Open Firmware program called the OS Picker , as shown in Figure 5-2.

  • If you have one disk that contains Mac OS 9 and one disk that contains Mac OS X, you can boot into Mac OS X by holding down the X key while the system boots. If you have more than one Mac OS X system installed, however, this trick won't work.

Figure 5-2. The OS Picker


The OS Picker duplicates some, but not all, of the functionality of the Startup Disk preference panel. While it will show all bootable partitions available to your Mac, it is limited in that it can only see the blessed operating system on a partition. This means that if you have both Mac OS X and Mac OS 9 installed on the same partition, OS Picker shows only the one that was configured for boot in the Startup Disk preference panel. If you want to boot into the non-blessed operating system on a partition, you'll have to make the change in Startup Disk and not with the OS Picker.

5.1.6. Locking Down Open Firmware

Since Open Firmware controls the boot process and accepts input from the keyboard during system boot timeeither in the form of boot-key combinations or by accessing the Open Firmware promptit is easy for anybody to make your Mac boot from any other drive. For most personal users, this isn't a problem. In fact, it allows great flexibility in starting up your system with multiple versions of Mac OS. In corporate or academic settings, however, you may not want people to be able to muck about with the settings of the computer, or the data it contains, quite so easily.

There are two ways to enable an Open Firmware password. The first is to download the Open Firmware Password utility from Apple through its support web site at http://docs.info.apple.com/article.html?artnum=120095. The second way is at the Open Firmware command line using the following process:

Single-User and Verbose Modes

There are two other useful modes you can use while booting your Mac: single-user mode and verbose mode . Single-user mode is a special Unix system state in which system startup is stopped and a login prompt is offered, allowing for administrative and maintenance activities to be performed without ever seeing Mac OS X's Aqua interface. Historically, single-user mode has been used when a system becomes unstable and needs critical areas to be fixed. To boot into single-user mode, hold down -S at start-up. When the system has booted, you are presented with a simple command-line prompt. To exit single-user mode, type exit or reboot; exit causes the system to go multiuser and complete the boot into the GUI environment.

To start your Mac in verbose mode, hold down -V at startup. Instead of the gray-on-gray Apple logo and spinner, you'll see a plain-text printout of the various things going on as you boot your system. If you want to see this every time you boot your system, you can use the nvram command to set the Open Firmware variable boot-args to -v.


  1. Boot into Open Firmware (Option--O-F).

  2. At the Open Firmware prompt, type your password; you are prompted to enter your password twice.

  3. Set a security mode for Open Firmware by typing setenv security-mode full or setenv security-mode command. The first option totally locks down your machine and requires a password to be entered to boot the system. The second option lets the system boot as configured, but requires a password to either access the Open Firmware or use any boot key options.

  4. Restart the machine using the reset-all command.

To turn off password protection, boot into Open Firmware and type setenv security-mode none. You will be asked for your password, if one is set, to make this change.

If you have a password-protected machine for which you've forgotten the password, there is a way to reset the password: open the machine and change the total amount of RAM in your system. Then reset the PRAM by using Option--P-R at boot time.

It should be noted that being able to lock down the system with an Open Firmware password is not a total security feature. If somebody can open up the machine and reset the memory in it, then Open Firmware will disable the password protection. Sure, you can padlock desktop machines, but there is no way to keep people out of the memory expansion slots on a laptop. This matches a truism in computer securityif somebody has physical access to a machine, then he can gain access to the data on it. Though if that data is encrypted with a tool like FileVault (discussed in Chapter 9), an intruder won't be able to read it.




Running Mac OS X Tiger
Running Mac OS X Tiger: A No-Compromise Power Users Guide to the Mac (Animal Guide)
ISBN: 0596009135
EAN: 2147483647
Year: 2004
Pages: 166

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net