2008/11/18
From JaxLUGWiki
These notes are a very brief overview of the material that will be covered at the meeting. They will provide links to various items that I will reference in the talk, and give those that don't attend an idea of what they missed out on! As always, please feel free to contact Andrew Henderson via e-mail at hendersa (at) icculus.org if you have any questions or would like some direction or advice in your experimentation and exploration.
Contents |
BIOS Operation and Linux Firmware Development
So you like creating things with computers? Are you interested in hardware? Software? Maybe a little bit of both? Where do you fall on the spectrum of fields that encompass computers and what makes them tick?
Physics (I like to know how things are moving at the particle level!)
... leads to ...
Electrical Engineering (I like to know how applied currents can be used to do useful things!)
... which is applied to ...
Computer Engineering (I like to combine logical hardware units to make complex circuits!)
... which is used by ...
Software Engineering (I like to construct and reuse algorithms to make applications!)
... which is based upon ...
Computer Science (I like to use applied math to find quicker and smaller ways to do things!)
... which is applied ...
Mathematics (I like to find the links between different concepts to find shortcuts!)
... which is used to describe ...
Physics (We're back at the beginning!)
Some knowledge in each of these various areas makes firmware development, the synthesis of software and hardware, a difficult field. But, it is also a field of great variety and flexibility. Up until recent years, the development of hardware and firmware was an expensive task that required a lot of specialized equipment and knowledge. The purpose of this presentation is to show you that it is nowhere near as expensive as it used to be, and it is now an area well-suited for the casual hobbyist.
The BIOS: The Starting Place For Hardware
Hardware is a bit confused when it first receives power. It is not in a consistent state, and needs to be initialized. RAM and registers will contain random gibberish. Everything must be reset and initialized prior to being used. This is one of the main tasks of the BIOS.
On your typical x86 motherboard for a desktop PC, there are many different components:
- Removable RAM modules
- IO controllers (USB, serial, parallel ports)
- Hard drive and floppy controllers
- Integrated features like NICs and sound chipsets
- CPU
- PCI bus controller
The BIOS is a binary that is executed by the CPU when the CPU first starts up. It is typically stored in an EEPROM on the motherboard. This chunk of code initializes all of the above components and resets them to a pre-determined initial state. To do this, the BIOS needs to be written specifically for the chipset present on the motherboard. The chipset in question is typically a combination of two chips: the northbridge and the southbridge.
Writing Your Own Motherboard BIOS
Would you like the experience of developing your own motherboard BIOS? The coreboot project is the best place to start! This project is designed to serve as a reference implementation of the various pieces of a BIOS. Most BIOSes don't fill the entirety of the PROM on which they reside, which means you can squeeze extra data, called a payload, onto the BIOS PROM. This allows you to do things like boot your OS in mere seconds. Embedded devices use this approach all the time. The BIOS initializes the hardware, and then begins executing a bootloader. A common bootloader that is used for Linux-ish embedded systems is RedBoot. The bootloader is responsible for grabbing the kernel from wherever it is residing and getting it up and running.
Writing Your Own Microcontroller Firmware
Developing a BIOS for a motherboard is a big, big job. You need documentation on many different chipsets doing many, many different jobs. Wouldn't it be easier to start small? Like with only a single chipset? Luckily, there are a variety of places to start when you are beginning firmware development that are simple, fun, and easy on your budget:
Creating Your Own Hardware
So you understand the fundamentals of BIOS development and want to dive into the design of the hardware itself? Luck for you, it is a logical transition from firmware development to hardware development. There are a variety of resources available for you to learn and experiment with hardware development:
- The VHDL Cookbook, a free e-book in .pdf format teaching the basics of VHDL
- Xilinx ISE WebPACK, a development and synthesis tool that is free (as in beer) and available for both Linux and Windows
- Xilinx Spartan-3AN Starter Kit, a self-contained development kit that is everything you need to develop FPGA designs
- opencores, a collection of hardware chipsets that are free for your use in your own designs
- FPGA Arcade, a collection of old arcade game boards that have been condensed into a single FPGA chip!
- Xilinx Spartan-3 PCI Express Starter Kit, create your own PCI cards! (Be sure you know how to write your own device drivers, though...)
Resources To Learn More
Books:
- Hacking the Xbox: An Introduction to Reverse Engineering by Andrew Huang.
- Embedded Systems Design, Second Edition by Steve Heath.
- Linux Device Drivers, 3rd Edition by Corbet, Rubini, Kroah-Hartman.
- Programming & Customizing PICmicro Microcontrollers by Myke Predko.
- Getting Started in Electronics by Forrest M. Mims III.
Tools:
- Xilinx for devkits, documentation, and development software.
- Parallax for various microcontroller development tools.
- Flashrom, a universal flash programming utility.
Parts:
- Digi-Key for practically any components that you will need in development. A $100 order from Digi-Key would get you enough parts for hundreds of different digital logic projects! Logic chips, EEPROMs, and all of the components needed for building schematics can be found here. They also sell a variety of useful items like soldering irons, breadboards, oscilloscopes, logic analyzers, JTAG kits, and EEPROM programmers.
Linux Commands To Explore:





