Articles from The Mac Elite, CubeOwner & more

Showing posts with label install. Show all posts
Showing posts with label install. Show all posts

Saturday, July 5, 2008

Leos Little Helper: Script to install Leopard below 867 MHz

The following AppleScript (available for download) is an aggregation of the first two articles on this subject, condensed into a double-clickable application that might even work on PowerBook G4 computers in need of it.
The PowerBook support is a contribution from an article at InsanelyMac authored by their member rdemby (as far as I can tell — at least it's the oldest reference I found using max-clock-frequency).

-- The required FCode gets executed as part of the "boot-command". Its first action is to reset this variable to its default value so the change of the perceived CPU frequency will never survive the next restart – no permanent settings are made.
(A similar technique is used by the "Target Disk Mode" option in the "Startup Disk" pane of the "System Preferences".)

-- "max-clock-frequency" is preferred over "clock-frequency" as it seems to be used by older PowerBooks to describe the nominal CPU speed. No tests have been run yet on such hardware in the given form.

do shell script "nvram boot-command='set-default boot-command dev /cpus/@0

d# 867000000 encode-int \" max-clock-frequency\" 2dup active-package find-property

0= if 2drop \" clock-frequency\" then property device-end multi-boot'" with administrator privileges

tell application "System Events" to restart

PS: On a dual CPU system the clock-frequency will be duplicated by the OS from the first to the second CPU so this script is sufficient to satisfy the installer regardless of the number of G4s.

Sunday, February 24, 2008

Uninstalling Firmware

With the given script it is possible to reflash the same (or even an older) version of a plain Apple firmware and thereby remove any patches by third-party vendors.

It is important that this must only be done on a system without a CPU upgrade (using the 7447 and 7448) that requires firmware patches. The Mac would be dead until the reinstallation of an original G4 or other type of accelerator !

NVRAMRC patches for booting into Mac OS 9 will survive a flash, but can get cleared using Command-Option-P-R. Other similar patches (as the lba-48 property) would have to be reapplied.

Retro-fitting old FirmWare and re-installing the newer

Searching through my CD archive I've found two different versions of the firmware updaters for the PowerMac G4 and the Cube (as well as the iMac, iBook, PowerBook and even a G3) on Mac OS install CDs:

Mac OSPowerMacCube
9.2.14.1.84.1.8
10.14.1.84.1.8
10.24.2.84.1.9
(both are still current)

Using them I successfully downgraded the firmware of a Sawtooth from the current 4.2.8 to the older 4.1.8 and back to 4.2.8 again. Further analysis of the code shows that it will only flash a firmware with the same major version as in the ROM (or upgrade from 3 to 4 as a special case). Even the firmware from another model would be accepted — Never ever try such a crossflash as it will most likely leave the motherboard completely dead and therefore without a possibility to correct the flash !

The firmware NVRAM variables will survive the flash, including any NVRAMRC patches (as the lba-48 property), but do NOT flash a plain firmware with a (7447 or 7448 based) CPU upgrade that requires its own patches.

While at it I also tested manually booting the flasher from the Open Firmware command prompt. With one of the CDs from the table above (or a CD-R with just the "Firmware" file) it is possible to upgrade or reflash the firmware without any Mac OS on the system !


No Macintosh was harmed during the making of this post.

Monday, February 18, 2008

Running Firmware Updaters from Mac OS X

Judging from my analysis of the Firmware Updaters for various G4 (including the cube) it should be surprisingly easy to run those flashers officially "requiring" Mac OS 9 from OS X instead !

The "Firmware Updater" included in such a download does NOT perform the flashing, but only checks if the update can be applied ("Firmware" file supports the Mac model and has a newer version) and arranges to restart the Mac into the "Firmware" file. This file not only contains the new firmware image, but in front of it also the complete program required to flash the ROM. The flasher is written (mostly) in FCode source allowing deep insights into its inner workings (if Forth is your kind of bedtime reading).
All of this means that the flasher runs in the context of the Open Firmware before any part of (any) Mac OS is even loaded and does NOT depend on a specific version. It should therefore be possible to simply boot a copy of the "Firmware" file on a hard disk from the Open Firmware command prompt.

In order to make this process painless to comply with I've created a short script (available for download as fwupdater):

#! /bin/bash -

flasher='/Volumes/G4 Cube Firmware Update/G4 Cube Firmware'

cp -ip "$flasher" /TrashMe || exit

 preferred=(`nvram boot-device`)
IFS=\",  bootpath=(`ioreg -p IODeviceTree -n chosen -w0 | fgrep bootpath`)

sudo nvram boot-command=mac-boot boot-device="${bootpath[3]},\\TrashMe" \
 preferred-boot-device="${preferred[1]}" &&
osascript -e 'tell application "System Events" to shut down'
sudo -k

It first copies the "Firmware" file to the root of the boot disk and carefully sets it up as boot-device so the flasher will run on the next system start, even it is on a slave ATA disk or maybe an external firewire drive. The flasher will restore the former boot-device after it's done. No verification is performed, but the flasher will roughly test for compatibility on its own.

Steps to follow while logged in as an administrator:

  1. Download the updater. English is assumed, but the firmware itself is not language dependent.
  2. Print the instructions while still on this page.
  3. Open the disk image so it will appear on the desktop.
  4. Open fwupdater from the Finder. It will launch in a Terminal window and ask for your password so the boot device can be set. After that the Mac will be shut down.
  5. Closely obey the printed instruction on turning on again while holding the programmer's button (beginning with step 4).
  6. The flasher will restart the Mac after the update. Use the System Profiler to verify the new Boot ROM Version.
  7. Delete "TrashMe" from the root of the boot disk.

The script can be used for other PowerMacs with Mac OS 9-based firmware updaters, if the pathname at the top is set to the correct "Firmware" file.

IMPORTANT: I don't have a PowerMac requiring an update anywhere near me, so my tests couldn't include the flashing itself, and were only performed under Leopard. I'm confident that the method described here does work (under any version of Mac OS X), and it eliminates the need to "borrow" (or buy) and install Mac OS 9 when a firmware update is all that is needed.
Volunteers ?

Saturday, December 22, 2007

Steps for booting from drives other than the primary CD/DVD

The following is a small variation of the method from the first article:
Instead of assuming that the Mac OS X Install DVD can be booted from the built-in optical drive connected in the standard location the following code (downloadable as 867MHz.txt) brings up the systems boot menu to start the installation from any accessible boot device, including for example external DVD drives, FireWire hard drives and even NetInstall servers.

\ Claim first CPU runs at 867 MHz, and let the user select the Install DVD:
dev /cpus/@0 d# 867000000 encode-int " clock-frequency" property
multi-boot

boot cd:,\\:tbxi has been replaced by multi-boot; the other changes are purely cosmetic.

Steps to perform (as previously described):

  1. Move the file 867MHz.txt to the root of the primary partition on your master drive (originally Macintosh HD, where the System folder usually resides).
  2. Reboot
  3. Press and hold Command-Option-O-F until you enter the Open Firmware monitor.
  4. At the Open Firmware command prompt ("0>") enter boot hd:\867MHz.txt.
  5. Now it is your responsibility to select the Mac OS X Install DVD, wherever you placed it.

I still recommend the first method in most cases, but the steps here can be helpful when your Mac doesn't have an internal DVD drive.

I'm convinced that any changes to the nvrams content should be avoided for the application of this technique because they carry the risk of complications, might not be removable as clean as it seems on the first sight and the installer on the DVD only has to be fooled once — keep a simple trick easy !
(This modification will never survive the next reboot.)

PS: I don't think an adjustment is necessary for dual CPU systems as any Apple-supplied configuration has both CPUs running at the same clock so I expect the installer to only check the first one. Has anybody tried this ?
(Otherwise see the first article.)

Tuesday, November 13, 2007

Using Open Firmware to install Leopard below 867 MHz

It is easy to fake the CPU frequency in the device tree and make the installer happy. Just copy the following code into a file called fastG4.txt, place it in the root of the primary partition on your master drive (originally Macintosh HD, where the System folder usually resides) and reboot into the Open Firmware monitor (holding down Command-Option-O-F).

\ Claim first G4 runs at 867 MHz, and boot from CD/DVD:
dev /cpus/PowerPC,G4@0
d# 867000000 encode-int " clock-frequency" property
boot cd:,\\:tbxi

After inserting the installation DVD execute the new file at the command prompt using boot hd:\fastG4.txt.
The use of a file is only intended to ease the command entry, especially when needed more than once, i.e. the code can be input directly at the prompt as well.

This might also be helpful in testing other software excluding slower CPUs.
I don't know if this is sufficient for a dual CPU system. Repeating the sequence of line 2 & 3 with @1 instead of @0 will set the property for both CPUs.

Note that the device tree is only a volatile inventory of the hardware found by the Open Firmware during the system start sequence, so these entries will be reset at the next reboot, and (before somebody gets this wrong) we are not talking about overclocking here at all !

PS: A modified file can be used if the Mac OS X Install DVD can't be booted from the built-in optical drive.