introduction to efi

190
® ® OS Loader Hardware BIOS EFI Compatibility Harry Hsiung Harry Hsiung Intel Corporation Intel Corporation EFI TME EFI TME Dupont Dupont Washington Washington

Upload: sisirkp

Post on 12-Apr-2015

129 views

Category:

Documents


14 download

DESCRIPTION

This file contains a presentation on Introduction to the UEFI Technology

TRANSCRIPT

Page 1: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

Harry HsiungHarry Hsiung

Intel CorporationIntel Corporation

EFI TMEEFI TME

DupontDupont WashingtonWashington

Page 2: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� OverviewOverview�� DocumentationDocumentation�� Shell and Boot ManagerShell and Boot Manager�� Directory StructureDirectory Structure�� Development EnvironmentsDevelopment Environments�� EFI Application Toolkit OverviewEFI Application Toolkit Overview�� Sample ApplicationsSample Applications�� EFI/SAL IntegrationEFI/SAL Integration�� Open LabOpen Lab

Page 3: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

Mark DoranProgram ManagerIntel Corporation

October 13, 1999

Page 4: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� Why change?Why change?

�� What is EFI?What is EFI?

�� EFI enablingEFI enabling

�� Summary and Q&ASummary and Q&A

Page 5: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

Why Change?Why Change?

Bo

ot p

rocess

Op

tion

RO

Ms

Man

ufactu

ring

test

Page 6: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

Why Change?Why Change?

Bo

ot p

rocess

Op

tion

RO

Ms

Man

ufactu

ring

test

Page 7: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

Why Change?Why Change?

CodeReal Mode

Assembler

Spaghetti

Scalability

Complexity

Maintenance

Issue

SpecNone! Compatibility

OS LoaderTied to HWand BIOS

Slows innovation

Carries legacy

New Architecture RequiredNew Architecture Required

Page 8: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

Why Change?Why Change?

�� Interface specificationInterface specification��Implementation agnosticImplementation agnostic

�� Abstracts BIOS from OSAbstracts BIOS from OS��Decouples developmentDecouples development

�� Compatible by designCompatible by design��Evolution, not revolutionEvolution, not revolution

�� Modular and extensibleModular and extensible��OSOS--Neutral value addNeutral value add

�� Complements existing interfacesComplements existing interfaces

OSLoader

Hardware

BIOS

EFI

Flexible to meet existing and future needs

Flexible to meet existing and future needs

Page 9: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

Why Change?Why Change?

�� Interface specificationInterface specification��Implementation agnosticImplementation agnostic

�� Abstracts BIOS from OSAbstracts BIOS from OS��Decouples developmentDecouples development

�� Compatible by designCompatible by design��Evolution, not revolutionEvolution, not revolution

�� Modular and extensibleModular and extensible��OSOS--Neutral value addNeutral value add

�� Complements existing interfacesComplements existing interfaces

OSLoader

Hardware

BIOS

EFI

Flexible to meet existing and future needs

Flexible to meet existing and future needs

Co

mp

atib

ility

Page 10: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

Why Change?Why Change?

CodeReal Mode

Assembler

Spaghetti

Scaleability

Complexity

Maintenance

Issue

SpecNone! Compatibility

OS LoaderTied to HWand BIOS

Slows innovation

Carries legacy

The right solutionThe right solution

Page 11: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

Why Change?Why Change?

CodeReal Mode

Assembler

Spaghetti

Scaleability

Complexity

Maintenance

Issue

SpecNone! Compatibility

OS LoaderTied to HWand BIOS

Slows innovation

Carries legacy

High level

language

protected

mode code

Scaleable

and easy to

maintain

The right solutionThe right solution

Page 12: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

Why Change?Why Change?

CodeReal Mode

Assembler

Spaghetti

Scaleability

Complexity

Maintenance

Issue

SpecNone! Compatibility

OS LoaderTied to HWand BIOS

Slows innovation

Carries legacy

High level

language

protected

mode code

Scaleable

and easy to

maintain

Straight-forward

implementationClearly defined

The right solutionThe right solution

Page 13: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

Why Change?Why Change?

CodeReal Mode

Assembler

Spaghetti

Scaleability

Complexity

Maintenance

Issue

SpecNone! Compatibility

OS LoaderTied to HWand BIOS

Slows innovation

Carries legacy

High level

language

protected

mode code

Scaleable

and easy to

maintain

Straight-forward

implementationClearly defined

Innovation

Legacy migrationAbstraction

The right solutionThe right solution

Page 14: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

Why Change?Why Change?

�� IA64 interceptIA64 intercept�� Golden opportunityGolden opportunity

–– New operating systemsNew operating systems

–– New hardware platformNew hardware platform

�� Downstream benefits for IA64Downstream benefits for IA64�� Legacy migrationLegacy migration

�� ScaleabilityScaleability

�� ExtensibilityExtensibility–– SecuritySecurity

–– ManageabilityManageability

–– DiagnosticsDiagnostics

IA64Hardware

EFIBIOS

IA64apps

IA32apps

LegacyBIOS

IA32OS

IA64OS

IA64/EFI : the perfect matchIA64/EFI : the perfect match

Page 15: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

Why Change?Why Change?

�� IA64 interceptIA64 intercept�� Golden opportunityGolden opportunity

–– New operating systemsNew operating systems

–– New hardware platformNew hardware platform

�� Downstream benefits for IA64Downstream benefits for IA64�� Legacy migrationLegacy migration

�� ScaleabilityScaleability

�� ExtensibilityExtensibility–– SecuritySecurity

–– ManageabilityManageability

–– DiagnosticsDiagnostics

IA64Hardware

EFIBIOS

IA64apps

IA32apps

LegacyBIOS

IA32OS

IA64OSEFI

BIOS

IA64/EFI : the perfect matchIA64/EFI : the perfect match

Page 16: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� OS loader only OS loader only uses EFIuses EFI

�� EFI compiled in EFI compiled in native codenative code

�� EFI implemented EFI implemented in C Languagein C Language

�� MFG environment MFG environment migrated to EFImigrated to EFI

OSLoader

Hardware

EFI

MFG test code

Hardware

EFI

factory user

Simple documented APISimple documented API

Page 17: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

Man

ufactu

ring

test

Op

tion

RO

Ms

Bo

ot p

rocess

Why Change?Why Change?

Golden opportunity for changeGolden opportunity for change

Page 18: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

Man

ufactu

ring

test

Op

tion

RO

Ms

Bo

ot p

rocess

Why Change?Why Change?

Golden opportunity for changeGolden opportunity for change

Page 19: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

Man

ufactu

ring

test

Op

tion

RO

Ms

Bo

ot p

rocess

Why Change?Why Change?

Golden opportunity for changeGolden opportunity for change

Page 20: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� Why change?Why change?

��What is EFI?What is EFI?

�� BenefitsBenefits

�� ImplementationImplementation

Page 21: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

PLATFORM HARDWARE

What is EFI?What is EFI?

PLATFORM SPECIFIC FIRMWARE (SAL)

Page 22: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

PLATFORM HARDWARE

What is EFI?What is EFI?

PLATFORM SPECIFIC FIRMWARE (SAL)

OPERATING SYSTEM

Legacy OS LOADER

Compatibility

Page 23: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

PLATFORM HARDWARE

What is EFI?What is EFI?

PLATFORM SPECIFIC FIRMWARE (SAL)

OPERATING SYSTEM

Legacy OS LOADER

Compatibility

(OTHER)SMBIOS

ACPI

INTERFACESFROMOTHER

REQUIREDSPECS

Page 24: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

PLATFORM HARDWARE

What is EFI?What is EFI?

PLATFORM SPECIFIC FIRMWARE (SAL)

OPERATING SYSTEM

Legacy OS LOADER

Compatibility

(OTHER)SMBIOS

ACPI

INTERFACESFROMOTHER

REQUIREDSPECS

EFI OS LOADER

Page 25: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

PLATFORM HARDWARE

What is EFI?What is EFI?

PLATFORM SPECIFIC FIRMWARE (SAL)

OPERATING SYSTEM

Legacy OS LOADER

Compatibility

(OTHER)SMBIOS

ACPI

INTERFACESFROMOTHER

REQUIREDSPECS

EFI OS LOADER

EFI BOOT SERVICES

Page 26: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

PLATFORM HARDWARE

What is EFI?What is EFI?

PLATFORM SPECIFIC FIRMWARE (SAL)

OPERATING SYSTEM

Legacy OS LOADER

Compatibility

(OTHER)SMBIOS

ACPI

INTERFACESFROMOTHER

REQUIREDSPECS

EFI OS LOADER

EFI BOOT SERVICES EFIRUNTIMESERVICES

Page 27: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

PLATFORM HARDWARE

What is EFI?What is EFI?

PLATFORM SPECIFIC FIRMWARE (SAL)

OPERATING SYSTEM

Legacy OS LOADER

Compatibility

(OTHER)SMBIOS

ACPI

INTERFACESFROMOTHER

REQUIREDSPECS

EFI OS LOADER

EFI BOOT SERVICES EFIRUNTIMESERVICES

OS PARTITIONEFI OSLoader

EFI SYSTEMPARTITION

Page 28: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

PLATFORM HARDWARE

What is EFI?What is EFI?

PLATFORM SPECIFIC FIRMWARE (SAL)

OPERATING SYSTEM

Legacy OS LOADER

Compatibility

(OTHER)SMBIOS

ACPI

INTERFACESFROMOTHER

REQUIREDSPECS

EFI OS LOADER

EFI BOOT SERVICES EFIRUNTIMESERVICES

OS PARTITIONEFI OSLoader

EFI SYSTEMPARTITION

Mem

ory

Tim

er

Driver

Driver

Driver

BootDevices

Protocols +Handlers

Page 29: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

PLATFORM HARDWARE

What is EFI?What is EFI?

PLATFORM SPECIFIC FIRMWARE (SAL)

OPERATING SYSTEM

Legacy OS LOADER

Compatibility

(OTHER)SMBIOS

ACPI

INTERFACESFROMOTHER

REQUIREDSPECS

EFI OS LOADER

EFI BOOT SERVICES EFIRUNTIMESERVICES

OS PARTITIONEFI OSLoader

EFI SYSTEMPARTITION

Mem

ory

Tim

er

Driver

Driver

Driver

BootDevices

Protocols +Handlers

EFI APIEFI APIEFI API

Page 30: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

What is EFI?What is EFI?

PlatformInit

Standardfirmwareplatforminitialization

Boot Manager EFI binaries

API specified Value add implementation

EFIBoot code

FailureFailureFailureBoot Services

Terminate

Operationhanded offto OS loader

OS Loader

OSBooted

d

Page 31: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

What is EFI?What is EFI?

PlatformInit

Standardfirmwareplatforminitialization

Boot Manager EFI binaries

API specified Value add implementation

EFI ImageLoad

EFIDriver

Drivers andapplicationsloadediteratively

EFIBoot code

FailureFailureFailureBoot Services

Terminate

Operationhanded offto OS loader

OS Loader

OSBooted

d

Page 32: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

What is EFI?What is EFI?

PlatformInit

Standardfirmwareplatforminitialization

Boot Manager EFI binaries

API specified Value add implementation

EFI ImageLoad

EFIDriver

Drivers andapplicationsloadediteratively

EFIApplication

aged

EFIBoot code

FailureFailureFailureBoot Services

Terminate

Operationhanded offto OS loader

OS Loader

OSBooted

d

Page 33: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

What is EFI?What is EFI?

PlatformInit

Standardfirmwareplatforminitialization

Boot Manager EFI binaries

API specified Value add implementation

EFI ImageLoad

EFIDriver

Drivers andapplicationsloadediteratively

EFIApplication

aged

EFI OS Loader

Load

Boot fromordered listof EFI OSloaders

EFIBoot code

FailureFailureFailureBoot Services

Terminate

Operationhanded offto OS loader

OS Loader

OSBooted

d

Page 34: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

What is EFI?What is EFI?

PlatformInit

Standardfirmwareplatforminitialization

Boot Manager EFI binaries

API specified Value add implementation

EFI ImageLoad

EFIDriver

Drivers andapplicationsloadediteratively

EFIApplication

aged

EFI OS Loader

Load

Boot fromordered listof EFI OSloaders

EFIBoot code

FailureFailureFailureBoot Services

Terminate

Operationhanded offto OS loader

OS Loader

OSBooted

d

Page 35: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

What is EFI?What is EFI?

PlatformInit

Standardfirmwareplatforminitialization

Boot Manager EFI binaries

API specified Value add implementation

EFI ImageLoad

EFIDriver

Drivers andapplicationsloadediteratively

EFIApplication

aged

EFI OS Loader

Load

Boot fromordered listof EFI OSloaders

EFIBoot code

FailureFailureFailureBoot Services

Terminate

Operationhanded offto OS loader

OS Loader

OSBooted

d

Page 36: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

What is EFI?What is EFI?

PlatformInit

Standardfirmwareplatforminitialization

Boot Manager EFI binaries

API specified Value add implementation

EFI ImageLoad

EFIDriver

Drivers andapplicationsloadediteratively

EFIApplication

aged

EFI OS Loader

Load

Boot fromordered listof EFI OSloaders

Retry

EFIBoot code

FailureFailureFailureBoot Services

Terminate

Operationhanded offto OS loader

OS Loader

OSBooted

d

Page 37: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

What is EFI?What is EFI?

PlatformInit

Standardfirmwareplatforminitialization

Boot Manager EFI binaries

API specified Value add implementation

EFI ImageLoad

EFIDriver

Drivers andapplicationsloadediteratively

EFIApplication

aged

EFI OS Loader

Load

Boot fromordered listof EFI OSloaders

Retry EFI APIEFI API

EFIBoot code

FailureFailureFailureBoot Services

Terminate

Operationhanded offto OS loader

OS Loader

OSBooted

d

Page 38: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

What is EFI?What is EFI?

Architectural Sharing

• System partition• Location for OS loaders• Applications and drivers

FAT32 Format

• FAT32 spec now “public”• Tried and tested format• Readily available tools

New Partition Structure

• 64 bit partition sizes• Unlimited # of partitions• Co-exists w/ legacy MBR

Interoperability layout

• Multiple system partitions• Supports multiple OS

installs

Designed for flexibility Designed for flexibility

Page 39: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

Partition

Table H

DR

Partition 1

MB

R

Partition

Table H

DR

0 1 n...

LBA0 LBA1 LBAn

Start partition

End partitionStart partition

Primary PartitionTable

Backup PartitionTable

0 1 n...

End partition

First useable block

Last useable block

What is EFI?What is EFI?

Page 40: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� DISKPART.DISKPART.efiefi -- creates EFI GPT (creates EFI GPT (GUIDedGUIDedpartition table) system partitionpartition table) system partition

�� EFICHK.EFICHK.efi efi -- checks EFI GPT checks EFI GPT parition parition for for correctnesscorrectness

�� EFIFMT.EFIFMT.efi efi -- formats GPT system partition formats GPT system partition or standard FAT formatsor standard FAT formats

�� Part of NT64 setup Part of NT64 setup cd’s cd’s and on EFI websiteand on EFI website

Page 41: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

What is EFI?What is EFI?

�� Hard diskHard disk

�� Removable mediaRemovable media��CDCD--ROM, DVDROM, DVD--ROMROM

–– El Torito 1.0 “No emulation”El Torito 1.0 “No emulation”

��Floppy, LSFloppy, LS--120120 SuperDiskSuperDisk*, Iomega* Zip, Fujitsu* *, Iomega* Zip, Fujitsu* MO etc.MO etc.

�� NetworkNetwork��PXE BIOS support specification (WfM)PXE BIOS support specification (WfM)

�� Future media via extensibility methodsFuture media via extensibility methods

* All trademarks and brands are the property of their respective owners

Full device support Full device support

Page 42: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

What is EFI?What is EFI?

�� EFI System tableEFI System table

�� Runtime servicesRuntime services

�� Boot servicesBoot services

�� ProtocolsProtocols

�� GUIDsGUIDs

Page 43: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

What is EFI?: Services and ProtocolsWhat is EFI?: Services and Protocols

�� Binds EFI services to all EFI protocols Binds EFI services to all EFI protocols and applicationsand applications

�� Pointer to system table is passed to Pointer to system table is passed to image at initializationimage at initialization

Page 44: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

What is EFI?: Services and ProtocolsWhat is EFI?: Services and Protocols

EFI System Table Pointer

Runtime Services ptrBoot Services ptr

Boot ServicesRuntime Services

Page 45: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

What is EFI?: Services and ProtocolsWhat is EFI?: Services and Protocols

�� Boot time and runtimeBoot time and runtime

�� Timer, Wakeup alarmTimer, Wakeup alarm��Requires processor sync in MP systemsRequires processor sync in MP systems

��Opens path to future legacy migrationOpens path to future legacy migration

�� VariablesVariables��Boot manager handshakeBoot manager handshake

�� System resetSystem reset

Minimal set to meet OSV needsMinimal set to meet OSV needs

Page 46: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

What is EFI?: Services and ProtocolsWhat is EFI?: Services and Protocols

�� Events and notificationsEvents and notifications��Polled devices, no interruptsPolled devices, no interrupts

�� Watchdog timerWatchdog timer��Elegant recoveryElegant recovery

�� Memory allocationMemory allocation�� Handle locationHandle location�� Image loadingImage loading

��Drivers, applications, OS loaderDrivers, applications, OS loader

Complete, but size efficientComplete, but size efficient

Page 47: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

What is EFI?: Services and ProtocolsWhat is EFI?: Services and Protocols

�� GUID, Interface Structure, ServicesGUID, Interface Structure, Services�� DEVICE_PATH, DEVICE_IO, BLOCK_IO, DISK_IO, FILE_SYSTEM, DEVICE_PATH, DEVICE_IO, BLOCK_IO, DISK_IO, FILE_SYSTEM, SIMPLE_INPUT, SIMPLE_TEXT_OUTPUT, SERIAL_IO, PXE_BC, SIMPLE_INPUT, SIMPLE_TEXT_OUTPUT, SERIAL_IO, PXE_BC, SIMPLE_NETWORK, LOAD_FILE, UNICODE_COLLATIONSIMPLE_NETWORK, LOAD_FILE, UNICODE_COLLATION

Handle

GUID Interface

GUID Interface

... ... Protocol InterfaceFunction pointer

Device specificcontext

Function pointer...

HandleProtocol(GUID..)

BlkIo->ReadBlocks(BlkIo, …)

EFI Driver

Page 48: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

What is EFI?: Services and ProtocolsWhat is EFI?: Services and Protocols

OS Loader

EFI Firmware

Driver

PC-AT KBD

USB thunk

Legacy BIOS

Keyboard

Simple_text_in

Initial implementation

Simplified design

Simplified design

Page 49: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

What is EFI?: Services and ProtocolsWhat is EFI?: Services and Protocols

OS Loader

EFI Firmware

USB Keyboard

Simple_text_in

USB Driver

“Legacy Free”

OS Loader

EFI Firmware

Driver

PC-AT KBD

USB thunk

Legacy BIOS

Keyboard

Simple_text_in

Initial implementation

Simplified design

Simplified design

Page 50: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

What is EFI?: Services and ProtocolsWhat is EFI?: Services and Protocols

OS Loader

EFI Firmware

USB Keyboard

Simple_text_in

USB Driver

“Legacy Free”

xxx Driver

xxx Keyboard

OS Loader

EFI Firmware

Driver

PC-AT KBD

USB thunk

Legacy BIOS

Keyboard

Simple_text_in

Initial implementation

Simplified design

Simplified design

Page 51: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

What is EFI?: Services and ProtocolsWhat is EFI?: Services and Protocols

�� Abstracted for flexibilityAbstracted for flexibility�� Support optionsSupport options

��Local headLocal head–– Character basedCharacter based–– Graphical (not implemented yet)Graphical (not implemented yet)

��Remote headRemote head–– Serial linkSerial link–– NetworkNetwork

Implementation choicesImplementation choices

Page 52: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

What is EFI?What is EFI?

�� ““GGuaranteed” uaranteed” UUnique nique IdIdentityentity��128128--bit quantity defined by WfM 2.0 specbit quantity defined by WfM 2.0 spec

�� Polices extensibility mechanismPolices extensibility mechanism

�� Allows publishing of new capabilitiesAllows publishing of new capabilities��GUIDGUID

��InterfacesInterfaces

Safe co-existence of 3rd party extensionsSafe co-existence of 3rd party extensions

Page 53: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

What is EFI?What is EFI?

�� ApplicationApplication��OS Loader OS Loader -- EFI application that takes EFI application that takes

final controlfinal control��DiagnosticsDiagnostics��Recovery toolsRecovery tools��Customer support appsCustomer support apps

�� DriverDriver��Boot support for addBoot support for add--insins��Code modulesCode modules

–– e.g. downloadable workaroundse.g. downloadable workarounds

Differentiationopportunity

Page 54: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� Boot manager updated in Chapter 17Boot manager updated in Chapter 17�Minor changes to default behavior�Shorthand for hard drive device paths�Boot option environment variable format extended�May affect OEM Boot Manager customization

�� General bug fixes and clarificationsGeneral bug fixes and clarifications

Changes to match customer feedback Changes to match customer feedback

Page 55: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� Functionally replaces Legacy BBS Functionally replaces Legacy BBS

�� Order of processing load optionsOrder of processing load options��Driver order optionsDriver order options

–– load any drivers specified in Driver option listload any drivers specified in Driver option list

��Check Boot Next featureCheck Boot Next feature–– This feature is for OS setup so that on next boot this This feature is for OS setup so that on next boot this

option is selected once and then removed from the listoption is selected once and then removed from the list

��Boot option listBoot option list–– see next slide for example case of options stored in see next slide for example case of options stored in

NVRAM with boot maintenance menu.NVRAM with boot maintenance menu.

Page 56: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

failure

timeout

Boot option 1

EFI OSLoader

EFI SYSTEMPARTITION

Bootoption 2

failure

failure

Bootoption 3

server

OS BOOTLOADER

BOOTIA64.EFI

Boot diagnosticBoot option 4

LAN

Page 57: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� The only interface the end user should seeThe only interface the end user should see

�� Executes policy for ordering of EFI boot devicesExecutes policy for ordering of EFI boot devices

�� Example boot manager in EFI core source on Example boot manager in EFI core source on websitewebsite

�� Uses EFI variables to store paths and boot orderUses EFI variables to store paths and boot order

�� OEM should customize boot manager for look and OEM should customize boot manager for look and feel as well as securityfeel as well as security

�� For production boot straight to the OSFor production boot straight to the OS�� do not need to use built in Shell or startup.do not need to use built in Shell or startup.nshnsh

Page 58: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� How to specify where the How to specify where the osos loader isloader is��Utilize full EFI device path to boot deviceUtilize full EFI device path to boot device

–– E.g. ACPI E.g. ACPI -- PCI PCI -- SCSI SCSI -- partition(SIG) partition(SIG) –– FilenameFilename–– E.g. ACPI E.g. ACPI -- PCI PCI -- MAC(MAC address)MAC(MAC address)

��Hard disk Hard disk –– short path option which only consists of partition short path option which only consists of partition

ID and filename or:ID and filename or:–– GPT version is safer since it is unique.GPT version is safer since it is unique.

��Removable media (CDROM and LS120)Removable media (CDROM and LS120)–– \\EFIEFI\\BOOTBOOT\\BOOTIA64.EFI or BOOTIA32.EFIBOOTIA64.EFI or BOOTIA32.EFI

Page 59: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

AP

I

SAL

EFI

IA64 OSLegacy OS:

DOS, NT 4.0, …

PAL

Boot Manager

IA-32

IA-64

AP

IA

PI

Legacy BIOS

Page 60: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� EFI services not available at runtimeEFI services not available at runtime

�� No SAL or PAL API availableNo SAL or PAL API available

�� Only services available are Legacy IAOnly services available are Legacy IA--32 32 BIOSBIOS

�� DOS tests will not test DOS tests will not test Itanium Itanium PlatformPlatform

Migrate Legacy Preboot Apps to EFIMigrate Legacy Preboot Apps to EFI

Page 61: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� Industry Intercept on IAIndustry Intercept on IA--6464�� Intel POR is to use EFI starting at powerIntel POR is to use EFI starting at power--onon

�� AMI and Phoenix implementing EFIAMI and Phoenix implementing EFI

�� OEMs platforms supporting EFIOEMs platforms supporting EFI

�� IAIA--64 operating systems being developed with EFI64 operating systems being developed with EFI–– IBM/Monterey, Linux, Novell, SCO, Solaris, Windows NTIBM/Monterey, Linux, Novell, SCO, Solaris, Windows NT

�� IAIA--32 intercept timing less clear, but:32 intercept timing less clear, but:�� EFI being implemented for embedded systemsEFI being implemented for embedded systems

�� Manufacturing/test infrastructure moving to EFIManufacturing/test infrastructure moving to EFI

Industry momentumIndustry momentum

Page 62: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� EFI is a key component in DIG64EFI is a key component in DIG64�� Enables migration away from legacyEnables migration away from legacy

�� UNIX Design GuideUNIX Design Guide�� Additional implementation requirements Additional implementation requirements

Foundation for system designFoundation for system design

Page 63: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� Complete sample implementation of EFIComplete sample implementation of EFI�� Architecture neutral, IAArchitecture neutral, IA--32 and IA32 and IA--64 builds64 builds

�� Code, build tools and documentationCode, build tools and documentation–– EFI core interface implementationEFI core interface implementation

–– EFI library routinesEFI library routines

–– EFI developer’s guideEFI developer’s guide

–– Sample driversSample drivers

�� Readily availableReadily available��Simple shrinkSimple shrink--wrap license, downloadable codewrap license, downloadable code

Low barrier to adoptionLow barrier to adoption

Page 64: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� EFI Application ToolkitEFI Application Toolkit�� Architecture neutral, IAArchitecture neutral, IA--32 and IA32 and IA--64 builds64 builds

�� Code, build tools and documentationCode, build tools and documentation–– EFI Shell and applicationsEFI Shell and applications

–– Standard library ported from Standard library ported from FreeBSDFreeBSD– libc, libsocket, libm

–– Complete network stack and utilitiesComplete network stack and utilities

–– Python scripting supportPython scripting support

–– Unix style HTML manual pagesUnix style HTML manual pages

�� Readily availableReadily available��Simple shrinkSimple shrink--wrap license, downloadable codewrap license, downloadable code

Low barrier to adoptionLow barrier to adoption

Page 65: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� Intel EFI websiteIntel EFI website

��http://developer.http://developer.intelintel.com/technology/EFI.com/technology/EFI

��feedback form on websitefeedback form on website

��register with EFI mailing list on websiteregister with EFI mailing list on website

�� Intel SDV customer Quad supportIntel SDV customer Quad support–– http://support.http://support.intelintel.com/support/go/.com/support/go/ItaniumSDVItaniumSDV

–– http://premier.http://premier.intelintel.com/.com/

�� IAIA--64 64 Itanium Itanium software Areasoftware Area�� http://developer.http://developer.intelintel.com/design/servers/.com/design/servers/softdevsoftdev/ia64./ia64.htmhtm

Page 66: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� Lan Lan BootBoot��PXE/UNDI located on WFM websitePXE/UNDI located on WFM website

–– PDK include DLL’s for NT4 serverPDK include DLL’s for NT4 server

–– Lan Lan PXE/UNDI option PXE/UNDI option rom rom image and kitimage and kit

��http://developer.http://developer.intelintel.com/.com/ialial//wfmwfm/index./index.htmhtm

Page 67: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

Page 68: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� Download the specDownload the spec�� ����������������������������� ��� ��������������������������

�� Read it; send feedbackRead it; send feedback�� Contribute to ToolkitContribute to Toolkit�� The only way to boot on IAThe only way to boot on IA--64 64

is with EFIis with EFI�� EFI aware operating system EFI aware operating system

loadersloaders�� EFI conformant platform firmwareEFI conformant platform firmware�� PrePre--boot EFI applicationsboot EFI applications

�� migrate tests to EFI migrate tests to EFI applicationsapplications

OEM

OSV

IBV

Page 69: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� Specification websitesSpecification websites

�� EDD 3.0 spec draft 4EDD 3.0 spec draft 4 -- http://T13.orghttp://T13.org� ftp://fission.dt.wdc.com/pub/standards/x3t13/project/d1386r4.pdf

�� EFI FAT32 Specification (see below)EFI FAT32 Specification (see below)

�� PE/COFF Image Format SpecificationPE/COFF Image Format Specification�� http://www.http://www.microsoftmicrosoft.com/.com/hwdevhwdev/specs/specs

�� Intel MSL SAL SpecificationIntel MSL SAL Specification�� http://developer.http://developer.intelintel.com/design/IA.com/design/IA--64/Downloads/24535901.64/Downloads/24535901.pdfpdf

�� Developer Interface Guide for IA64Developer Interface Guide for IA64�� http://www.developer.http://www.developer.intelintel.com/design/servers/dev_guides.com/design/servers/dev_guides

Page 70: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� OverviewOverview�� DocumentationDocumentation�� Shell and Boot ManagerShell and Boot Manager�� Directory StructureDirectory Structure�� Development EnvironmentsDevelopment Environments�� EFI Application Toolkit OverviewEFI Application Toolkit Overview�� Sample ApplicationsSample Applications�� EFI/SAL IntegrationEFI/SAL Integration�� Open LabOpen Lab

Page 71: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

Page 72: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� Must match spec revision with toolkit and sample Must match spec revision with toolkit and sample implementation build (especially c library).implementation build (especially c library).

�� 0.92 spec matches 0.92.0.92 spec matches 0.92.majmaj.min sample code reference .min sample code reference implementation (92.10.8) and toolkit revision 0.72implementation (92.10.8) and toolkit revision 0.72

�� 0.99 spec matches 0.99.0.99 spec matches 0.99.majmaj.min sample code reference .min sample code reference implementation (.99.12.20) and toolkit revision 0.8implementation (.99.12.20) and toolkit revision 0.8

�� Lion bios 40Lion bios 40--62 0.99.12.21 EFI (use 0.8 toolkit)62 0.99.12.21 EFI (use 0.8 toolkit)

�� Lion bios 63> 0.9912.31 EFI (use 0.9 toolkit)Lion bios 63> 0.9912.31 EFI (use 0.9 toolkit)

�� Big Big Sur Sur Bios 45Bios 45--76 has 0.99.12.20 EFI (use 0.8 toolkit)76 has 0.99.12.20 EFI (use 0.8 toolkit)

�� Big Big Sur Sur Bios 77.. Has 0.99.12.31 EFI (use 0.9 toolkit)Bios 77.. Has 0.99.12.31 EFI (use 0.9 toolkit)

Page 73: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� EFI Specification 0.99EFI Specification 0.99��http://developer.http://developer.intelintel.com/technology/.com/technology/efiefi

�� EFI Sample Implementation 0.99.12.20EFI Sample Implementation 0.99.12.20��http://developer.http://developer.intelintel.com/technology/.com/technology/efiefi

�� EFI Developer’s GuideEFI Developer’s Guide��efiefi\\notesnotes\\EFI_DG.DOCEFI_DG.DOC

�� EFI Library SpecificationEFI Library Specification��efiefi\\notesnotes\\EFI_LIB.DOCEFI_LIB.DOC

�� EFI Release NotesEFI Release Notes��efiefi\\notesnotes\\RELNOTE.DOCRELNOTE.DOC

Page 74: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� Boot time servicesBoot time services

�� Run time servicesRun time services

�� ProtocolsProtocols

�� File System FormatFile System Format��Legacy Partitioning SchemeLegacy Partitioning Scheme

��New Partitioning SchemeNew Partitioning Scheme

�� PCI Expansion ROMsPCI Expansion ROMs

Page 75: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

–– DEVICE_PATHDEVICE_PATH

–– DEVICE_IODEVICE_IO

–– SIMPLE_INPUT_INTERFACESIMPLE_INPUT_INTERFACE

–– SIMPLE_TEXT_OUTPUT_INTERFACESIMPLE_TEXT_OUTPUT_INTERFACE

–– BLOCK_IOBLOCK_IO

–– DISK_IODISK_IO

–– SIMPLE_FILE_SYSTEMSIMPLE_FILE_SYSTEM

–– LOAD_FILELOAD_FILE

–– SERIAL_IOSERIAL_IO

–– UNICODE_COLLATIONUNICODE_COLLATION

–– PXE_BCPXE_BC

–– SIMPLE_NETWORKSIMPLE_NETWORK

Page 76: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� EFI Shell CommandsEFI Shell Commands

�� Writing EFI Shell Commands *Writing EFI Shell Commands *

�� Writing EFI Applications *Writing EFI Applications *

�� Writing EFI OS Loaders *Writing EFI OS Loaders *

�� Function SummaryFunction Summary–– Boot Time Service FunctionsBoot Time Service Functions

–– Run Time Service FunctionsRun Time Service Functions

–– Protocol FunctionsProtocol Functions

–– Library FunctionsLibrary Functions

* Material is out of date. Updates will be released soon.* Material is out of date. Updates will be released soon.

Page 77: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

–– Initialization FunctionsInitialization Functions

–– Linked List Support MacrosLinked List Support Macros

–– String FunctionsString Functions

–– Memory Support FunctionsMemory Support Functions

–– CRC Support FunctionsCRC Support Functions

–– Text I/O FunctionsText I/O Functions

–– Math FunctionsMath Functions

–– Spin Lock FunctionsSpin Lock Functions

–– Handle and Protocol Support FunctionsHandle and Protocol Support Functions

–– File I/O Support FunctionsFile I/O Support Functions

–– Device Path Support FunctionsDevice Path Support Functions

–– Miscellaneous Functions and MacrosMiscellaneous Functions and Macros

Page 78: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� EFI shellEFI shell

�� Common UtilitiesCommon Utilities

�� LibcLibc

�� Network StackNetwork Stack

�� Multiple Processor Test SupportMultiple Processor Test Support

�� Platform ManagementPlatform Management

�� Security ServiceSecurity Service

Useful tools for EFIapplication development

Useful tools for EFIapplication development

Source isAvailable on

Website

Page 79: Introduction to EFI

®®

OS

Lo

ader

Har

dw

are

BIO

S

EF

I

Compatibility

Har

dw

are

EFI Shell

Utilities

Libc

Network

MP Test

Management

Security

Page 80: Introduction to EFI

®®

OS

Lo

ader

Har

dw

are

BIO

S

EF

I

Compatibility

Har

dw

are

EFI Shell

Utilities

Libc

Network

MP Test

Management

Security

EF

I AP

IE

FI A

PI

EF

I AP

I

Page 81: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

Toolkit ComponentsToolkit Components

�Core utilities��cp, cp, rmrm, , mkdirmkdir, type, ….., type, …..

�Extended utilities��Network utilitiesNetwork utilities

–– FTP client and server, pingFTP client and server, ping

��Text editorText editor

�Scripting interpreter (Python)

Page 82: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

Toolkit ComponentsToolkit Components

�SMBIOS Interface��Library routines for parsing SMBIOS Library routines for parsing SMBIOS

tablestables

� IPMI 1.0 Interface��EFI protocol for sending and receiving EFI protocol for sending and receiving

IPMI messagesIPMI messages

Page 83: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

Toolkit ComponentsToolkit Components

�Port of FreeBSD TCP/IP stack�Supports standard protocols

��IPv4, ICMP, ARP, UDP, TCPIPv4, ICMP, ARP, UDP, TCP

�Socket library interface� Implemented as an EFI protocol

Network functionality in FWNetwork functionality in FW

Page 84: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

Toolkit ComponentsToolkit Components

� Limited but extensible platform security

��Service that application may choose to useService that application may choose to use

��Common security interfaceCommon security interface

��Customizable security policiesCustomizable security policies� Provide reference implementation

��Unix style password fileUnix style password file

��OneOne--way encryption way encryption

–– Given user and password.. “is this user Given user and password.. “is this user authenticated ?”authenticated ?”

Rudimentary application securityRudimentary application security

Page 85: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� Similar to KD for NT or GDB for LinuxSimilar to KD for NT or GDB for Linux

�� Source disassemblySource disassembly

�� Uses serial port from another IA32 PCUses serial port from another IA32 PC

�� Enable debuggingEnable debugging

��EFI applications, drivers, and protocolsEFI applications, drivers, and protocols

�� Intel compiler supportIntel compiler support

�� Available as part of ToolkitAvailable as part of Toolkit

Page 86: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� Without debugger utilize Error ConsoleWithout debugger utilize Error Console

�� Use Debug Macro to Use Debug Macro to printf printf errors/infoerrors/info

�� EFI global variable sets Error Console EFI global variable sets Error Console output (setup in boot manager)output (setup in boot manager)

�� to Serial port (logged on another pc)to Serial port (logged on another pc)

�� to Video Screento Video Screen

Page 87: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

Toolkit ComponentsToolkit Components

EFI app.

Debug GUI

Page 88: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

Toolkit ComponentsToolkit Components

EFI app.

Debug GUI� Enable debugging

��EFI applications, drivers, and protocolsEFI applications, drivers, and protocols

Page 89: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

Toolkit ComponentsToolkit Components

EFI app.

Debug GUI� Enable debugging

��EFI applications, drivers, and protocolsEFI applications, drivers, and protocols

� User interface ��Provided by “commercial” debuggerProvided by “commercial” debugger��Requires debugger with remote debug Requires debugger with remote debug

capabilitycapability

Page 90: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

Toolkit ComponentsToolkit Components

EFI app.

Debug GUI� Enable debugging

��EFI applications, drivers, and protocolsEFI applications, drivers, and protocols

� User interface ��Provided by “commercial” debuggerProvided by “commercial” debugger��Requires debugger with remote debug Requires debugger with remote debug

capabilitycapability

� Toolkit agent ��Can be customized for remote protocolsCan be customized for remote protocols��Intel Enhanced Debugger (EDB) referenceIntel Enhanced Debugger (EDB) reference

–– EDB is included in the IAEDB is included in the IA--64 SDK64 SDK

Page 91: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

Toolkit ComponentsToolkit Components

EFI app.

Debug GUI� Enable debugging

��EFI applications, drivers, and protocolsEFI applications, drivers, and protocols

� User interface ��Provided by “commercial” debuggerProvided by “commercial” debugger��Requires debugger with remote debug Requires debugger with remote debug

capabilitycapability

� Toolkit agent ��Can be customized for remote protocolsCan be customized for remote protocols��Intel Enhanced Debugger (EDB) referenceIntel Enhanced Debugger (EDB) reference

–– EDB is included in the IAEDB is included in the IA--64 SDK64 SDK

�Firmware” source debug�Firmware” source debug

Page 92: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� Toolkit adopters are free to make Toolkit adopters are free to make source code changessource code changes��There are no restrictions on differentiationThere are no restrictions on differentiation

�� CollaborationCollaboration��We will incorporate changes that are voluntarily We will incorporate changes that are voluntarily

returned and benefit industry as a wholereturned and benefit industry as a whole

��Looking for submissions: SCSI protocol, ASPI Looking for submissions: SCSI protocol, ASPI protocol, …protocol, …

Page 93: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� Still uses legacy IA32 option Still uses legacy IA32 option rom rom codecode

�� No illegal assembly instructions for x86 No illegal assembly instructions for x86 environment as defined in SAL specificationenvironment as defined in SAL specification

�� EDD 3.0 draft 4 requirement for all plug in EDD 3.0 draft 4 requirement for all plug in card optioncard option roms roms

�� Only effects plug in cards with boot devices Only effects plug in cards with boot devices

�� Determine if in IA64 platform with _FIT_Determine if in IA64 platform with _FIT_

�� Migrate option Migrate option rom rom setup programs to EFI setup programs to EFI applicationsapplications

Page 94: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

EFI

SAL

Legacy BIOS

Option ROM

Boot manager

EFI TESTSOS PARTITIONEFI OSLoader

EFI SYSTEMPARTITION

IHV

OEM MFGOEM MFG

EFI Shell

EFI Driver

Page 95: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� OverviewOverview�� DocumentationDocumentation�� Shell and Boot ManagerShell and Boot Manager�� Directory StructureDirectory Structure�� Development EnvironmentsDevelopment Environments�� EFI Application Toolkit OverviewEFI Application Toolkit Overview�� Sample ApplicationsSample Applications�� EFI/SAL IntegrationEFI/SAL Integration�� Open LabOpen Lab

Page 96: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

Page 97: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

��

��

��

��

��

��

��

Page 98: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� helphelp

�� dhdh

�� mapmap

�� guidguid

�� aliasalias

�� setset

�� exitexit

�� cdcd

Page 99: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

Shell>helpShell>help

help [internal command] help [internal command] -- Displays this helpDisplays this help

guidguid [[snamesname] ] -- Dump knownDump known guidguid idsids

set [set [--d] [d] [snamesname] [value] ] [value] -- Set/get environment variableSet/get environment variable

alias [alias [--d] [d] [snamesname] [value] ] [value] -- Set/get alias settingsSet/get alias settings

dh [dh [--pp protprot_id] | [handle] _id] | [handle] -- Dump handle infoDump handle info

map [map [--dvrdvr] [] [snamesname[:]] [handle] [:]] [handle] -- MapMap shortnameshortname to device pathto device path

cdcd [path] [path] -- Updates the current directoryUpdates the current directory

echo [[echo [[--on | on | --off] | [text] off] | [text] -- Echo text toEcho text to stdoutstdout or toggle script echoor toggle script echo

if [not] condition then if [not] condition then -- ScriptScript--only: Condition is "string1 == string2"only: Condition is "string1 == string2"

or "exist file"or "exist file"

endif endif -- ScriptScript--only: Terminate effect of if commandonly: Terminate effect of if command

gotogoto label label -- ScriptScript--only: Jump to label location in scriptonly: Jump to label location in script

forfor varvar in <set> in <set> -- ScriptScript--only: loop constructonly: loop construct

endfor endfor -- ScriptScript--only: delimiter for loop constructonly: delimiter for loop construct

pause pause -- ScriptScript--only: prompt to quit or continueonly: prompt to quit or continue

Page 100: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

dh [dh [--p prot_id] | [handle]p prot_id] | [handle]

[[--p prot_id]p prot_id] Protocol to dumpProtocol to dump

[handle][handle] Handle number to dumpHandle number to dump

Shell> dhShell> dh

1: varstore 1: varstore

2: varstore 2: varstore

3: Image(dskio) 3: Image(dskio)

4: Image(pblkio) 4: Image(pblkio)

5: Image(fat) 5: Image(fat)

6: DevIo DevPath()6: DevIo DevPath()

7: unicode 7: unicode

8: txtin DevPath(..,0)/Pci(0|0)/Acpi(PNP0303,0))8: txtin DevPath(..,0)/Pci(0|0)/Acpi(PNP0303,0))

9: txtout DevPath(Acpi(PNP0A03,0)/Pci(3|0))9: txtout DevPath(Acpi(PNP0A03,0)/Pci(3|0))

A: diskio blkio fs DevPath(..,0)/Pci(0|0)/Acpi(PNP0604,0))A: diskio blkio fs DevPath(..,0)/Pci(0|0)/Acpi(PNP0604,0))

B: diskio blkio DevPath(VenHw(Unknown Device:80))B: diskio blkio DevPath(VenHw(Unknown Device:80))

......

Page 101: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

Shell> dh Shell> dh ––p fsp fs

A: diskio blkio fs DevPath(..,0)/Pci(0|0)/Acpi(PNP0604,0))A: diskio blkio fs DevPath(..,0)/Pci(0|0)/Acpi(PNP0604,0))

C: diskio blkio fs DevPath(..vice:80)/HD(Part1,Sig1C: diskio blkio fs DevPath(..vice:80)/HD(Part1,Sig1--F4A3))F4A3))

E: diskio blkio fs DevPath(..,Sig1E: diskio blkio fs DevPath(..,Sig1--F4A3)/HD(Part1,Sig1F4A3)/HD(Part1,Sig1--0))0))

10: diskio blkio fs DevPath(..rt2,Sig110: diskio blkio fs DevPath(..rt2,Sig1--0)/HD(Part1,Sig10)/HD(Part1,Sig1--0))0))

Shell> dh AShell> dh A

Handle 0A (07FC6E08)Handle 0A (07FC6E08)

diskio diskio

blkio Fixed MId:1 bsize 200, lblock B40 (1,474,560), raw rw cblkio Fixed MId:1 bsize 200, lblock B40 (1,474,560), raw rw cached fs ached fs

dpath dpath

PNP Device Path for PnPPNP Device Path for PnP

HID A0341D0, UID 0HID A0341D0, UID 0

Hardware Device Path for PCIHardware Device Path for PCI

PNP Device Path for PnPPNP Device Path for PnP

HID 60441D0, UID 0HID 60441D0, UID 0

AsStr: 'Acpi(PNP0A03,0)/Pci(0|0)/Acpi(PNP0604,0)'AsStr: 'Acpi(PNP0A03,0)/Pci(0|0)/Acpi(PNP0604,0)'

Page 102: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

map [map [--dvr] [sname] [handle]dvr] [sname] [handle]

[[--d]d] Delete a mappingDelete a mapping

[[--v]v] Verbose listing of mappingsVerbose listing of mappings

[[--r] Regenerate default mappingsr] Regenerate default mappings

[sname][sname] A user defined name for the mappingA user defined name for the mapping

Can use “” to include white space Can use “” to include white space

[handle][handle] The handle number from the dh commandThe handle number from the dh command

Shell> mapShell> map

Device mapping tableDevice mapping table

fs0 : Acpi(PNP0A03,0)/Pci(0|0)/Acpi(PNP0604,0)fs0 : Acpi(PNP0A03,0)/Pci(0|0)/Acpi(PNP0604,0)

blk0 : Acpi(PNP0A03,0)/Pci(0|0)/Acpi(PNP0604,0)blk0 : Acpi(PNP0A03,0)/Pci(0|0)/Acpi(PNP0604,0)

blk1 : VenHw(Unknown Device:80)blk1 : VenHw(Unknown Device:80)

blk2 : VenHw(Unknown Device:80)/HD(Part1,Sig1blk2 : VenHw(Unknown Device:80)/HD(Part1,Sig1--B3C8)B3C8)

fs1 : VenHw(Unknown Device:80)/HD(Part1,Sig1fs1 : VenHw(Unknown Device:80)/HD(Part1,Sig1--F4A3)F4A3)

Page 103: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

Shell> map D CShell> map D C

Shell> mapShell> map

Device mapping tableDevice mapping table

fs0 : Acpi(PNP0A03,0)/Pci(0|0)/Acpi(PNP0604,0)fs0 : Acpi(PNP0A03,0)/Pci(0|0)/Acpi(PNP0604,0)

blk0 : Acpi(PNP0A03,0)/Pci(0|0)/Acpi(PNP0604,0)blk0 : Acpi(PNP0A03,0)/Pci(0|0)/Acpi(PNP0604,0)

blk1 : VenHw(Unknown Device:80)blk1 : VenHw(Unknown Device:80)

blk2 : VenHw(Unknown Device:80)/HD(Part1,Sig1blk2 : VenHw(Unknown Device:80)/HD(Part1,Sig1--B3C8)B3C8)

fs1 : VenHw(Unknown Device:80)/HD(Part1,Sig1fs1 : VenHw(Unknown Device:80)/HD(Part1,Sig1--F4A3)F4A3)

D : VenHw(Unknown Device:80)/HD(Part1,Sig1D : VenHw(Unknown Device:80)/HD(Part1,Sig1--F4A3)F4A3)

Shell> map Shell> map ––v Dv D

D : VenHw(Unknown Device:80)/HD(Part1,Sig1D : VenHw(Unknown Device:80)/HD(Part1,Sig1--F4A3)F4A3)

= Handle C: diskio blkio fs = Handle C: diskio blkio fs

> > \\

Shell> map Shell> map ––d Dd D

Page 104: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

Shell> guidShell> guid

DevIo : AF6AC311DevIo : AF6AC311--84C384C3--11D211D2--8E3C8E3C--00A0C969723B00A0C969723Bdiskio : CE345171diskio : CE345171--BA0BBA0B--11D211D2--8E4F8E4F--00A0C969723B00A0C969723Bblkio : 964E5B21blkio : 964E5B21--64596459--11D211D2--8E398E39--00A0C969723B *00A0C969723B *txtin : 387477C1txtin : 387477C1--69C769C7--11D211D2--8E398E39--00A0C969723B00A0C969723Btxtout : 387477C2txtout : 387477C2--69C769C7--11D211D2--8E398E39--00A0C969723B *00A0C969723B *fs : 964E5B22fs : 964E5B22--64596459--11D211D2--8E398E39--00A0C969723B00A0C969723Bload : 56EC3091load : 56EC3091--954C954C--11D211D2--8E3F8E3F--00A0C969723B00A0C969723Bimage : 5B1B31A1image : 5B1B31A1--95629562--11D211D2--8E3F8E3F--00A0C969723B *00A0C969723B *varstore : F088CD91varstore : F088CD91--A046A046--11D211D2--8E428E42--00A0C969723B00A0C969723Bdpath : 09576E91dpath : 09576E91--6D3F6D3F--11D211D2--8E398E39--00A0C969723B *00A0C969723B *unicode : 1D85CD7Funicode : 1D85CD7F--F43DF43D--11D211D2--9A0C9A0C--0090273FC14D0090273FC14Dpxe : 01949C4Cpxe : 01949C4C--94969496--11D211D2--85E185E1--00A0C93EC93B00A0C93EC93BShellInt : 47C7B223ShellInt : 47C7B223--C42AC42A--11D211D2--8E578E57--00A0C969723B00A0C969723BSEnv : 47C7B224SEnv : 47C7B224--C42AC42A--11D211D2--8E578E57--00A0C969723B00A0C969723BShellProtId : 47C7B226ShellProtId : 47C7B226--C42AC42A--11D211D2--8E578E57--00A0C969723B00A0C969723BShellDevPathMap : 47C7B225ShellDevPathMap : 47C7B225--C42AC42A--11D211D2--8E578E57--00A0C969723B00A0C969723BShellAlias : 47C7B227ShellAlias : 47C7B227--C42AC42A--11D211D2--8E578E57--00A0C969723B00A0C969723BG0 : 00000000G0 : 00000000--00000000--00000000--00000000--000000000000000000000000Efi : 8BE4DF61Efi : 8BE4DF61--93CA93CA--11D211D2--AA0DAA0D--00E098032B8C00E098032B8CGenFileInfo : 09576E92GenFileInfo : 09576E92--6D3F6D3F--11D211D2--8E398E39--00A0C969723B00A0C969723BFileSysInfo : 09576E93FileSysInfo : 09576E93--6D3F6D3F--11D211D2--8E398E39--00A0C969723B00A0C969723BPcAnsi : E0C14753PcAnsi : E0C14753--F9BEF9BE--11D211D2--9A0C9A0C--0090273FC14D0090273FC14DUnknown Device : CF31FAC5Unknown Device : CF31FAC5--C24EC24E--11D211D2--85F385F3--00A0C93EC93B00A0C93EC93Bg1 : 43D66E51g1 : 43D66E51--AD78AD78--11D211D2--8E4B8E4B--00A0C969723B00A0C969723Bg2 : 386F4BBCg2 : 386F4BBC--77827782--11D211D2--85D685D6--00A0C93EC93B00A0C93EC93Bg3 : EFE309D1g3 : EFE309D1--ACA9ACA9--11D211D2--85E285E2--00A0C93EC93B00A0C93EC93B

Page 105: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

alias [alias [--d] [sname] [value]d] [sname] [value]

[[--d]d] Delete the aliasDelete the alias

[sname][sname] Alias nameAlias name

Can use “” to include white spaceCan use “” to include white space

[value][value] EFI command or EFI applicationEFI command or EFI application

Shell> aliasShell> alias

dir : lsdir : ls

md : mkdirmd : mkdir

rd : rmrd : rm

del : rmdel : rm

copy : cpcopy : cp

Shell> alias myguid guidShell> alias myguid guid

Shell> alias Shell> alias ––d myguidd myguid

Note : Recursion is not supportedNote : Recursion is not supported

Page 106: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

set [set [--d] [sname] [value]d] [sname] [value]

[[--d]d] Delete the environment variable Delete the environment variable

[sname][sname] Environment variable nameEnvironment variable name

Can use “” to include white spaceCan use “” to include white space

[value][value] Environment variable valueEnvironment variable value

Can use “” to include white spaceCan use “” to include white space

Shell> setShell> set

path : fs0:path : fs0:\\efiefi\\tools;fs0:tools;fs0:\\;.;.

Shell> set DiagnosticPath fs0:Shell> set DiagnosticPath fs0:\\efiefi\\diagdiag

Shell> setShell> set

path : fs0:path : fs0:\\efiefi\\tools;fs0:tools;fs0:\\;.;.

DiagnosticPath : fs0:DiagnosticPath : fs0:\\efiefi\\diagdiag

Page 107: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

Shell> set Shell> set ––d DiagnosticPath d DiagnosticPath

Shell> setShell> set

path : fs0:path : fs0:\\efiefi\\tools;fs0:tools;fs0:\\;.;.

Shell> set “This String” “This is a string”Shell> set “This String” “This is a string”

Shell> setShell> set

path : fs0:path : fs0:\\efiefi\\tools;fs0:tools;fs0:\\;.;.

This String : This is a stringThis String : This is a string

Shell> set pathShell> set path

path : fs0:path : fs0:\\efiefi\\tools;fs0:tools;fs0:\\;.;.

Shell> set Shell> set ––d “This String”d “This String”

Page 108: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� Returns control to the EFI Application that Returns control to the EFI Application that launched the EFI Shelllaunched the EFI Shell��Could be the EFI Boot ManagerCould be the EFI Boot Manager

��Could be another copy of the EFI ShellCould be another copy of the EFI Shell

Page 109: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� Changes the current working directoryChanges the current working directory

�� Syntax similar to DOS CD commandSyntax similar to DOS CD command

Page 110: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� lsls

�� mkdirmkdir

�� cpcp

�� rmrm

�� typetype

�� loadload

�� nshellnshell

�� memmapmemmap

�� modemode

�� verver

�� datedate

�� timetime

Page 111: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� Displays a directory on the displayDisplays a directory on the display

�� Syntax similar to DOS DIR commandSyntax similar to DOS DIR command

Page 112: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� Creates a new subdirectory Creates a new subdirectory

�� Syntax similar to the DOS MKDIR commandSyntax similar to the DOS MKDIR command

Page 113: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� Copies one or more files from one directory Copies one or more files from one directory to anotherto another

�� Syntax similar to the DOS COPY commandSyntax similar to the DOS COPY command

Page 114: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� Removes one or more files or directoriesRemoves one or more files or directories

�� Syntax similar to DOS DEL commandSyntax similar to DOS DEL command

�� Syntax similar to DOS RMDIR commandSyntax similar to DOS RMDIR command

Page 115: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

type [type [--a] filea] file

[[--a]a] Display the file as ASCII characters.Display the file as ASCII characters.

�� Send the contents of a file to the displaySend the contents of a file to the display

�� Supports both ASCII and UNICODE filesSupports both ASCII and UNICODE files

�� Syntax similar to DOS TYPE commandSyntax similar to DOS TYPE command

Page 116: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

load fileload file

�� Loads an EFI driverLoads an EFI driver

Page 117: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

nshellnshell

�� Launches another copy of the EFI ShellLaunches another copy of the EFI Shell

Page 118: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

Shell>Shell>memmapmemmap

Type Start End # Pages AType Start End # Pages Attributesttributesavailable 00000000009C0000available 00000000009C0000--0000000001D51FFF 0000000000001392 00000000000000080000000001D51FFF 0000000000001392 0000000000000008LoaderDataLoaderData 0000000001D520000000000001D52000--0000000001D52FFF 0000000000000001 00000000000000080000000001D52FFF 0000000000000001 0000000000000008BS_data 0000000001D53000BS_data 0000000001D53000--0000000001D63FFF 0000000000000011 00000000000000080000000001D63FFF 0000000000000011 0000000000000008LoaderDataLoaderData 0000000001D640000000000001D64000--0000000001D64FFF 0000000000000001 00000000000000080000000001D64FFF 0000000000000001 0000000000000008BS_data 0000000001D65000BS_data 0000000001D65000--0000000001D66FFF 0000000000000002 00000000000000080000000001D66FFF 0000000000000002 0000000000000008LoaderDataLoaderData 0000000001D670000000000001D67000--0000000001D67FFF 0000000000000001 00000000000000080000000001D67FFF 0000000000000001 0000000000000008LoaderCodeLoaderCode 0000000001D680000000000001D68000--0000000001D6EFFF 0000000000000007 00000000000000080000000001D6EFFF 0000000000000007 0000000000000008LoaderDataLoaderData 0000000001D6F0000000000001D6F000--0000000001D73FFF 0000000000000005 00000000000000080000000001D73FFF 0000000000000005 0000000000000008BS_data 0000000001D74000BS_data 0000000001D74000--0000000001D7AFFF 0000000000000007 00000000000000080000000001D7AFFF 0000000000000007 0000000000000008BS_code 0000000001D7B000BS_code 0000000001D7B000--0000000001D8EFFF 0000000000000014 00000000000000080000000001D8EFFF 0000000000000014 0000000000000008BS_data 0000000001D8F000BS_data 0000000001D8F000--0000000001D97FFF 0000000000000009 00000000000000080000000001D97FFF 0000000000000009 0000000000000008LoaderDataLoaderData 0000000001D980000000000001D98000--0000000001D98FFF 0000000000000001 00000000000000080000000001D98FFF 0000000000000001 0000000000000008BS_data 0000000001D99000BS_data 0000000001D99000--0000000001D99FFF 0000000000000001 00000000000000080000000001D99FFF 0000000000000001 0000000000000008LoaderDataLoaderData 0000000001D9A0000000000001D9A000--0000000001D9AFFF 0000000000000001 00000000000000080000000001D9AFFF 0000000000000001 0000000000000008LoaderCodeLoaderCode 0000000001D9B0000000000001D9B000--0000000001DA3FFF 0000000000000009 00000000000000080000000001DA3FFF 0000000000000009 0000000000000008LoaderDataLoaderData 0000000001DA40000000000001DA4000--0000000001DACFFF 0000000000000009 00000000000000080000000001DACFFF 0000000000000009 0000000000000008BS_data 0000000001DAD000BS_data 0000000001DAD000--0000000001DB0FFF 0000000000000004 00000000000000080000000001DB0FFF 0000000000000004 0000000000000008RT_data 0000000001DB1000RT_data 0000000001DB1000--0000000001DB9FFF 0000000000000009 80000000000000080000000001DB9FFF 0000000000000009 8000000000000008BS_data 0000000001DBA000BS_data 0000000001DBA000--0000000001DBEFFF 0000000000000005 00000000000000080000000001DBEFFF 0000000000000005 0000000000000008RT_data 0000000001DBF000RT_data 0000000001DBF000--0000000001DBFFFF 0000000000000001 80000000000000080000000001DBFFFF 0000000000000001 8000000000000008

LoaderCodeLoaderCode: 16 pages (65,536): 16 pages (65,536)LoaderDataLoaderData: 19 pages (77,824): 19 pages (77,824)BS_code : 20 pages (81,920)BS_code : 20 pages (81,920)BS_data : 45 pages (184,320)BS_data : 45 pages (184,320)RT_data : 10 pages (40,960)RT_data : 10 pages (40,960)available : 5,010 pages (20,520,960)available : 5,010 pages (20,520,960)

Page 119: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

mode [row col]mode [row col]

[row][row] Number of rows on displayNumber of rows on display

[col] Number of columns on display[col] Number of columns on display

Shell> modeShell> mode

Available modes on standard outputAvailable modes on standard output

col 80 row 25 *col 80 row 25 *

col 80 row 50col 80 row 50

col 80 row 43col 80 row 43

col 100 row 100col 100 row 100

col 100 row 999col 100 row 999

Shell> mode 80 50Shell> mode 80 50

Page 120: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

Shell> verShell> ver

EFI Specification Revision 0.92EFI Specification Revision 0.92

EFI Vendor = INTELEFI Vendor = INTEL

EFI Revision = 01192000EFI Revision = 01192000

Page 121: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

time [hh:mm:ss]time [hh:mm:ss]

[hh] Hours[hh] Hours

[mm] Minutes[mm] Minutes

[ss] Seconds [ss] Seconds

Shell> timeShell> time

17:32:0217:32:02

Shell> time 17:30:00Shell> time 17:30:00

Shell> timeShell> time

17:30:0317:30:03

Shell>Shell>

Page 122: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

date [hh:mm:ss]date [hh:mm:ss]

[mm] Month (1..12)[mm] Month (1..12)

[dd] Day (1..31)[dd] Day (1..31)

[yyyy] Year [yyyy] Year

Shell> dateShell> date

09/07/199909/07/1999

Shell> date 09/06/1999Shell> date 09/06/1999

Shell> dateShell> date

09/06/199909/06/1999

Shell>Shell>

Page 123: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� echoecho

�� pausepause

�� for / for / endforendfor

�� if / if / endifendif

�� gotogoto

�� startup.startup.nsh nsh (do not use for operating (do not use for operating system boot)system boot)

Page 124: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� Syntax similar to DOS commandsSyntax similar to DOS commands

�� ‘*’‘*’ Matches any stringMatches any string

�� ‘?’‘?’ Matches any characterMatches any character

fs0:> dir *.fs0:> dir *.efiefi

fs0:> dir test?.fs0:> dir test?.efiefi

Page 125: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� Redirect standard output to a Unicode fileRedirect standard output to a Unicode filememmapmemmap 1>1> FooFoo.txt.txtmemmapmemmap > > FooFoo.txt.txt

Redirect standard output to an ASCII fileRedirect standard output to an ASCII filememmapmemmap 1>a1>a FooFoo.txt.txtmemmapmemmap >a>a FooFoo.txt.txt

�� Redirect standard error to a Unicode fileRedirect standard error to a Unicode filememmap memmap 2> 2> FooFoo.txt.txt

�� Redirect standard error to an ASCII fileRedirect standard error to an ASCII filememmap memmap 2>a 2>a FooFoo.txt.txt

Page 126: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� Enter application name at command promptEnter application name at command prompt

�� EFI Shell uses “path” environment variableEFI Shell uses “path” environment variable

�� EFI Shell automatically adds “.EFI Shell automatically adds “.efiefi” ”

path = fs0:>path = fs0:>\\efiefi\\tools;fs0:tools;fs0:\\;.;.

fs0:> test.fs0:> test.efiefi

fs0:> testfs0:> test

fs1:> testfs1:> test

Page 127: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� Boot Option Maintenance MenuBoot Option Maintenance Menu��Add some default boot optionsAdd some default boot options

��Locate and add a specific boot imageLocate and add a specific boot image

��Launch an applicationLaunch an application

��Delete all boot optionsDelete all boot options

�� Select boot optionSelect boot option

Page 128: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� EFI Shell ExercisesEFI Shell Exercises�� EFI Development EnvironmentsEFI Development Environments�� Sample EFI ApplicationsSample EFI Applications�� Sample EFI Shell ApplicationsSample EFI Shell Applications

Page 129: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� OverviewOverview�� DocumentationDocumentation�� Shell and Boot ManagerShell and Boot Manager�� Directory StructureDirectory Structure�� Development EnvironmentsDevelopment Environments�� EFI Application Toolkit OverviewEFI Application Toolkit Overview�� Sample ApplicationsSample Applications�� EFI/SAL IntegrationEFI/SAL Integration�� Open LabOpen Lab

Page 130: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

Page 131: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� \\buildbuild EFI Build tipsEFI Build tips�� \\corefwcorefw EFI Source CodeEFI Source Code�� \\incinc Main EFI Include FilesMain EFI Include Files�� \\liblib EFI Library Source CodeEFI Library Source Code�� \\notesnotes EFI DocumentationEFI Documentation

Page 132: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� Release NotesRelease Notes��RELNOTE.DOCRELNOTE.DOC

�� EFI Developer’s GuideEFI Developer’s Guide��EFI_DG.DOCEFI_DG.DOC

�� EFI Library SpecificationEFI Library Specification��EFI_LIB.DOCEFI_LIB.DOC

�� \\samplessamples

Page 133: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

��\\nt32nt32 WinNT EmulationWinNT Emulation��\\sal64sal64 IAIA--64 64 ��\\bios32bios32 IAIA--3232��\\IA32IA32--embemb IAIA--32 32 embbeded embbeded EFI native EFI native

EFI drivers onlyEFI drivers only

Page 134: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� \\nt32nt32\\binbin��Contains executable EFI imageContains executable EFI image

�� \\nt32nt32\\outputoutput��Duplicates the EFI Directory StructureDuplicates the EFI Directory Structure

��Contains all the OBJ and LIB filesContains all the OBJ and LIB files

Page 135: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� \\driversdrivers��\\driversdrivers\\ConSplitterConSplitter

��\\driversdrivers\\diskiodiskio

��\\driversdrivers\\fatfat

��\\driversdrivers\\pblkiopblkio

��\\driversdrivers\\ramdiskramdisk

�� \\fwfw��\\fwfw\\efiefi

��\\fwfw\\platform *platform *

Page 136: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� \\BuildTipBuildTip\\ntnt–– MainEntryMainEntry() for NT32 build tip() for NT32 build tip

�� \\BuildTipBuildTip\\salsal–– MainEntryMainEntry() for SAL64() for SAL64

�� \\BuildTipBuildTip\\bios32bios32–– MainEntryMainEntry() for BIOS32() for BIOS32

�� \\driversdrivers–– Native EFI Device DriversNative EFI Device Drivers

�� \\PlDriverPlDriver–– Platform specific driversPlatform specific drivers

�� \\bootmgrbootmgr

Page 137: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� \\PlDriverPlDriver\\defiodefio��PCI I/O, Memory, PCI I/O, Memory, ConfigConfig read/write routinesread/write routines

�� \\driversdrivers\\biosintbiosint\\keyboardkeyboard��Use INT 0x16 calls to perform keyboard I/OUse INT 0x16 calls to perform keyboard I/O

�� \\driversdrivers\\biosintbiosint\\vgavga��Use INT 0x10 calls to perform video I/OUse INT 0x10 calls to perform video I/O

�� \\driversdrivers\\biosintbiosint\\diskdisk��Use INT 0x13 calls to perform disk I/OUse INT 0x13 calls to perform disk I/O

�� \\driversdrivers\\biosintbiosint\\undiundi��Uses UNDI ROM to send/receive packetsUses UNDI ROM to send/receive packets

Page 138: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� OverviewOverview�� DocumentationDocumentation�� Shell and Boot ManagerShell and Boot Manager�� Directory StructureDirectory Structure�� Development EnvironmentsDevelopment Environments�� EFI Application Toolkit OverviewEFI Application Toolkit Overview�� Sample ApplicationsSample Applications�� EFI/SAL IntegrationEFI/SAL Integration�� Open LabOpen Lab

Page 139: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

��\\nt32nt32 WinNT EmulationWinNT Emulation��\\sal64sal64 IAIA--64 64 ��\\bios32bios32 IAIA--3232��\\IA32IA32--emb emb Embedded EFI for IA32 nativeEmbedded EFI for IA32 native

drivers onlydrivers only

Page 140: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� EFI Shell ExercisesEFI Shell Exercises�� EFI Development EnvironmentsEFI Development Environments�� Sample EFI ApplicationsSample EFI Applications�� Sample EFI Shell ApplicationsSample EFI Shell Applications

Page 141: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� OverviewOverview�� DocumentationDocumentation�� Shell and Boot ManagerShell and Boot Manager�� Directory StructureDirectory Structure�� Development EnvironmentsDevelopment Environments�� EFI Application Toolkit OverviewEFI Application Toolkit Overview�� Sample ApplicationsSample Applications�� EFI/SAL IntegrationEFI/SAL Integration�� Open LabOpen Lab

Page 142: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� Enable rapid application developmentEnable rapid application development

�� Create rich preCreate rich pre--boot environment that boot environment that industry can count onindustry can count on

�� Enable 3rd party marketsEnable 3rd party markets

�� Allow industry contributionsAllow industry contributions

�� Provide uniform environment between Provide uniform environment between IAIA--32 and IA32 and IA--6464

Page 143: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� Rich C library supportRich C library support

�� EFI Shell source and toolsEFI Shell source and tools

�� Full screen editorFull screen editor

�� TCP/IP Network Stack and Utilities(ftp client/server TCP/IP Network Stack and Utilities(ftp client/server and DHCP server)and DHCP server)

�� Python Scripting interpreterPython Scripting interpreter

�� Multiprocessor Test SupportMultiprocessor Test Support

�� Compress/Decompress library Compress/Decompress library libzlibz

�� C++ support Library C++ support Library

�� Platform Management (Platform Management (smbios smbios and IPMI 1.0)and IPMI 1.0)

�� next revision next revision -- Security Services & Source Security Services & Source debuggerdebugger

Page 144: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� Native EFI ModelNative EFI Model��Uses only EFI constructsUses only EFI constructs

��Access to all EFI constructsAccess to all EFI constructs

��Smaller code sizeSmaller code size

�� Portability ModelPortability Model��Familiar programming interfacesFamiliar programming interfaces

��Easier to port POSIX based programsEasier to port POSIX based programs

��Larger binary imageLarger binary image

�� A single program can use bothA single program can use both

Page 145: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� Native EFI supportNative EFI support��libefilibefi

��libefishelllibefishell

�� Portability supportPortability support��libclibc

��libsocketlibsocket

�� Platform management supportPlatform management support��libsmbioslibsmbios

��libmlibm

��libdblibdb

Page 146: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

linking dependencylib libefi libefishell libc Initialization Routinelibefi InitializeLib *libefishell D InitializeShellAppliation *libc I D InitializeLibC *libsocket I I D EfiSocketInit *libm I I I InitializeLibMlibdb I I I nonelibsmbios D I D SMBIOS_Initialize

D = Direct dependency I = Indirect dependency

* Implicit library initialization when using the_LIBC_Start_Shellapp_[AU] entry points

Page 147: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� Standard EFI entry pointStandard EFI entry pointtypdef typdef EFI_STATUSEFI_STATUS(EFIAPI *EFI_IMAGE_ENTRY_POINT((EFIAPI *EFI_IMAGE_ENTRY_POINT(IN EFI_HANDLEIN EFI_HANDLE ImageHandleImageHandle,,IN EFI_SYSTEM_TABLEIN EFI_SYSTEM_TABLE **SystemTableSystemTable););

�� Portability entry pointPortability entry pointintintmain( main( int argcint argc, char **, char **argv argv );); // _LIBC_Start_// _LIBC_Start_ShellappShellapp_A_A

intintmain( main( int argcint argc, , wcharwchar_t **_t **argv argv );); // _LIBC_Start_// _LIBC_Start_ShellappShellapp_U_U

�� Portability special exitPortability special exitvoidvoid_LIBC_EfiExit((IN EFI_STATUS Status,IN EFI_STATUS Status,IN UINTN IN UINTN DataSizeDataSize,,IN CHAR16 *IN CHAR16 *ExitDataExitData); );

Page 148: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

ROOT = f:ROOT = f:\\toolkittoolkitPROCESSOR = ia32PROCESSOR = ia32ENVIRONMENT = EFI32ENVIRONMENT = EFI32ENTRY_POINT = LIBC_Start_ENTRY_POINT = LIBC_Start_ShellappShellapp_A_AIMAGE_TYPE = appIMAGE_TYPE = app # app, # app, bsdrvbsdrv, or, or rtdrvrtdrvINC_ROOT = $(ROOT)INC_ROOT = $(ROOT)\\includeincludeLIB_ROOT = $(ROOT)LIB_ROOT = $(ROOT)\\liblibCC =CC = clclLD = linkLD = linkFWIMAGE = $(ROOT)FWIMAGE = $(ROOT)\\buildbuild\\toolstools\\binbin\\fwimagefwimage.exe.exe

CFLAGS = /CFLAGS = /nologonologo $(INC_PATH) /W3 /Gm /GX /$(INC_PATH) /W3 /Gm /GX /ZiZi //OdOd //GfGf //Gy Gy /D $(ENVIRONMENT)/D $(ENVIRONMENT)LDFLAGS = /LDFLAGS = /nologonologo /MACHINE:IX86 /subsystem:console /NODEFAULTLIB /INCREMENTAL:NO /MACHINE:IX86 /subsystem:console /NODEFAULTLIB /INCREMENTAL:NO /MAP /DEBUG /DLL/MAP /DEBUG /DLL

INC_PATH = INC_PATH = --X X \\--I $(INC_ROOT)/I $(INC_ROOT)/efiefi \\--I $(INC_ROOT)/I $(INC_ROOT)/efiefi/$(PROCESSOR) /$(PROCESSOR) \\--I $(INC_ROOT)/I $(INC_ROOT)/bsdbsd \\--I $(INC_ROOT)/I $(INC_ROOT)/efishellefishell

SOURCE = file1.c SOURCE = file1.c \\file2.c file2.c \\

OBJECTS = file1.OBJECTS = file1.objobj \\file2.file2.objobj \\

LIBS = $(LIB_ROOT)/LIBS = $(LIB_ROOT)/libefilibefi.lib .lib \\$(LIB_ROOT)/$(LIB_ROOT)/libefishelllibefishell.lib .lib \\$(LIB_ROOT)/libc.lib $(LIB_ROOT)/libc.lib \\

foofoo..efiefi:: foofoo..dlldll$(FWIMAGE) $(IMAGE_TYPE) $*.$(FWIMAGE) $(IMAGE_TYPE) $*.dlldll $@$@

foofoo..dlldll: $(OBJECTS): $(OBJECTS)$(LD) $(LDFLAGS) /ENTRY:$(ENTRY_POINT) $(LIBS) $** /OUT:$*.$(LD) $(LDFLAGS) /ENTRY:$(ENTRY_POINT) $(LIBS) $** /OUT:$*.dlldll

file1.file1.objobj:: file1.c file1.hfile1.c file1.hfile2.file2.objobj:: file2.cfile2.c

clean:clean:rmrm $(OBJECTS)$(OBJECTS) foofoo..dll foodll foo..efi fooefi foo..pdb foopdb foo.map vc60.*.map vc60.*

**Note libraries have been moved from their default locations.**Note libraries have been moved from their default locations.

Page 149: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� Required environment variablesRequired environment variables��SDK_BUILD_ENV SDK_BUILD_ENV -- bios32, nt32, sal64, ...bios32, nt32, sal64, ...

��SDK_INSTALL_DIR SDK_INSTALL_DIR -- root of toolkit sourceroot of toolkit source

��SDK_LIBPATH SDK_LIBPATH -- path to VC++ lib directorypath to VC++ lib directory

��IA64SDK_DIR IA64SDK_DIR -- path to IA64 compilerspath to IA64 compilers

��INCLUDE INCLUDE -- Normally set by VC++Normally set by VC++

�� Places output in “standard” locations Places output in “standard” locations

�� Use existing Use existing xxxxxx..makmak as a templateas a template

Page 150: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� Apps Apps -- Native EFI example programsNative EFI example programs

�� build build -- Environment master files binary outputEnvironment master files binary output

�� cmds cmds -- Ported FreeBSD programsPorted FreeBSD programs

�� doc doc -- User guides, man pages, and User guides, man pages, and decsign decsign documentationdocumentation

�� efishell efishell -- The shell and shell utilitiesThe shell and shell utilities

�� include include -- Public include filesPublic include files

�� lib lib -- Public toolkit librariesPublic toolkit libraries

�� protocols protocols -- Toolkit drivers and protocolsToolkit drivers and protocols

Page 151: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� OverviewOverview�� DocumentationDocumentation�� Shell and Boot ManagerShell and Boot Manager�� Directory StructureDirectory Structure�� Development EnvironmentsDevelopment Environments�� EFI Application Toolkit OverviewEFI Application Toolkit Overview�� Sample ApplicationsSample Applications�� EFI/SAL IntegrationEFI/SAL Integration�� Open LabOpen Lab

Page 152: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

Page 153: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� EFI ApplicationEFI Application

�� EFI OS LoaderEFI OS Loader

�� EFI External Shell CommandEFI External Shell Command

�� EFI Internal Shell CommandEFI Internal Shell Command

Page 154: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� Create new directory Create new directory appsapps\\hellohello

�� Put Put hello.hello.makmak in in appsapps\\hellohello

�� Put source code in Put source code in appsapps\\hellohello

�� Set Toolkit environmentSet Toolkit environment

�� Run Run nmakenmake --f hello.f hello.makmak from from appsapps\\hellohello

Page 155: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

#include "efi.h"#include "efi.h"

EFI_STATUSEFI_STATUS

InitializeHelloApplication (InitializeHelloApplication (

IN EFI_HANDLE ImageHandle,IN EFI_HANDLE ImageHandle,

IN EFI_SYSTEM_TABLE *SystemTableIN EFI_SYSTEM_TABLE *SystemTable

))

{{

UINTN Index;UINTN Index;

SystemTableSystemTable-->ConOut>ConOut-->OutputString(SystemTable>OutputString(SystemTable-->ConOut,>ConOut,

L”Hello application startedL”Hello application started\\n");n");

SystemTableSystemTable-->ConOut>ConOut-->OutputString(SystemTable>OutputString(SystemTable-->ConOut,>ConOut,

L"L"\\nn\\rr\\nn\\rr\\nn\\rHit any key to exit this imagerHit any key to exit this image\\nn\\r"); r");

SystemTableSystemTable-->>BootServicesBootServices-->>WaitForEventWaitForEvent((

1, &(1, &(SystemTableSystemTable-->>ConInConIn-->>WaitForKeyWaitForKey), &Index);), &Index);

SystemTableSystemTable-->>ConOutConOut-->>OutputStringOutputString((SystemTableSystemTable-->>ConOutConOut, ,

L"L"\\nn\\rr\\nn\\r");r");

return EFI_SUCCESS;return EFI_SUCCESS;

}}

Page 156: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

#include "efi.h"#include "efi.h"

#include "efilib.h"#include "efilib.h"

EFI_STATUSEFI_STATUS

InitializeHelloLibApplication (InitializeHelloLibApplication (

IN EFI_HANDLE ImageHandle,IN EFI_HANDLE ImageHandle,

IN EFI_SYSTEM_TABLE *SystemTableIN EFI_SYSTEM_TABLE *SystemTable

))

{{

InitializeLib (ImageHandle, SystemTable);InitializeLib (ImageHandle, SystemTable);

Print(L"Print(L"\\nn\\nn\\nHelloLib application startednHelloLib application started\\nn\\nn\\n");n");

Print(L"Print(L"\\nHit any key to exit this imagenHit any key to exit this image\\n");n");

WaitForSingleEvent(STWaitForSingleEvent(ST-->ConIn>ConIn-->WaitForKey,0);>WaitForKey,0);

STST-->>ConOutConOut-->>OutputStringOutputString (ST(ST-->>ConOutConOut, L", L"\\nn\\rr\\nn\\r");r");

return EFI_SUCCESS;return EFI_SUCCESS;

}}

Page 157: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

#include <#include <atkatk_libc.h>_libc.h>

EFI_STATUSEFI_STATUS

InitializeHelloLibCApplication (InitializeHelloLibCApplication (

IN EFI_HANDLE ImageHandle,IN EFI_HANDLE ImageHandle,

IN EFI_SYSTEM_TABLE *SystemTableIN EFI_SYSTEM_TABLE *SystemTable

))

{{

InitializeLib(ImageHandle, SystemTable);InitializeLib(ImageHandle, SystemTable);

printfprintf("Hello("Hello LibCLibC application startedapplication started\\nn\\nn\\n");n");

printfprintf("Hit C/R to exit this image("Hit C/R to exit this image\\n");n");

return( return( getchargetchar() );() );

}}

Page 158: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� InitializationInitialization

�� Device Path and Image InformationDevice Path and Image Information

�� Opening a VolumeOpening a Volume

�� Reading a FileReading a File

�� Finding an OS PartitionFinding an OS Partition

�� Getting the Current System ConfigurationGetting the Current System Configuration

�� Getting the Current Memory MapGetting the Current Memory Map

�� Getting the Current EnvironmentGetting the Current Environment VariablesVariables�� Transitioning to an OS KernelTransitioning to an OS Kernel

Page 159: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

#include "efi.h"#include "efi.h"

#include "efilib.h"#include "efilib.h"

EFI_STATUSEFI_STATUS

InitializeOSLoader (InitializeOSLoader (

IN EFI_HANDLE ImageHandle,IN EFI_HANDLE ImageHandle,

IN EFI_SYSTEM_TABLE *SystemTableIN EFI_SYSTEM_TABLE *SystemTable

))

{{

......

InitializeLib (ImageHandle, SystemTable);InitializeLib (ImageHandle, SystemTable);

Print(L"OS Loader application startedPrint(L"OS Loader application started\\n");n");

......

Page 160: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

EFI_LOADED_IMAGE *LoadedImage;EFI_LOADED_IMAGE *LoadedImage;

EFI_DEVICE_PATH *DevicePath;EFI_DEVICE_PATH *DevicePath;

......

BSBS-->HandleProtocol(ImageHandle,>HandleProtocol(ImageHandle,

&LoadedImageProtocol,&LoadedImageProtocol,

&LoadedImage);&LoadedImage);

BSBS-->HandleProtocol(LoadedImage>HandleProtocol(LoadedImage-->DeviceHandle,>DeviceHandle,

&DevicePathProtocol, &DevicePathProtocol,

&DevicePath);&DevicePath);

Print (L"Image device : %sPrint (L"Image device : %s\\n", DevicePathToStr (DevicePath)); n", DevicePathToStr (DevicePath));

Print (L"Image file : %sPrint (L"Image file : %s\\n", DevicePathToStr (LoadedImagen", DevicePathToStr (LoadedImage-->FilePath));>FilePath));

Print (L"Image Base : %XPrint (L"Image Base : %X\\n", LoadedImagen", LoadedImage-->ImageBase);>ImageBase);

Print (L"Image Size : %XPrint (L"Image Size : %X\\n", LoadedImagen", LoadedImage-->ImageSize);>ImageSize);

Page 161: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

EFI_FILE_IO_INTERFACE *Vol;EFI_FILE_IO_INTERFACE *Vol;

EFI_FILE_HANDLE RootFs;EFI_FILE_HANDLE RootFs;

EFI_FILE_HANDLE CurDir;EFI_FILE_HANDLE CurDir;

BSBS-->HandleProtocol(LoadedImage>HandleProtocol(LoadedImage-->DeviceHandle, &FileSystemProtocol, &Vol);>DeviceHandle, &FileSystemProtocol, &Vol);

VolVol-->OpenVolume (Vol, &RootFs);>OpenVolume (Vol, &RootFs);

CurDir = RootFs;CurDir = RootFs;

Page 162: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

EFI_FILE_HANDLE CurDir;EFI_FILE_HANDLE CurDir;

EFI_FILE_HANDLE FileHandle;EFI_FILE_HANDLE FileHandle;

CHAR16 FileName[100];CHAR16 FileName[100];

UINTN i;UINTN i;

UINTN Size;UINTN Size;

VOID *OsKernelBuffer;VOID *OsKernelBuffer;

StrCpy(FileName,DevicePathToStr(LoadedImageStrCpy(FileName,DevicePathToStr(LoadedImage-->FilePath));>FilePath));

for(i=StrLen(FileName);i>=0 && FileName[i]!=’for(i=StrLen(FileName);i>=0 && FileName[i]!=’\\\\’;i’;i----););

FileName[i] = 0;FileName[i] = 0;

StrCat(FileName,L"StrCat(FileName,L"\\\\OSKERNEL.BIN");OSKERNEL.BIN");

CurDirCurDir-->Open (CurDir, &FileHandle, FileName, EFI_FILE_MODE_READ, 0);>Open (CurDir, &FileHandle, FileName, EFI_FILE_MODE_READ, 0);

Size = 0x00100000;Size = 0x00100000;

BSBS-->AllocatePool(EfiLoaderData, Size, &OsKernelBuffer);>AllocatePool(EfiLoaderData, Size, &OsKernelBuffer);

FileHandleFileHandle-->Read(FileHandle, &Size, OsKernelBuffer);>Read(FileHandle, &Size, OsKernelBuffer);

FileHandleFileHandle-->Close(FileHandle);>Close(FileHandle);

Page 163: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

UINTN NoHandles;UINTN NoHandles;

EFI_HANDLE *HandleBuffer;EFI_HANDLE *HandleBuffer;

EFI_BLOCK_IO *BlkIo;EFI_BLOCK_IO *BlkIo;

EFI_BLOCK_IO_MEDIA Media;EFI_BLOCK_IO_MEDIA Media;

UINT8 *Block;UINT8 *Block;

UINT32 MediaId;UINT32 MediaId;

NoHandles = 0;NoHandles = 0;

HandleBuffer = NULL;HandleBuffer = NULL;

LibLocateHandle(ByProtocol, &BlockIoProtocol, NULL, LibLocateHandle(ByProtocol, &BlockIoProtocol, NULL,

&NoHandles, &HandleBuffer);&NoHandles, &HandleBuffer);

for(i=0;i<NoHandles;i++) {for(i=0;i<NoHandles;i++) {

BSBS-->HandleProtocol (HandleBuffer[i], &DevicePathProtocol, &DevicePa>HandleProtocol (HandleBuffer[i], &DevicePathProtocol, &DevicePath);th);

BSBS-->HandleProtocol (HandleBuffer[i], &BlockIoProtocol, &BlkIo);>HandleProtocol (HandleBuffer[i], &BlockIoProtocol, &BlkIo);

Media = BlkIoMedia = BlkIo-->Media; >Media;

Block = AllocatePool (MediaBlock = AllocatePool (Media-->BlockSize);>BlockSize);

MediaId = MediaMediaId = Media-->MediaId;>MediaId;

BlkIoBlkIo-->ReadBlocks(BlkIo, MediaId, (EFI_LBA)0, Media>ReadBlocks(BlkIo, MediaId, (EFI_LBA)0, Media-->BlockSize, Block);>BlockSize, Block);

Print(L"Print(L"\\nBlock #0 of device %snBlock #0 of device %s\\n",DevicePathToStr(DevicePath));n",DevicePathToStr(DevicePath));

DumpHex(0,0,BlkIoDumpHex(0,0,BlkIo-->BlockSize,Block);>BlockSize,Block);

}}

Page 164: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

VOID *VOID *AcpiTableAcpiTable;;

VOID *VOID *SMBIOSTableSMBIOSTable;;

VOID *VOID *SalSystemTableSalSystemTable;;

VOID *VOID *MpsTableMpsTable;;

LibGetSystemConfigurationTableLibGetSystemConfigurationTable(&(&AcpiTableGuidAcpiTableGuid, &, &AcpiTableAcpiTable););

LibGetSystemConfigurationTableLibGetSystemConfigurationTable(&(&SMBIOSTableGuidSMBIOSTableGuid, &, &SMBIOSTableSMBIOSTable););

LibGetSystemConfigurationTableLibGetSystemConfigurationTable(&(&SalSystemTableGuidSalSystemTableGuid,&,&SalSystemTableSalSystemTable););

LibGetSystemConfigurationTableLibGetSystemConfigurationTable(&(&MpsTableGuidMpsTableGuid, &, &MpsTableMpsTable););

Print(L" MPS Table is at address : %XPrint(L" MPS Table is at address : %X\\n",n",MpsTableMpsTable););

Print(L" ACPI Table is at address : %XPrint(L" ACPI Table is at address : %X\\n",n",AcpiTableAcpiTable););

Print(L" SMBIOS Table is at address : %XPrint(L" SMBIOS Table is at address : %X\\n",n",SMBIOSTableSMBIOSTable););

Print(L" Sal System Table is at address : %XPrint(L" Sal System Table is at address : %X\\n",n",SalSystemTableSalSystemTable););

Page 165: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

EFI_MEMORY_DESCRIPTOR *MemoryMap;EFI_MEMORY_DESCRIPTOR *MemoryMap;

EFI_MEMORY_DESCRIPTOR *MemoryMapEntry;EFI_MEMORY_DESCRIPTOR *MemoryMapEntry;

UINTN NoEntries;UINTN NoEntries;

UINTN MapKey;UINTN MapKey;

UINTN UINTN DescriptorSizeDescriptorSize;;

UINT32 UINT32 DescriptorVersionDescriptorVersion;;

MemoryMap = LibMemoryMap(&NoEntries,&MapKey,MemoryMap = LibMemoryMap(&NoEntries,&MapKey,

&DescriptorVersion,&DescriptorSize)&DescriptorVersion,&DescriptorSize);;

Print(L"Memory Descriptor List:Print(L"Memory Descriptor List:\\nn\\n");n");

Print(L" Type Start Address End Address AttriPrint(L" Type Start Address End Address Attributes butes \\n");n");

Print(L" ========== ================ ================ ====Print(L" ========== ================ ================ ============================\\n");n");

MemoryMapEntryMemoryMapEntry == MemoryMapMemoryMap;;

for(i=0;i<for(i=0;i<NoEntriesNoEntries;i++) {;i++) {

Print(L" %s %Print(L" %s %lX lX %%lX lX %%lXlX\\n",n",

OsLoaderMemoryTypeDescOsLoaderMemoryTypeDesc[[MemoryMapEntryMemoryMapEntry-->Type],>Type],

MemoryMapEntryMemoryMapEntry-->>PhysicalStartPhysicalStart,,

MemoryMapEntryMemoryMapEntry-->>PhysicalStartPhysicalStart + +

LShiftU64(LShiftU64(MemoryMapEntryMemoryMapEntry-->>NumberOfPagesNumberOfPages,PAGE_SHIFT),PAGE_SHIFT)--1,1,

MemoryMapEntryMemoryMapEntry-->Attribute);>Attribute);

MemoryMapEntryMemoryMapEntry == NextMemoryDescriptorNextMemoryDescriptor((MemoryMapEntryMemoryMapEntry,,DescriptorSizeDescriptorSize););

}}

Page 166: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

UINTN VariableNameSize;UINTN VariableNameSize;

CHAR16 VariableName[256];CHAR16 VariableName[256];

EFI_GUID VendorGuid;EFI_GUID VendorGuid;

UINT8 *VariableValue;UINT8 *VariableValue;

VariableName[0] = 0x0000;VariableName[0] = 0x0000;

VendorGuid = NullGuid;VendorGuid = NullGuid;

Print(L"GUID Variable Name VPrint(L"GUID Variable Name Valuealue\\n");n");

Print(L"================================== =================== =Print(L"================================== =================== =============\\n");n");

do {do {

VariableNameSize = 256;VariableNameSize = 256;

Status = RTStatus = RT-->GetNextVariableName(&VariableNameSize, VariableName,>GetNextVariableName(&VariableNameSize, VariableName,

&VendorGuid);&VendorGuid);

if (Status == EFI_SUCCESS) {if (Status == EFI_SUCCESS) {

VariableValue = LibGetVariable(VariableName,&VendorGuid);VariableValue = LibGetVariable(VariableName,&VendorGuid);

Print(L"%.Print(L"%.--35g %.35g %.--20s %X20s %X\\n",&VendorGuid,VariableName,VariableValue);n",&VendorGuid,VariableName,VariableValue);

}}

} while (Status == EFI_SUCCESS);} while (Status == EFI_SUCCESS);

Page 167: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

EFI_MEMORY_DESCRIPTOR *MemoryMap;EFI_MEMORY_DESCRIPTOR *MemoryMap;

UINTN NoEntries;UINTN NoEntries;

UINTN MapKey;UINTN MapKey;

MemoryMap = LibMemoryMap(&NoEntries,&MapKey,&DescriptorSize,&DMemoryMap = LibMemoryMap(&NoEntries,&MapKey,&DescriptorSize,&DescriptorVersion);escriptorVersion);

BSBS-->ExitBootServices(ImageHandle,MapKey);>ExitBootServices(ImageHandle,MapKey);

Page 168: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� Create new directory Create new directory efishellefishell\\testcmdtestcmd

�� Put Put testcmdtestcmd..makmak in in efishellefishell\\testcmdtestcmd

�� Put source code in Put source code in efishellefishell\\testcmdtestcmd

�� Run Run nmake nmake --f f testcmdtestcmd..makmak from from efishellefishell\\testcmdtestcmd

Page 169: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

#include "shell.h”#include "shell.h”

EFI_STATUSEFI_STATUS

InitializeTestCommandInitializeTestCommand ((

IN EFI_HANDLEIN EFI_HANDLE ImageHandleImageHandle,,

IN EFI_SYSTEM_TABLE *IN EFI_SYSTEM_TABLE *SystemTableSystemTable

))

{{

CHAR16 **CHAR16 **ArgvArgv;;

UINTNUINTN ArgcArgc,i;,i;

InitializeShellApplicationInitializeShellApplication ((ImageHandleImageHandle,, SystemTableSystemTable););

ArgvArgv = SI= SI-->>ArgvArgv;;

ArgcArgc = SI= SI-->>ArgcArgc;;

for(i=0;i<for(i=0;i<ArgcArgc;i++) {;i++) {

Print(L"Print(L"ArgvArgv[%d] = %s[%d] = %s\\n",i,n",i,ArgvArgv[i]);[i]);

}}

return EFI_SUCCESS;return EFI_SUCCESS;

}}

Page 170: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

#include <#include <stdiostdio.h>.h>

intint

main(main(int argcint argc, char **, char **argvargv))

{{

int int i;i;

for(i=0;i<for(i=0;i<argcargc;i++) {;i++) {

printfprintf(”(”argvargv[%d] = %s[%d] = %s\\n",i,n",i,argvargv[i]);[i]);

}}

return( 3 );

}}

Page 171: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� EFI Shell ExercisesEFI Shell Exercises�� EFI Development EnvironmentsEFI Development Environments�� Sample EFI ApplicationsSample EFI Applications�� Sample EFI Shell ApplicationsSample EFI Shell Applications

Page 172: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� OverviewOverview�� DocumentationDocumentation�� Shell and Boot ManagerShell and Boot Manager�� Directory StructureDirectory Structure�� Development EnvironmentsDevelopment Environments�� EFI Application Toolkit OverviewEFI Application Toolkit Overview�� Sample ApplicationsSample Applications�� EFI/SAL IntegrationEFI/SAL Integration�� Open LabOpen Lab

Page 173: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

Reference ImplementationReference Implementation

Page 174: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� IAIA--64 Software Stack64 Software Stack

�� EFI + SAL IntegrationEFI + SAL Integration

�� SAL changes due to EFISAL changes due to EFI

�� Porting EFI to an IAPorting EFI to an IA--64 Platform64 Platform

�� Debug hintsDebug hints

Page 175: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

Reads andwrites of I/Oregisters

������������ ���������������� ����

������������� ����������������� ����

������������������� ���������������������� ���

����������������������������������������������������������

����������������������������������������������������

OS boot handoff

SAL procedure

callsInstructionexecution

PAL proce-dure calls

PAL procedure calls

Transfers to SALentrypoints

Interrupts, trapsand faults

Access toplatformresources

Performance criticalhardware events,e.g., interrupts

Non-performance criticalhardware events, e.g.,reset, machine checks

IA-32 BIOS

������

EFI services

Page 176: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� EFI code invoked from SAL as last step prior to EFI code invoked from SAL as last step prior to OS bootOS boot�� EFI code is built as a separate entity (EFI64.exe)EFI code is built as a separate entity (EFI64.exe)

�� Entry present in FIT (Firmware Interface Table) for EFI Entry present in FIT (Firmware Interface Table) for EFI binary location in ROM. Uncompressed and shadowed to binary location in ROM. Uncompressed and shadowed to RAM during firmware initRAM during firmware init

�� EFI + SAL + PAL + IAEFI + SAL + PAL + IA--32Bios constitutes new FW.bin32Bios constitutes new FW.bin

�� Control passed to EFI, similar to booting of EMControl passed to EFI, similar to booting of EM--OSOS

�� EFI will present BootManager choices for user selectionEFI will present BootManager choices for user selection–– If IAIf IA--32 OS detected then control comes back to SAL for 32 OS detected then control comes back to SAL for

proper handling proper handling

–– If EMIf EM--OS is being booted, and native EFI drivers are OS is being booted, and native EFI drivers are present, then an IApresent, then an IA--32 BIOS will not be required.32 BIOS will not be required.

�� EFI calls SAL where ever necessaryEFI calls SAL where ever necessary

Page 177: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� SALProcSALProc runtime calls trimmedruntime calls trimmed�� Redundant SALProc calls removed (see updated SAL Redundant SALProc calls removed (see updated SAL

spec)spec)

�� OS would now make a mix of PAL, SAL and EFI callsOS would now make a mix of PAL, SAL and EFI calls

�� NVRAM functionality absorbed inside of EFINVRAM functionality absorbed inside of EFI

�� BootManager(BM) functionality moved to EFIBootManager(BM) functionality moved to EFI�� EFI would detect type of OS selected by userEFI would detect type of OS selected by user

�� EFI loads EMEFI loads EM--OS directlyOS directly

�� EFI calls back to SAL for IAEFI calls back to SAL for IA--32 OS loading32 OS loading

�� Provides ability to add new user optionsProvides ability to add new user options

�� OS will get memory map from EFIOS will get memory map from EFI

Page 178: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� All the table pointers now appear in EFI All the table pointers now appear in EFI System tableSystem table��ACPI, MPS and SST pointers should be ACPI, MPS and SST pointers should be

retrieved from EFI STretrieved from EFI ST

�� EFI BM provides capability to add EFI BM provides capability to add functionality like drivers, compliance functionality like drivers, compliance tests etc.tests etc.

Page 179: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� Look at Look at \\efiefi\\corefwcorefw\\fwfw\\platformplatform\\salsal

–– Reference ImplementationReference Implementation

–– Assumes a PCAssumes a PC--AT architectureAT architecture–– Makes use of SAL callbacksMakes use of SAL callbacks

�� Implement SAL CallbacksImplement SAL Callbacks–– Not requiredNot required

–– Will make porting task much simplerWill make porting task much simpler

�� SAL launches EFISAL launches EFI–– Not requiredNot required

–– A merged SAL/EFI is possibleA merged SAL/EFI is possible

�� Recovery issuesRecovery issues

Page 180: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� Load and relocate EFI codeLoad and relocate EFI code��Typically loaded from FLASHTypically loaded from FLASH

�� Call Call MainEntryMainEntry()()��Located in Located in \\efiefi\\corefwcorefw\\fwfw\\platformplatform\\salsal\\init.c init.c

�� Initialize EFI System TableInitialize EFI System Table

�� Initialize System Configuration TablesInitialize System Configuration Tables

�� Initialize the EFI Memory MapInitialize the EFI Memory Map

�� Initialize the EFI LibraryInitialize the EFI Library

Page 181: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� Install Base DevicesInstall Base Devices��Install DEVICE_IO ProtocolsInstall DEVICE_IO Protocols

��Initialize NVRAM devicesInitialize NVRAM devices

�� Install Console DevicesInstall Console Devices��Install SIMPLE_INPUT ProtocolInstall SIMPLE_INPUT Protocol

��Install SIMPLE_TEXT_OUTPUT ProtocolInstall SIMPLE_TEXT_OUTPUT Protocol

�� Install System VolumesInstall System Volumes��Initialize BLOCK_IO Protocol InstancesInitialize BLOCK_IO Protocol Instances

��Initialize DISK_IO Protocol InstancesInitialize DISK_IO Protocol Instances

��Initialize FILE_SYSTEM Protocol InstancesInitialize FILE_SYSTEM Protocol Instances

Page 182: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� Install Other DevicesInstall Other Devices��OEM specific devices available from EFIOEM specific devices available from EFI

�� Call the EFI Boot ManagerCall the EFI Boot Manager��OEM Value Add AreaOEM Value Add Area

��Launches OS LoaderLaunches OS Loader

��Launches OS Setup UtilityLaunches OS Setup Utility

��Launches EFI ShellLaunches EFI Shell

��Launches UtilitiesLaunches Utilities

��Launches DiagnosticsLaunches Diagnostics

Page 183: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� Implement NVRAM access functionsImplement NVRAM access functions

�� Implement RTC access functionsImplement RTC access functions

�� Implement Boot Device DriversImplement Boot Device Drivers��Reference Implementation uses INT callsReference Implementation uses INT calls

��Native EFI device drivers are an optionNative EFI device drivers are an option

��KeyboardKeyboard

��DisplayDisplay

��DiskDisk

��SerialSerial

��NetworkNetwork

Page 184: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

GeneralGeneral

�� Identify what call (EFI, SAL or PAL) exactly failsIdentify what call (EFI, SAL or PAL) exactly fails

�� Certain EFI calls are handled entirely within EFI and Certain EFI calls are handled entirely within EFI and don’t need to call SALdon’t need to call SAL�� Ex: HandleProtocol, Locatexxx, Memory map Ex: HandleProtocol, Locatexxx, Memory map

�� Almost all calls that interact with media would be a Almost all calls that interact with media would be a mix of EFI , SAL and IAmix of EFI , SAL and IA--32 bios code32 bios code�� ConIn or ConOut functions of EFI will call SAL, which in ConIn or ConOut functions of EFI will call SAL, which in

turn would call IAturn would call IA--32 Bios32 Bios

�� NVRAM calls might need talking through the Flash NVRAM calls might need talking through the Flash manager to access devicemanager to access device

�� BlkIO functions use SAL callback and Int13 BlkIO functions use SAL callback and Int13

interface of Biosinterface of Bios

Page 185: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

GeneralGeneral

�� Documentation provided with binariesDocumentation provided with binaries�� EFI Developers guide provides samples and usage of EFI Developers guide provides samples and usage of

various functionsvarious functions

�� Release notes (EFI and SAL) provide the level of Release notes (EFI and SAL) provide the level of support provided in a particular releasesupport provided in a particular release

�� SAL spec details SAL implementationSAL spec details SAL implementation

�� OS sample loader code that would show how to write a OS sample loader code that would show how to write a simple OS boot loader. Number of sample apps simple OS boot loader. Number of sample apps provided alsoprovided also

�� EFI shell provides way to recreate the fail EFI shell provides way to recreate the fail scenario by writing smaller EFI images for debugscenario by writing smaller EFI images for debug

�� Running SAL compliance tests and EFI Running SAL compliance tests and EFI diagnostics could narrow down the problemdiagnostics could narrow down the problem

Page 186: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

Media relatedMedia related

�� Can not access hard driveCan not access hard drive�� See See efibootefiboot..simsim or or fwfw..simsim for define (Ord1 for define (Ord1

0x475=number of HD’s)0x475=number of HD’s)�� See See Usercfg.incUsercfg.inc for HD definition (PHYSICALDRIVEnn)for HD definition (PHYSICALDRIVEnn)

�� Check if HD supports FAT16 or FAT32 partitionCheck if HD supports FAT16 or FAT32 partition

�� From EFI shell prompt running ‘dh’ should show atleast From EFI shell prompt running ‘dh’ should show atleast one handle with ‘fs’ protocolone handle with ‘fs’ protocol

�� By default only one hard drive declared in script (0x475=1)By default only one hard drive declared in script (0x475=1)

�� Remove ‘delta_out’ option when starting simulatorRemove ‘delta_out’ option when starting simulator

�� Run CHKDSK before and after running simulatorRun CHKDSK before and after running simulator

Page 187: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

Media relatedMedia related

�� Can not access floppyCan not access floppy�� Floppy emulation is not supported inFloppy emulation is not supported in SoftSDVSoftSDV, however , however

code exists in EFI to detect floppy devicescode exists in EFI to detect floppy devices

�� Can not access CDROM deviceCan not access CDROM device�� See See efibootefiboot..simsim or or fwfw..simsim for proper declaration of for proper declaration of

CDRom CDRom

�� Currently only oneCurrently only one CDRomCDRom enabled, with a device number enabled, with a device number of 0x9fof 0x9f

�� Assumed to be readonlyAssumed to be readonly

�� Need proper filesystem for enumeration by EFINeed proper filesystem for enumeration by EFI–– one way would be to generate a floppy bin image and load one way would be to generate a floppy bin image and load

into CD, resulting in FAT12 like imageinto CD, resulting in FAT12 like image

–– Special tool might be needed to create FAT32 type Special tool might be needed to create FAT32 type

image directly on CDimage directly on CD

Page 188: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

Shell/Image relatedShell/Image related

�� Can not load EFI imageCan not load EFI image�� Make sure image is of EFI type (App, RtDrv, BSDrv)Make sure image is of EFI type (App, RtDrv, BSDrv)

–– PE32+ images should be patched by running PE32+ images should be patched by running fwimage.exe to generate EFI image of needed typefwimage.exe to generate EFI image of needed type

–– Conversion of PE32+ images only supported at this pointConversion of PE32+ images only supported at this point

�� Image should be in pathImage should be in path

–– Default path is : fs0:Default path is : fs0:\\efiefi\\tools;fs0:tools;fs0:\\;.;.

–– This path can be modified from the shell prompt. This path can be modified from the shell prompt.

�� There should be enough memory for loading of this imageThere should be enough memory for loading of this image

–– Memmap shell command shows available free memoryMemmap shell command shows available free memory

�� Can not add/execute custom shell commandCan not add/execute custom shell command�� Make sure it is an EFI imageMake sure it is an EFI image

�� Good documentation in EFIGood documentation in EFI\\notes directory on how tonotes directory on how to

add shell commands (internal and standalone)add shell commands (internal and standalone)

Page 189: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

Shell/Image relatedShell/Image related

�� String processingString processing�� All of EFI assumes Unicode stringsAll of EFI assumes Unicode strings

–– Declare Unicode strings using the “L” prefixDeclare Unicode strings using the “L” prefix

�� ‘Type ‘Type --a’ shell command prints a’ shell command prints ascii ascii texttext

Page 190: Introduction to EFI

®®

OSLoader

Hardware

BIOS

EFI

Co

mp

atib

ility

�� OverviewOverview�� DocumentationDocumentation�� Shell and Boot ManagerShell and Boot Manager�� Directory StructureDirectory Structure�� Development EnvironmentsDevelopment Environments�� EFI Application Toolkit OverviewEFI Application Toolkit Overview�� Sample ApplicationsSample Applications�� EFI/SAL IntegrationEFI/SAL Integration�� Open LabOpen Lab