Section A.2. Firmware and Booting


A.2. Firmware and Booting

We saw in earlier chapters (in particular, Section 4.16) that the x86-based Macintosh computers use the Extensible Firmware Interface (EFI) as their firmware, whereas Open Firmware is used on the PowerPC. While booting, like Open Firmware, EFI examines the volume headers of available HFS+ volumes. A bootable (blessed) volume's header contains information about the Mac OS X bootloader. As Figure A1 shows, the bless command can be used to display this information.

Figure A1. Using the bless command to view boot-related information in the volume header

$ bless -info / # x86-based Macintosh finderinfo[0]: 3050 => Blessed System Folder is /System/Library/CoreServices finderinfo[1]: 6484 => Blessed System File is /System/Library/CoreServices/boot.efi ... $ bless -info / # PowerpPC-based Macintosh finderinfo[0]: 3317 => Blessed System Folder is /System/Library/CoreServices finderinfo[1]:    0 => No Startup App folder (ignored anyway) ...

Figure A1 shows that in the case of an x86-based Macintosh, the volume header contains the path to boot.efi, which is the bootloader. boot.efi, a PE32 executable image, is a special EFI application whose job is similar to that of BootX on Open Firmware machines.

$ cd /System/Library/CoreServices $ ls -l BootX boot.efi -rw-r--r--   1 root  wheel  170180 Mar  17 07:48 BootX -rw-r--r--   1 root  wheel  134302 Mar  17 07:48 boot.efi


You can cause EFI to run an alternate bootloader by recording the latter's pathname in the volume header using bless.

$ bless --folder /SomeVolume/SomeDirectory/ \     --file /SomeVolume/SomeDirectory/SomeEFIProgram.efi


The Apple EFI Runtime kernel extension (AppleEFIRuntime.kext) provides access to EFI runtime services, which, as we saw in Chapter 4, are available even after EFI boot services have been terminated. AppleEFIRuntime.kext contains AppleEFINVRAM.kext as a plug-in extension. Like Open Firmware, the EFI NVRAM is used to store user-defined variables and other special-purpose variables (e.g., aapl, panic-info, which holds kernel-panic information). Again, as in the case of Open Firmware, the nvram command can be used to access these variables from Mac OS X.

The global kernel variables gPEEFISystemTable and gPEEFIRuntimeServices contain pointers to the EFI System Table (the EFI_SYSTEM_TABLE data structure) and the EFI Runtime Services (the EFI_RUNTIME_SERVICES data structure), respectively. The <pexpert/i386/efi.h> header in the Kernel framework contains definitions of these and other EFI-related data structures.

$ nrvam -p efi-boot-device-data %02%01... SystemAudioVolume    %ff efi-boot-device      <array >... boot-args            0x0 aapl,panic-info      ...





Mac OS X Internals. A Systems Approach
Mac OS X Internals: A Systems Approach
ISBN: 0321278542
EAN: 2147483647
Year: 2006
Pages: 161
Authors: Amit Singh

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