Michael Rothman, Vincent Zimmer, Tim Lewis
Harnessing the UEFI Shell
Moving the Platform Beyond DOS
ISBN 978-1-5015-1480-7
e-ISBN (PDF) 978-1-5015-0575-1
e-ISBN (EPUB) 978-1-5015-0581-2
Library of Congress Cataloging-in-Publication Data
A CIP catalog record for this book has been applied for at the Library of Congress.
Bibliographic information published by the Deutsche Nationalbibliothek
The Deutsche Nationalbibliothek lists this publication in the Deutsche Nationalbibliografie; detailed bibliographic data are available on the Internet at http://dnb.dnb.de.
2017 Walter de Gruyter Inc., Boston/Berlin
www.degruyter.com
To my wife Sandi, for having infinite patience in allowing me to find the spare time for this endeavor, and to my sons Ryan and Aaron, who keep me grounded in what life is really about. Also to my grandfather Joseph, who instilled the love of learning and set an example I strive to promote for the next generation.
Mike Rothman
To the three beautiful women in my life: my wife Jan, and my daughters Ally and Zoe.
Vincent J. Zimmer
To my wife Helen, always bright and beautiful, and to my kids, curious Shannon, caring Brahms, and courageous Miriam, always the joy of my life.
Tim Lewis
Preface
A man is rich in proportion to the number of things he can afford to let alone.
Henry David Thoreau
This is a book about a computer program that was never intended to be what it is. The first version of what is now the UEFI Shell was created to facilitate the debugging of early parts of EFI. It was never intended to see a customer. It was a simple expedient tool to speed up an EFI developers job. Its escape to the rest of the world was, in retrospect, inevitable because it was more valuable than we realized. It became popular enough that, in the eyes of many, it was EFI. It was not, and it is not. EFI (now UEFI) is a commonly agreed upon set of interfaces between operating systems, BIOS, and option ROMs. The shell is, in many ways, simply another operating system that sits on top of EFI.
In the next few years of add what we need the shell became more and more valuable. Badly suffering from too many hands and not enough guidance, it became complex enough to warrant serious effort, a seriously out of control adolescent if there ever was one. In the end, it has become valuable enough to warrant the creation of an industry specification and adoption throughout the industry. It is becoming a basis of computer component validation, computer validation, and manufacturing, system testing, and applications. Pretty good for something originally intended as a throwaway piece of code to test some EFI drivers.
The Shell started its life in 1999 or 2000 (we dont exactly remember) so it is comparatively a newcomer. Yet, it is in many ways a throwback to (at least what now) seems a much simpler time, say 1970 or so. It doesnt run protected code, have a swap file or a registry, or even a GUI. As far as we know, it doesnt even have a virus scanner.
Weve discovered there is still a place for a small, simple, developers environment that provides enough resources and support for complex programs without getting in the way of applications that need to (or at least think they need to) own the system.
The Book
The first part of this book introduces the basic concepts: history (how the shell can be useful to debug UEFI drivers, ironically the shells original purpose. Appendixes cover security considerations, UEFI Shell library descriptions, and provide brief descriptions of the shells commands and APIs.
Chapter 1
Introduction
Less but better.
Dieter Rams
To most users, a computer is represented by the operating system that theyre using and nothing more. However, unbeknownst to most basic users, there are a large number of components that must work in concert to go from where the user presses the power button, the hardware is initialized, the boot target is discovered, to where the operating system is launched.
There are two major phases of platform initialization between when a user turns a computer on and the computer has completed its initialization: the first phase is what might be called the pre-OS stage where the platforms hardware is initialized and made usable, and the second phase is when the boot target is launched, which oftentimes would be the target operating system.
The early phase of platform initialization is primarily focused on the launching of a target. This target almost always is an operating system, but it doesnt always have to be. Sometimes, activities such as bare-metal provisioning, diagnostics, personality migration, scripting and others are accomplished through an intermediary execution environment known as a UEFI shell.
Much of this book will further explain the intricacies of how one uses the UEFI shell to accomplish the aforementioned activities, but this being an introductory chapter, it seems reasonable to give a slight background on what the UEFI shell actually is and from where its roots evolved.
What is UEFI?
Historically, the BIOS (Basic Input Output System) was a black box. In other words, there was very limited exposure to how it worked and the interoperability associated with the BIOS and the rest of the system was limited at best.
The purpose of a BIOS was very simple: its role was to discover and initialize the hardware, run any tests that were required to ensure the hardware was in working order, and ultimately launch the boot target.
The goals for todays BIOS have not significantly changed. What has changed is that the black box nature of BIOS has been opened so that the industry can normalize the interfaces associated with BIOS technology and leverage it in many ways that were previously not possible.
In 2005, the UEFI (Unified Extensible Firmware Interface) Forum was established. The forum itself was formed with several thoughts in mind:
The UEFI Forum is established as a Washington non-profit Corporation
Develops, promotes, and manages evolution of the UEFI Specification
Continue to drive low barriers for adoption
The Promoter members for the UEFI forum are:
AMD, AMI, Apple, Dell, HP, IBM, Insyde, Intel, Lenovo, Microsoft, Phoenix
The UEFI Forum has a form of tiered Membership:
Promoters, Contributors, and Adopters
More information on the membership tiers can be found at: www.uefi.org
The UEFI Forum has several work groups:
illustrates the basic makeup of the forum and the corresponding roles.
Figure 1.1: Forum group hierarchy
Next page