Chapter 5. System Startup and Login

Usually, the first thing you do when you sit down at your computer is either hit the Power-On button or—for those who leave their machines on all the time—log in. Most of the time, you probably don’t think much about what happens behind the Apple logo and spinner as the system boots up or about the events that happen between the time you enter your username and password and the time Mac OS X’s desktop appears.

Booting a Mac is not a single-step process; over 100 programs take part in the process of transforming your machine from an inert collection of plastic and metal into a running system. In general, though, the process can be broken down into three major steps. First, the hardware powers up and organizes itself. Next, the hardware launches the operating system, and then the operating system finally starts up. This chapter removes the veil of mystery and shows what goes on behind the scenes as your Mac starts up—from the time you press that Power-On button, right up to the login screen.

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.

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.

Tip

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 often—if ever—with Mac OS X, thankfully.

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

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 boot—it’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.

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-Accessing Open Firmware-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.

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

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.

The Startup Disk preference panel

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.

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.

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.

The OS Picker

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.

Locking Down Open Firmware

Since Open Firmware controls the boot process and accepts input from the keyboard during system boot time—either in the form of boot-key combinations or by accessing the Open Firmware prompt—it 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:

  1. Boot into Open Firmware (Option-Single-User and Verbose Modes-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-Single-User and Verbose Modes-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 security—if 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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.7.102