Questions and answers on OpenBoot Summary OpenBoot -- the firmware in the Sun boot PROM -- is an obscure component of any workstation, but it turns out to be pretty important, with some interesting features. Solaris expert Steve Leung of Amdahl uses a Q&A format to reveal the dark magic of an oft-overlooked system every administrator can use. You may not need this information today, but add it to your bookmarks so that the next time you need to diagnose a pesky hardware problem this information's at hand. By Steve Leung ------------------------------------------------------------------------ Contents * What is OpenBoot? * What is the main advantage of OpenBoot? * Why do application developers need to care about OpenBoot? * How do I access OpenBoot? * What is Forth doing in OpenBoot? * What does a Forth program look like? * How do I change the OpenBoot settings? * How do I stop people from rebooting my workstation? * How do I change the Power-on Banner? * How do I boot a different kernel? * What exactly happens during the boot process? * Can I boot from any device? * What are the option parameters available in booting Solaris kernels? * What other standalone programs are available for OpenBoot? * What is a device tree? * How do I interpret a device tree? * How do I create device aliases? * What can I do with a device node? * How do I perform device diagnostics? * How do I make permanent changes in OpenBoot settings? * How do I do program debugging with OpenBoot? * At OpenBoot, can I mount file systems and access files? * Where can I find more literature on OpenBoot and related topics? Q: What is OpenBoot? When you turn on a Sun workstation, the firmware in the boot PROM (programmable read-only memory) is executed immediately. The main function of a boot PROM is to load a standalone program to the core memory and start its execution. Standalone programs can be operating systems, diagnostic software, and others. The firmware in Sun's boot PROM is called OpenBoot. Other than initial program loading and invocation, OpenBoot provides debugging features to assist kernel debugging and board bring-up. Q: What is the main advantage of OpenBoot? Sun offers many different machine architectures (e.g., sun4d, sun4m, etc.) and boot devices (e.g., different types of disks). Instead of having different versions of the boot PROM firmware to support all combinations, OpenBoot supports plug-in device drivers. The drivers are written in a dialect of the interpreted language Forth (OpenBoot implements a Forth interpreter). The code for the driver may reside on the device PROM itself or in empty space on the system board PROM. This plug-in feature allows Sun or any third party vendors to develop new boot devices but without recompiling or relinking the boot PROM. Another nice thing about OpenBoot is that it behaves the same across platforms. The newer revisions provide new commands, but generally OpenBoot is stable. Sun hasn't released a major revision in more than a year. Q: Why do application developers need to care about OpenBoot? When the network connected to your workstation is down, and you have nothing else to do, you can always go to OpenBoot to write a Forth program to entertain yourself for a few hours. Besides that, there are many practical things you can do with OpenBoot, such as security and device diagnostics. Q: How do I access OpenBoot? Pressing the keys L1(Stop) and A at the same time will bring you to the OpenBoot system. You will see the display Type b (boot), c (continued), or n (new command mode) > You are now interacting with the restricted monitor that allows you to do three things. Typing b boots a standalone program (most likely the operating system). Typing c resumes the execution of a halted program. Typing n gets you to the Forth monitor, and the prompt will change to ok. Most of the Forth language syntax is accepted at the Forth monitor, a.k.a., the ok prompt. ok Now you are ready and able to do many interesting things. To continue executing (e.g., return to the OS), type ok go Q: What is Forth doing in OpenBoot? OpenBoot contains a command interpreter (something like the shell). Instead of providing a new command language syntax, it incorporates a dialect of the programming language Forth. Forth is a popular language used in many embedded systems. Because the language is simple and its interpreter small, Forth systems take up very little space. They fit perfectly into PROM. Q: What does a Forth program look like? Forth programming is interactive, much like BASIC programming. You see the result immediately. Forth commands are also called words. In addition to accepting arguments, Forth words rely heavily on values in the Forth stack, which is a last-in, first-out (LIFO) buffer for temporarily holding information. The word showstack shows the current content of the stack. Forth uses postfix notation rather than infix. For example, in Forth, you write "3 4 +" instead of "3 + 4". You can define your own Forth word. The syntax is weird. A colon starts the definition, and semicolon ends it. (There is a space between the colon and the name of the word.) In the following example, we define a new Forth word double, which doubles the value of the top stack item. dup and + are built-in Forth words. dup duplicates the top stack item. + adds the topmost two stack items and pushes the result on top of the stack. The built-in command . (yes, it's a period) pops the top stack item and displays it. You can see the source code of any Forth word by the command see. ok : double dup + . ; ok 4 double 8 ok see double : double dup + . ; Page 1 of 3, continued... Page 1. Introduction Page 2. Q: How do I change the OpenBoot Page 3. Q: Can I boot from any Printer-friendly (all-in-one) version About the author Steve Leung (SSL20@amdahl.com) is a senior software engineer at [Image]Amdahl Corp., Sunnyvale, CA. He works on the Amdahl A+ edition of Solaris and on UTS (Amdahl's version of Unix SVR4 on S/390 mainframes). Home | Mail this Story | Printer-Friendly Version | Comment on this Story Advertisement: Support SunWorld, click here! [Image] Tell Us What You Thought of This Story -Very worth reading -Too long -Too technical -Worth reading -Just right -Just right -Not worth reading -Too short -Not technical enough [(c) Copyright 1995 Web Publishing Inc., and IDG Communication company] If you have technical problems with this magazine, contact webmaster@sunworld.com URL: http://www.sunworld.com/swol-10-1995/swol-10-openboot.html Last modified: Tuesday, September 21, 1999