Posted by notKlaatu , 08 December 2008 · 804 views
Funny thing, three people recently have come across powerPC computers and have mentioned it to me, and this started to get me thinking again about Open Firmware, the old pre-Intel "BIOS" for Apples computers. The obligatory history: around the original iMac days, Apple took Sun Microsystem's OPEN FIRMWARE and used it for their logic boards. When they switched to Intel, they continued in their tradition of "actually on second thought we hate things that are open" and went to that wonderful proprietary system of EFI.However, there are still Open Firmware systems out there, so I may as well jot down some notes on signficiant Open Firmware commands.To get into Open Firmware, you boot the powerPC Mac whilst holding down Apple-Option-O-FA scary white screen appears, with black text...looks a bit like a UNIX shell but doesn't really act much like one. This is open firmware, courtesy of Sun and crippled as much as possible by Apple.ALIASESThere are aliases assigned to certain bus locations (is that a real term?)...ie, they have assigned the alias "hd" to some location like /pci@f4000000/ata-3@d/disk@2To see a list of such aliases, you can type in:
devaliasAnd that will return a screenful of all the aliases that firmware is aware of. So in theory, if we set a certain variable to "cd" then we should be telling th ecomputer to automatically boot of of location /pci@f500000000000/ata-4@d/disk@1 (just an example)VARIABLES We can see what variables are set in the system by typing in
dev /option .propertiesThis returns a really long list of all the firmware variables. If you are seeking to add your own oem banner and logo, this would be the place to do that. More likely, if you are seeking to alter the device from which the computer starts, this is the right area as well. In this list, notice that boot-device is set to hd and perhaps tbxi. If you want to set it to a specific device, like ethernet, then you can issue a command like...
setenv boot-device enet...which should return the value of "ok" and you can double-check that it's been set by issuing again:
dev /option .propertiesand looking to see what the value of boot-device is.I have had success doing this with ethernet...and that's about it. For CD and others, it really seems to want you to hold down the 'option' key during boot. Of course, even Ethernet has a snag key -- hold down 'n' during boot -- so going into firmware just to set ethernet as your boot-device is kind of silly.But what you can also do here is define which IP address specifically you want to boot from:
boot enet:192.168.1.4,filename,192.168.1.3;255:255:255:0;192.168.1.1...which translates into: boot enet:<ip of server containing the linux boot image>,<the boot file..whatever that would be>,<your local machine's address>;<the gateway address>As of this writing, I have not yet had any success with that, but then again I have never really booted off a network much less set a netboot server up, so iI really have no idea what I'm doing.But what I have had a little success with is telnet.TELNETTo put this machine into telnet mode, you first type:
dev /packages/telnetand, again, you should see an "ok" response. Now telnet is running and you will need to type this:
" enet:telnet,192.168.33.33" iolet's look at that character by character:" -- yes that's a quotation mark -- yes that's one blank spaceenet: -- that is "enet" for ethernet and a colontelnet, -- that is "telnet" to start the telnet protocol and a comma192.168.33.33 -- you can make up whatever ip address you want to give this computer; so take a look at your other computers, see what the IP address is, and choose an address within that same subnet...ie, if one machine is 192.168.33.32 then you might choose 192.168.33.33 and so on." -- close quotation io --- space and iohit return.The machine gives you an OK, I think, and then just kind of sits there stupidly. You might think it has crashed. But if you ping it, you will see that it is in fact responding to pings. Pretty fancy.To be safe, btw, what I usually do is get on my master computer and start pinging the address i'm about to give the little telnet server on the Mac. You'll see it respond that "host is down" or something like that. Now go to the Mac, do the open firmware magic, and as soon as you hit Return at the final telet command, you'll see the pinging kick in. That is not only extremely gratifying, but it also is fairly good confirmation that you are pinging the computer you think you are pinging.To telnet into the Mac, you simply type into your other computer's terminal:
telnet 192.168.33.33and straight away your prompt there in the terminal becomes an open firmware prompt, and you can run all the commands...but with the benefits of copy and paste and all other bash-like functions. Now, what this is actually good for, I'm not really too sure. There is really only so much you can do in Open Firmware, and whether it is possibly to install a linux distro via THIS telnet connection, I am not clear about. I did try and failed, but then I failed on a telnet install via normal PC to normal PC as well, so basically installing linux via telnet is just something I am not ready for yet.WHAT'S THE POINT?The point of Open Firmware is, of course, that it's a door into the firmware settings of your "new world" but pre-Intel Mac. If you're a firmware programmer this probably means something to you. Otherwise, there is usually little you'll find that you can do here that you can't do via some OS. So whether you'll ever really NEED to go into Open Firmware is highly questionable.The one time it did save a laptop in my experience was when I had some iBooks that were acting strange, and all the Apple "Experts" (I mean "Geniuses" but I think it's a trademarked term now so one must be careful with it) were all telling me that it was a bad logic board.... on all the iBooks I brought to them. Talk about an odd coincidence! Of course I didn't believe them, and instead went home, got into Open Firmware, and found out what was REALLY going on. It was through open firmware (which was helpful because of course you get to open firmware well before you ever get to an OS, and the OS wouldn't boot) that I diagnosed what each iBook actually had wrong with it, and then I was able to take them all apart and reassemble them into one working iBook. But of course you would know all this if you listened to Season 2 of The Bad Apples, so I will say no more.Now, normally all the other normal things you'd want to do via Open Firmware can probably be achieved by non-volatile RAM settings (google "nvram + OS X")....but Linux doesn't have the nvram application that OS X ships with, so if you need to set these variables while running Linux (which you should be on a Mac) the Open Firmware might your ticket to setting things like boot devices and OEM banner messages and...I dunno...stuff.CLOSINGIn closing, I'd just like to say that Open Firmware > EFI < openEFI but let's face it: chip manufacturers are evil. They lock in their code, they program in Windows, write to the chips with proprietary chip baking machines powered by Windows, and make everyone's life difficult. So next time you close your fancy Linux laptop, or your OS X machines (even though they are perfect and never do anything wrong - if I had a buck for every time I closed my Mac at work and come back to find it either shut down or crashed or strangely suddenly in a deep hibernation that requires it to be shut down and then rebooted, I'd be rich) don't call up the Linux devs. Call the chip manufacturers. And heck, call Apple and HP and Sony and all these manufacturers. If they're good for anything, they would start putting some pressure on these chip manufacturers to go Open Source (haha, they would never do that) or at least start being more open about the code that everyone needs to access in order to get things to work the way it ought to work.TANGENTI know I know, I just closed...but let's face it...would that ever happen in open source? Technological advancement being held up because people won't share code? Well...obviously a rhetorical question.