EFI

From OSx86

Jump to: navigation, search

内容

[edit] 什么是EFI?

Extensible Firmware Interface (EFI) 是一组界面,其设计了软件如何与未来的固件相交互. EFI 1993 年作为Intel启动初始化项目的一部分而被开发的. 这个项目的目的是通过改善现有计算机的固件技术以移除过去的传统BIOS的限制. 它和基于 PowerPC 的 Mac 所使用的开放固件有很多相似的特性. 不仅如此, 它还具有相当的拓展性和伸缩性. (注: HP Itanium 系统已经使用 EFI 好几年了)

用于 EFI 的驱动程序, 与启动程序以及操作系统引导器都是用 C 而不是汇编编写的. EFI 的特性包括一些简单的 API ,用于文字与图形的屏幕输出、键盘鼠标的输入以及对文件系统与块设备的存取. EFI 允许将设置以变量形式储存在 NVRAM 中, 比如键值对.

Intel 还为 EFI 创建了 平台创新框架 (或者叫 "The Framework"), 通过带有一个 兼容性支持模块 (CSM)以完全支持传统操作系统的 EFI 实现. 这个框架经常错误地被认为就是 "EFI", 而实际上它只是 EFI 标准的一种可能的实现. 其他的实现还包括 Apple 的基于 Intel 的 Mac所使用的新固件和 Insyde Technology 只支持传统系统的 InsydeH2O 固件. 现在某些 Gateway 也装在有类似的框架. .

[edit] EFI 在 Intel Mac 中

Apple 在新的Intel Mac中使用 基于 Intel 参考实现EFI 1.10 标准的兼容固件. Apple 自主开发的该固件. 它对通常环境下的用户是不可见的. Intel Macs 是以图形方式启动, 所以命令行不可见. 而且它不使用 EFI 的启动菜单, 而是用 Apple 自己的方式来定位操作系统引导器. 在启动时按住 Option 键会激活一个与 PowerPC Mac 类似的图形化启动分区选择器. 它在标准 FAT 读写驱动的基础上还补充了一些文件系统驱动.

  • 用Disk Utility 磁盘工具分区为 GPT 的磁盘会带有一个 FAT32 格式的 EFI 系统分区, 不过它是空的并且不被使用.
  • 操作系统引导器通常是由HFS+ 分区头的一个文件 ID 指针来定位. 这些信息可以通过 bless 命令行工具来设置.
  • 当使用 bless --mount ... --file ... 文件路径储存在 NVRAM中, 使得可以通过 FAT32 分区启动 EFI 引导器.
  • 新版本的支持 Boot Camp 的固件也可以 BIOS 方式启动, 比如从硬盘分区的启动扇区或 El Torito 镜像.
  • 该固件使用Intel 实现中的 ConSplitter 驱动. 其控制台控制协议可以在图形和文本模式中切换. 源代码和头文件可以在 TianoCore EDK中找到.
  • 当然也包含标准图形控制台驱动程序, 同时还提供基于通用显卡驱动的文本控制台. (无需手动加载图形控制台驱动程序, 见下.)
  • 包含内建网卡 AirPort 以及红外遥控器的 EFI 驱动. 遥控器确实能够用来控制启动分区的选择!
  • 使用 bless, 可以让 Mac在启动时加载任何 EFI 应用程序. 不过, 控制台仍然在图形模式下, 所以大多数情况下你什么都不会看到.
  • 当你使用 bless 来加载一个 EFI 驱动文件 (比如  Nakfull Propaganda instructions 中的 GraphicsConsole.efi 驱动), 该文件会被加载,但由于其不是一个应用程序所以控制会返回到 EFI 固件中. 此时会显示一个内建的启动选单, 并且在按一次键后控制台会切换成可见的文本模式. (注意: 这在 Mac Book Pro 似乎已经失效.)
  • 使用 TextMode.efi (一个小 EFI 应用程序) 能够立刻将控制台切换到文本模式并切换到内建启动选单而无需按一次键.
  • 更多关于图形化启动分区选择器:

    • 它会显示在任何磁盘上的 "blessed" 分区, 包括外接 USB 和火线硬盘, USB 闪存盘, USB 读卡器中的闪存卡, 和 CD/DVD 驱动器.
    • 它支持 GPT 磁盘格式的 HFS+ 分区, Apple 分区表, 甚至 MBR.
    • 很明显它完全不支持 FAT 分区, 因为它查看的是 HFS+ 分区头中由 El Torito 也被支持, 但启动镜像需要带有一个 HFS+ 文件系统来显示选择器. 看起来某些类型的分区表 (e.g. Apple 分区表) 也被支持; 这可能是由块大小导致的结果. (注意: 这已经不适用新版支持 Boot Camp 的固件. 细节还在调查中.)
    • 显示在 Finder's "More info" 对话框里设置的分区图标. (NTFS 分区会始终显示通用磁盘图标因为固件无法读取其文件系统.)
    • 显示的分区名称标签是从一个预准备好的图形文件中读取的. 其能够通过 blession i 选项来控制, 但是 --label c 在现在版本中无法使用. More info on labelsoard.
    • 选择器可以由 键盘, 鼠标, 或者红外控制器控制.

    ["http://wiki.osx86project.org/wiki/index.php?title=EFI&action=edit&section=3">edit] 受支持的硬件

    Based on preliminary analysis of apple_hardware_test from 10.4.4, only the following device classes are handled and/or accepted by included EFI modules:

    Apple Inc. ATI Technologies Inc. Nvidia Corporation
    Broadcom Corporation ATTO Adaptec Inc.
    Promise NEC Corporation Agere Systems
    Mellanox Technology Intel Corporation Marvell Semiconductor Inc?.
    Atheros Communications Inc. Pangea FireWire UniNorth 2.0 FireWire
    K2 FireWire KeyLargo USB Pangea USB
    Intrepid USB BCM5701 GMAC
    K2-GMAC K2 USB Shasta FireWire
    NV11 GeForce2 MX NV11 DDR GeForce2 MX NV11 GeForce2 Go
    NV20 GeForce3 NV20DDR GeForce3 Ti NV17 GeForce4 MX
    NV17M GeForce4 Go NV18 GeForce4 MX GeForce4 Ti 4600
    NV31 GeForce4 MX NV34 GeForce FX 5200 NV40 GeForce 6800 ultra
    NV40 GeForce 6800 gt NV43 GeForce 6600 RV100
    R200 R300 R350
    R481 RV350 RV360
    RV250 RV200 RV350M10
    RageM6 RV280 RV280M9+
    RV370 PDC20270 PDC20271
    IntraServer, fc PCIx IntraServer, fc ExpressPCIProUL3D
    ExpressPCI UL3S 66 LSILogic,scsi 2930CU
    USB Host Controller USB 2.0 Host Controller BCM5703
    BCM5704 BCM5721 BCM5714
    LSILogic,raid FW322 InfiniBridge
    M35a AirPort Card GMA 900 GMA 950
    82573V Ethernet Yukon Gigabit Adapter 88E8053 Pre-2.0 PCI Specification Device
    Non-VGA VGA Compatible Mass Storage Controller
    SCSI Floppy RAID
    Other Network Controller Ethernet
    Token Ring FDDI Display Controller
    PC Compatible 8514 Multimedia Device
    Video Audio Memory Controller
    Flash Bridge Device Host/PCI
    PCI/ISA PCI/EISA PCI/Micro Channel
    PCI/PCI PCI/PCMCIA PCI/NuBus
    PCI/CardBus Simple Communications Controller Serial
    Generic XT Compatible 16450 Compatible 16550 Compatible
    Parallel Standard Bidirectional
    ECP 1.X Compliant Base Systems Peripheral PIC (Programmable Interrupt Controller)
    Generic 8259 DMA (Direct Memory Access) EISA
    System Timer RTC (Real Time Clock) Generic
    Input Device Keyboard Digitizer (Pen)
    Mouse Docking Station Processor
    i386 i486 Pentium
    Alpha Power PC Co-processor
    Serial Bus Controller Firewire (IEEE 1394) ACCESS.bus
    SSA (Serial Storage Archetecture) USB (Universal Serial Bus) Fibre Channel

    [edit] 资源

    On a new Intel iMac, here is the output of:

    system_profiler ioreg kextstat
    dmesg sysctl uname

    MacInTouch also has the output of System Profiler. :D

    Intel provides a sample EFI implementation on their EFI website, complete with source code. OS X almost certainly requires more than what this implementation provides (the sample was created in 2003 and probably lacks key functionalities), but it should be a good starting point to get a feel for how an EFI system is partitioned (assuming 10.4.4 uses GPT partitoning) and how it boots.

    Also included are IA-32 images that allow standard PC systems to boot to EFI for educational and testing purposes: http://developer.intel.com/technology/efi/main_sample.htm

    [edit] Apple EFI 运行时

    The AppleEFIRuntime.kext file from 10.4.4 does not currently load on a 10.4.3-based system because of missing symbols:

    kextload: extension AppleEFIRuntime.kext appears to be valid
    kld(): Undefined symbols:
    _gPEEFISystemTable
    kextload: kld_load_from_memory() failed for module
            /[...]/AppleEFIRuntime.kext/Contents/MacOS/AppleEFIRuntime
    kextload: a link/load error occured for kernel extension AppleEFIRuntime.kext
    load failed for extension AppleEFIRuntime.kext
     (run kextload with -t for diagnostic output)
    

    According to an unofficial Apple/Intel FAQ, the graphics drivers seem to have a direct association with EFI modules. This can be seen in the System Profiler listing that they provide as "EFI Driver Version: 01.00.063". Some users have commented that an EFI module may be responsible for ROM BIOS initialization on ATI graphics cards.

    [edit] 与 TPM 的关系

    Additionally, the lack of presence of a TPM kernel extension in 10.4.4 means that the functionality probably now exists as an EFI module. There is also a possible association with Don't Steal Mac OS X.kext, which presumably acts to support memory page encryption and decryption.

    We know that there must be some sort of TPM support provided by (or through) a kernel extension because the ioreg output on an Intel iMac shows:

    | +-o TPM

    However, the above has not been proven and even if it is the study of how EFI works on Macs does not imply a DMCA violation because EFI is not a DRM scheme. Rather EFI is merely the evolution of BIOS technology which has no DRM role.

    [edit] 在 iMac 上的 EFI 外壳

    There is NO EFI Shell built-in with the original Apple EFI firm 在 iMac 上的 EFI Shell

    在原始的APPLE EFI 固件上没有内建的 EFI Shell ,由于大小的原因. 启动 EFI Shell 就是写一个简单的能修改 BOOT-NEXT 或 BOOT-FROM-FILE 变量的应用程序. 这些变量是用来控制计算机启动时的行为, 而默认行为则是从 HD 启动.

    有人说他们能用 Intel EFI 的简单实现来引导 EFI Shell. 但很抱歉那不是真正的 Shell. 它是从 CSM 而不是 EFI 内核引导的.

    请访问 这个站点 以获得完整的关于如何进入 Intel iMac 上的 EFI Shell 的教程 .

    如果你想在 Intel Mac 上体验一把 EFI, 你可以试试 rEFIt_an_, 一个简单的 EFI 启动菜单和工具箱. 它让你可以直接访问 EFI shell 和内建的 EFI 菜单.

    [">edit] 在 BIOS-PC上引导 EFI 实现

    Intel provides a sample implementation (BIOS32 and ia32-Embedded) that runs on top of any normal PCs, unloading BIOS16 (going在 BIOS-PC上引导 EFI 实现

    Intel 提供了一个简单的实现 (BIOS32 和 ia32-内置) 用以运行在普通 PC 上, 卸载 BIOS16 (进入保护模式) 并且加载 EFI 请求. 可能性讨论在 并且可以加载 .efi 文件并且可能, 最终, OS X.

    要启动 EFI 实现, 取得 EFI 范例实现, 解压并将 .img 放在 Binary 文件夹 (例如 Binary/ia32EMB/IMAGES/ia32EMB.img). 使用磁盘工具像 dd 或者 makedisk 来将镜像写入软盘, 然后让系统从它启动.

    重要信息: 这张磁盘不会更改你的磁盘或 BIOS 的任何信息. 小心: 使用 EFI shell 的任何格式化工具都要小心, 他们可能损坏你的系统!

    这张盘不会让你读写那些用于在 基于EFI 系统上启动传统模式 (比如基于 InsydeH2O或 Framework 的系统) 的NVRAM 变量,. 你建立的NVRAM 变量 只会储存在自身软盘上.

    Intel 现在提供更好的在传统基于 BIOS 的计算机上 引导 EFI 解决方案. 现在 EDK 支持新的模块名为 DUET 或者 开发者的 UEFI 模拟. 它支持从软盘, USB 或网络启动并且内建最新 EFI Shell .请到 TianoCore 获取更多信息.

    [rnal text" title=http://appleintelfaq.com/ href="http://appleintelfaq.com/" rel=nofollow>Apple/Intel FAQ
  • EFI firmware
  • EDK - EFI Developer's Toolkit
  • EDK2.0 - EFI Developer's Toolkit 2.0 The next version of EFI firmware core .
  • Personal tools