11
Copyright © 2013 Annabooks All Rights Reserved. Simplified Firmware: Intel ® Boot Loader Development Kit Abstract Since 1976, storing the basic input/output system software on a separate piece of hardware has been the go-to approach. Standard BIOS firmware contains the first piece of code to run when the device turns on, controlling how the other elements of the device accept input/express output and locating the boot device. The problem is that a traditional BIOS is too slow and insufficiently customizable when designing for embedded systems. There’s no need to copy the standard BIOS when you can instead create your own system. Intel’s Boot Loader Development Kit allows developers to easily create flexible, versatile, as-fast-as-needed boot software, optimized for lightweight embedded systems. This article will walk you through the steps involved in starting your own system and includes a specific exercise using Intel’s BLDK to modify an Unified Extensible Firmware Interface to create a new piece of custom firmware. Simplified Firmware: Intel ® Boot Loader Development Kit A traditional BIOS is too slow and challenging to develop for a fixed function device. The Unified Extensible Firmware Interface (UEFI) offers a fresh open solution, and if you’re going to build a system, then you’ll want to use UEFI. Chapters 2 and 3 of Open Software Stack for the Intel® Atom™ Processor introduce UEFI, the UEFI development process, and UEFI Shell. The purpose of discussing these topics first was to lead us to this section. Since the BLDK comes from EDK II/UDK2010, this section will show how to use the BLDK and how it makes building a system a little easier. Intel realized that there is a learning curve for developing the firmware. To help speed up firmware development, Intel has developed the Boot Loader Development Kit (BLDK). The BLDK I (v1.10) only supported the GUI to modify pre-built firmware. The BLDK II (V2.x) is derived from the UDK2010, and it allows you to add modifications to the firmware. To help with debugging, the BLDK II also supports the Intel® UEFI Development Kit Debugger Tool and UEFI Shell 2.0. Since the focus is to develop fixed-function devices rather than a full desktop system, the BLDK II provides the basic common low-level platform initialization (CPU and chipset) in pre-built binary format. The rest of the firmware is available as source code for modification. Code base (firmware reference packages) based on reference platforms are provided as a starting point. Since fixed function devices are intended to boot fast, the BLDK includes a fast boot option, which by- passes sign-on banners, menu items, and other nonessential steps in order to boot straight into the OS. The faster boot follows a few white papers and articles on http://edc.intel.com that covers how boot time can be improved in firmware. If you decide to build your own UEFI implementation, you can implement fast boot as well. Traditional BIOS services are not available, which limits the operating systems that it can boot. The supported kernels and operating systems include UEFI Shell 2.0, Linux operating systems, and Windows® CE. Since there isn’t a traditional BIOS module, operating systems like DOS and Windows® XP/Vista/7 desktop, which rely on BIOS services, are not supported.

Simplified Firmware: Intel ® Boot Loader Development Kitcpop/Documentatie_SMP/Intel... · Option 1: Create the Final Firmware Based on an Existing Binary The .asbf file can be used

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Simplified Firmware: Intel ® Boot Loader Development Kitcpop/Documentatie_SMP/Intel... · Option 1: Create the Final Firmware Based on an Existing Binary The .asbf file can be used

Copyright © 2013 Annabooks All Rights Reserved.

Simplified Firmware: Intel ® Boot Loader Development Kit

Abstract

Since 1976, storing the basic input/output system software on a separate piece of hardware has been the go-to approach. Standard BIOS firmware contains the first piece of code to run when the device turns on, controlling how the other elements of the device accept input/express output and locating the boot device. The problem is that a traditional BIOS is too slow and insufficiently customizable when designing for embedded systems. There’s no need to copy the standard BIOS when you can instead create your own system. Intel’s Boot Loader Development Kit allows developers to easily create flexible, versatile, as-fast-as-needed boot software, optimized for lightweight embedded systems. This article will walk you through the steps involved in starting your own system and includes a specific exercise using Intel’s BLDK to modify an Unified Extensible Firmware Interface to create a new piece of custom firmware.

Simplified Firmware: Intel ® Boot Loader Development Kit

A traditional BIOS is too slow and challenging to develop for a fixed function device. The Unified Extensible Firmware Interface (UEFI) offers a fresh open solution, and if you’re going to build a system, then you’ll want to use UEFI. Chapters 2 and 3 of Open Software Stack for the Intel® Atom™ Processor introduce UEFI, the UEFI development process, and UEFI Shell. The purpose of discussing these topics first was to lead us to this section. Since the BLDK comes from EDK II/UDK2010, this section will show how to use the BLDK and how it makes building a system a little easier.

Intel realized that there is a learning curve for developing the firmware. To help speed up firmware development, Intel has developed the Boot Loader Development Kit (BLDK). The BLDK I (v1.10) only supported the GUI to modify pre-built firmware. The BLDK II (V2.x) is derived from the UDK2010, and it allows you to add modifications to the firmware. To help with debugging, the BLDK II also supports the Intel® UEFI Development Kit Debugger Tool and UEFI Shell 2.0.

Since the focus is to develop fixed-function devices rather than a full desktop system, the BLDK II provides the basic common low-level platform initialization (CPU and chipset) in pre-built binary format. The rest of the firmware is available as source code for modification. Code base (firmware reference packages) based on reference platforms are provided as a starting point.

Since fixed function devices are intended to boot fast, the BLDK includes a fast boot option, which by-passes sign-on banners, menu items, and other nonessential steps in order to boot straight into the OS. The faster boot follows a few white papers and articles on http://edc.intel.com that covers how boot time can be improved in firmware. If you decide to build your own UEFI implementation, you can implement fast boot as well. Traditional BIOS services are not available, which limits the operating systems that it can boot. The supported kernels and operating systems include UEFI Shell 2.0, Linux operating systems, and Windows® CE. Since there isn’t a traditional BIOS module, operating systems like DOS and Windows® XP/Vista/7 desktop, which rely on BIOS services, are not supported.

Page 2: Simplified Firmware: Intel ® Boot Loader Development Kitcpop/Documentatie_SMP/Intel... · Option 1: Create the Final Firmware Based on an Existing Binary The .asbf file can be used

Copyright © 2013 Annabooks All Rights Reserved.

The BLDK II comes with a GUI configuration tool to build the firmware image and/or apply customizations to the firmware, such as fast boot with silent startup, preset the boot order, and preset messages to be displayed. The BLDK II application can set the firmware to boot an operating system from SATA, SD flash drive, and USB flash drive.

There are two development processes that go on with the BLDK II. The first is to build the firmware. The BLDK II has a very similar build tree to the UDK2010, but each code base has the binaries for specific platforms and processors. There is a firmware image that already comes with the BLDK II, thus the second process is to patch the firmware with the various custom settings. If you decide to build the firmware, you still need to patch the firmware with your special modifications.

Figure 1: BLDK Development Process

The BLDK I (v1.3.x) had support packages for the Z5xx, 400 series, 500 series, and E6xx. These are archived on the http://edc.intel.com site if you want to use them.

As of this writing, the BLDK II supports firmware packages for different reference boards:

E6xx with EG20T controller hub known as Crown Bay.

N2000/D2000 with NM10 Express Chipset known as Cedar Trail.

If you are going to build a system based on these processors, then the BLDK I and BLDK II have the initialization already completed for you. Since the E6xx and N2000 series are highly integrated, BLDK II allows you to build the firmware and add your own support code for custom hardware. This chapter focuses on the BLDK II.

BLDK II Downloads There are two downloads that make up the BLDK: BLDK Development Application and any available Reference Firmware packages.

Description Website

Intel® BLDK Development Application http://edc.intel.com

Intel® BLDK Code Bases (Reference Firmware http://edc.intel.com

Page 3: Simplified Firmware: Intel ® Boot Loader Development Kitcpop/Documentatie_SMP/Intel... · Option 1: Create the Final Firmware Based on an Existing Binary The .asbf file can be used

Copyright © 2013 Annabooks All Rights Reserved.

Packages) As of this writing, there are a couple of Reference Firmware Packages available:

Intel® BLDK Core for Crown Bay

Intel® BLDK Core for Cedar Rock

You should also download the release notes for the application and the packages. The development tools discussed in Chapter 2 for the Windows and Linux systems are the same. Make sure that you have followed the appropriate Chapter 2 exercise to set up your system.

Target Hardware for Exercises

Actual target hardware is needed to test the firmware. The BLDK has reference firmware packages for Crown Bay (E6xx Series with Intel® Platform Controller Hub EG20T). The Crown Bay platform is available from Intel (Update: Crown Bay is an expired program. Information can be found at http://www.intel.com/p/en_US/embedded/designcenter/tools/seed-board-program?iid=2458#expired.) A less expensive version is available from Inforce Computing, Inc.:

SYS9403 Reference Platform - http://www.inforcecomputing.com/product/moreinfo/sys9403.html .

The SYS9400 will be used as the example target for the firmware deployment exercises.

Exercise: Building and Customizing the Firmware Parts 1 and 2 create the configuration for the firmware using the BLDK Graphic User Interface tool. The next step is to either patch firmware or build the firmware and then patch.

Part 1: Create a new Project Once all the tools have been installed, you can open the BLDK Applications and create a project.

1. Open the Intel® Boot Loader Development Kit.

2. The first time the application runs it will show a licensing page. Read the licensing terms. If you agree, select accept the terms, and click the button to continue with the BLDK Application.

3. The BLDK Application has four panes. The left pane is the navigation window, the center pane is the main window to change settings, and the right pane provides on-demand help for the items in the main window. The bottom pane is the output window for the build activity.

4. From the menu, select Project -> New Project.

5. The main window will show you the project properties. Provide the following:

Project Property Description Linux Value Windows Value

Page 4: Simplified Firmware: Intel ® Boot Loader Development Kitcpop/Documentatie_SMP/Intel... · Option 1: Create the Final Firmware Based on an Existing Binary The .asbf file can be used

Copyright © 2013 Annabooks All Rights Reserved.

Project Name: BLDK1 BLDK1

Project file directory:

The project file (.ews) will be created in this directory.

/home/<account>/Crownbay

C:\Crownbay

Workspace directory:

Location of the files to build the firmware image

/home/<account>/Crownbay/CrownBayPlatformPkg

C:\CrownBay\CrownBayPlatformPkg

Image configuration file:

The location of the baseline BSF file for the package.

/home/<account>/ Crownbay/CrownBayPlatformPkg/FV/tc.bsf

C:\CrownBay\CrownBayPlatformPkg \FV\tc.bsf

Figure 2: Creating a New Project under Windows

Page 5: Simplified Firmware: Intel ® Boot Loader Development Kitcpop/Documentatie_SMP/Intel... · Option 1: Create the Final Firmware Based on an Existing Binary The .asbf file can be used

Copyright © 2013 Annabooks All Rights Reserved.

Figure 3: Creating a New Project under Ubuntu

6. Click the Start Configuration button.

7. The next screen will ask for a firmware feature regarding source debugging. You can set this option later. Click the Create Project Button.

Figure 4: Keep the Defaults for the Project

Part 2: Modifying the BSF File Once the project has been created, you can customize your firmware to fit your application. Some settings require knowledge about your hardware platform.

Page 6: Simplified Firmware: Intel ® Boot Loader Development Kitcpop/Documentatie_SMP/Intel... · Option 1: Create the Final Firmware Based on an Existing Binary The .asbf file can be used

Copyright © 2013 Annabooks All Rights Reserved.

1. In the Navigation pane, click on Boot.

2. Set the Fast Boot to Enabled.

3. Change the Firmware banner to ACME Systems.

4. Change the Copyright information to Copyright (C) 1999-2012 ACME Corporation. All rights reserved.

Figure 5: Customizing the Firmware

5. From the menu, select Project-> Save Configuration. The BLDK1.ews file will be saved and the tc.absf file will be created in the same directory as the original tc.bsf file -

C:\CrownBay\CrownBayPlatformPkg\FV.

Note: TC means Tunnel Creek, code name for the E6xx processor.

Now, we are ready to either patch the firmware or build and patch the firmware. Based on Figure 1, there are two options to build the firmware. The first option is to build the final firmware from an existing binary. The Firmware Package comes with existing binaries already created.

The second option is to build the project from source and libraries. The main reason you would want to build from source code is to make a change to the source code or add a driver. You can either build a release build or a debug build. The debug build will include the debug agent and symbols for source level debugging. Once the build process is completed, you can create the final firmware file by patching the firmware with the custom settings defined in the .absf file.

Note: BLDK Application version 2.0.1.18265 has some quirks with creating the final image. Our workaround will differ from the BLDK documentation.

Page 7: Simplified Firmware: Intel ® Boot Loader Development Kitcpop/Documentatie_SMP/Intel... · Option 1: Create the Final Firmware Based on an Existing Binary The .asbf file can be used

Copyright © 2013 Annabooks All Rights Reserved.

Option 1: Create the Final Firmware Based on an Existing Binary The .asbf file can be used against an existing firmware binary to create a final ROM image. This build method is ideal when you want to make quick changes to the configuration settings for an existing binary without having to rebuild the whole binary.

There is an issue. The BLDK Application wants the binary file (.fd) in the same directory as the .absf file when the project is opened. Since the crownbay.fd file is not in the same directory as the tc.absf file, an error will appear if you try to create the final firmware file with the project open.

Figure 6: Reference Error in the BLDK Application

If you get this error dialog shown in Figure 6, close the Error dialog, and Cancel the Create Final Firmware File dialog. Then follow these steps that provide a work-around for this issue.

1. Close the Project. From the menu, select Project->Close Project.

2. A dialog will appear asking to save the configuration; click Yes.

The Code Base project comes with a pre-built binary in the \Build\CrownBayPlatform directory. We will use this binary to create a final ROM file.

3. From the menu, Select Build-> Create Final Firmware Image.

4. The Create Final Firmware File dialog appears. Select the location of the binary. You will have to change file type to All Files. For this example in Windows:

C:\CrownBay\Build\CrownBayPlatform\RELEASE_VS2005x86\FV\CROWNBAY.fd.

In Ubuntu, it would be:

/home/<account>Crownbay/Build/CrownBayPlatform/RELEASE_GCC45/FV

Once you select the file, the Firmware file will automatically fill in - CROWNBAY.rom.

5. Select the As built File (.absf). For this example in Windows:

Page 8: Simplified Firmware: Intel ® Boot Loader Development Kitcpop/Documentatie_SMP/Intel... · Option 1: Create the Final Firmware Based on an Existing Binary The .asbf file can be used

Copyright © 2013 Annabooks All Rights Reserved.

C:\CrownBay\CrownBayPlatformPkg\FV\tc.absf

In Ubuntu, it would be:

/home/<account>/Crownbay/Build/CrownBayPlatformPkg/FV/tc.asbsf

Figure 7: Creating the Final Firmware

6. Click OK to build the firmware. A message will appear when the firmware file has been created.

Figure 8: Firmware Competed

Option 2 (Windows only): Build the Project and then Create the Final Firmware with the Customizations If you have added or changed source code, or just want to build the image from source code, you can build the image from the BLDK application.

1. If you closed the project, open the project (.ews) file. You will be asked for the .absf file.

2. To build the image, from the menu, select Build->Build. Notice in the output window that the build still runs through the same process as the command line. The environment is first set up just like running edksetup.bat, and then the build of the source code begins.

3. The build process will take a few minutes. A dialog will appear when the build is completed. Click Ok.

Page 9: Simplified Firmware: Intel ® Boot Loader Development Kitcpop/Documentatie_SMP/Intel... · Option 1: Create the Final Firmware Based on an Existing Binary The .asbf file can be used

Copyright © 2013 Annabooks All Rights Reserved.

Figure 9: Source Code Build Completed

The resulting binary file will be found here:

C:\CrownBay\Build\CrownBayPlatform\RELEASE_VS2008x86\FV\CROWNBAY.fd

The RELEASE_VS2008x86 has a specific meaning. RELEASE means release build. VS2008 indicates which build tools were used; in this case, Visual Studio 2008.

Building the image doesn’t include the customization setting defined by the GUI. The customization settings only get applied when you patch the firmware. The last step is to create the ROM file. If your try to convert the binary to a final ROM file with the project open, you will get an error.

Figure 10: Reference Error in the BLDK Application

You can either move the CROWNBAY.fd file to the location of the .absf file, or close the project and do the convert per section 4.7.3 to create the newly built binary.

Conclusion

Custom building a PC was once thought a thing of the past, but the Intel® Atom™ E6xx, N2000, and D2000 series offer new opportunities to create custom devices. The BLDK brings back firmware development with more features and easier build tools without having to focus on the chipset initialization.

Coding a new boot system from scratch is tricky, and leaves developers with the choice of coding for a virtual machine without fine optimization or coding for existing hardware and potentially going through a lot of expensive equipment while testing. Intel’s Boot Loader Development Kit makes creating

Page 10: Simplified Firmware: Intel ® Boot Loader Development Kitcpop/Documentatie_SMP/Intel... · Option 1: Create the Final Firmware Based on an Existing Binary The .asbf file can be used

Copyright © 2013 Annabooks All Rights Reserved.

customized boot firmware a much simpler proposition, and integration with Intel’s UEFI framework simplifies things further.

Open Software Stack for the Intel® Atom™ Processor covers software development for embedded systems from the BIOS level up through operating systems, device drivers, and sets of tools, the latter of which are optimized for Intel’s Atom line of processors. Liming and Malin introduce developers to a wide range of open source tool kits and building environments. The book will be invaluable for helping developers new to Linux set up a system, create builds, and run tests, laying the foundation for innovative development of embedded system solutions.

This article is based on material found in the book Open Software Stack for the Intel® Atom™ Processor by Sean D. Liming and John R. Malin. Visit the Intel Press website to learn more about this book:

http://noggin.intel.com/intelpress/categories/books/open-software-stack-for-the-intel-atom-processor.

Also see our Recommended Reading List for similar topics:

http://noggin.intel.com/rr.

About the Author

Sean D. Liming has been involved with embedded systems for over 15 years. He started with Microsoft's first embedded distributor Annasoft (Annabooks Software) with products such as MS-DOS, Windows 3.1x, and Windows 9x before the introductions of Windows CE and Windows NT Embedded. Sean has authored over 35 articles and eight books including the popular Windows XP Embedded Advanced and Professional's Guide To Windows® Embedded Standard 7. He has traveled around the world as a featured speaker at Microsoft embedded conferences. Besides the books and articles, he has created the first classes on Windows CE, NT Embedded, .NET Micro Framework, and POS for .NET. He has also created advanced classes for XP Embedded and Windows Embedded Standard 7. Sean has worked at Intel focusing on XScale™ for telematics, and he was the head of engineering at Annasoft Systems. Sean is currently the owner of SJJ Embedded Micro Solutions, LLC. and subsidiary Annabooks. In 2002, he became a Microsoft MVP. He received his BSEE from California State Polytechnic University in Pomona, California; focusing on computer architecture and design.

John R. Malin was an early pioneer in using IBM-PC's to develop embedded software for x86-based embedded devices in the mid 80's. Over the past 20 years John has worked with a number of embedded operating systems starting with VRTX, Nucleus, PharLap, ThreadX, Windows Embedded OSes, and .NET Micro Framework. He has also co-authored a number of articles, white papers covering embedded development, and the book Real-Time Development from Theory to Practice. John is a cofounder of Annabooks, LLC and has a BS and MS in Solid State Physics from Case Western Reserve University.

No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior

Page 11: Simplified Firmware: Intel ® Boot Loader Development Kitcpop/Documentatie_SMP/Intel... · Option 1: Create the Final Firmware Based on an Existing Binary The .asbf file can be used

Copyright © 2013 Annabooks All Rights Reserved.

written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to:

Copyright Clearance Center 222 Rosewood Drive, Danvers, MA 01923 978-750-8400, fax 978-750-4744

Portions of this work are from Open Software Stack for the Intel® Atom™ Processor by Sean D. Liming and John R. Malin, published by Annabooks, Copyright 2013. All rights reserved.