NIC EEprom, Apple PowerBook-G4 @ 1.6Ghz

Apple hardware/software and related topics.
Forum rules
Any posts concerning pirated software or offering to buy/sell/trade commercial software are subject to removal.
robespierre
Posts: 1438
Joined: Mon Sep 12, 2011 2:28 pm
Location: Boston

Re: NIC EEprom, Apple PowerBook-G4 @ 1.6Ghz

Unread postby robespierre » Fri Feb 05, 2016 7:14 am

I have one, but it is currently in use and can't be taken apart.
I believe it is stored in the 28F008, but this might be wrong.
:PI: :O2: :Indigo2IMP: :Indigo2IMP:

robespierre
Posts: 1438
Joined: Mon Sep 12, 2011 2:28 pm
Location: Boston

Re: NIC EEprom, Apple PowerBook-G4 @ 1.6Ghz

Unread postby robespierre » Fri Feb 05, 2016 11:34 am

If all you want is to change the MAC, this can be done from software by copying the driver and editing it. Then you force the real driver to unload and load the copy.
:PI: :O2: :Indigo2IMP: :Indigo2IMP:

robespierre
Posts: 1438
Joined: Mon Sep 12, 2011 2:28 pm
Location: Boston

Re: NIC EEprom, Apple PowerBook-G4 @ 1.6Ghz

Unread postby robespierre » Fri Feb 05, 2016 10:52 pm

Then I think you need to write to the flash. In these machines the flash is writeable if the CPU maps its physical region. So if you open /dev/mem at 0xFFF0,0000 and dump it to a file, and search for the MAC address (which will be "prop-encoded"), you could change it by writing a different address back (also "prop-encoded"). The property is readable from Open Firmware at
dev /enet .properties
called "local-mac-address". I don't know how to set this from Open Firmware, it may not be easy to do.

It goes without saying that writing to the flash can brick the machine. There is also an area of a 28F008 that is treated as NVRAM and it might be in that area, although it is not in any of the exposed nvram variables.

Another idea is that if you wrote FCode that set the MAC address at boot time, it might or might not be honored by the system (it depends on order of execution of the boot options). You would put the FCode to do this in the nvram variable "nvramrc". It would be permanent in the sense of always being run before loading the OS, but without changing the firmware directly.

You would do something similar to (check this):

Code: Select all

# nvram use-nvramrc\?=true nvramrc="dev /enet create my-address a0 c, b0 c, c0 c, d0 c, e0 c, f0 c, my-address encode-bytes \" mac-address\" property"

or perhaps this: [fixed a bug]

Code: Select all

# nvram use-nvramrc\?=true nvramrc="dev /enet \" \"(a0 b0 c0 d0 e0 f0)\" encode-bytes \" mac-address\" property"
Last edited by robespierre on Sat Feb 06, 2016 9:28 am, edited 4 times in total.
:PI: :O2: :Indigo2IMP: :Indigo2IMP:

robespierre
Posts: 1438
Joined: Mon Sep 12, 2011 2:28 pm
Location: Boston

Re: NIC EEprom, Apple PowerBook-G4 @ 1.6Ghz

Unread postby robespierre » Sun Feb 14, 2016 1:44 pm

OK, I was able to restart and test whether this works:

Code: Select all

sudo nvram use-nvramrc\?=true nvramrc='dev enet " "(aa bb cc dd ee ff)" encode-bytes " local-mac-address" property'
Short answer: it doesn't.
The escaped double-quotes in the version supra cause problems with csh (it complains they don't balance). With ksh they work ok. You can force them to work in tcsh with the backslash_quote shell variable. But using single-quotes is a cleaner solution (but see infra).
Setting the " local-mac-address" property in the enet package works from the Open Firmware prompt, but vagaries of the probing process overwrite the property if done from nvramrc.
You can get an idea of the process from Oracle docs.
http://docs.oracle.com/cd/E19620-01/805 ... index.html
(although banner and suppress-banner don't seem to be defined in Apple's FCode, so there appears to be no way to override the probe steps)

I still couldn't get it to work from nvramrc, so I wrote a test:

Code: Select all

sudo nvram nvramrc='true value mymac : checkit " local-mac-address" " enet" get-package get-package-property if else drop to mymac then ; checkit'

If you drop to Open Firmware console by holding Command-Option-O-F during the boot chime, you can see that the nvramrc has already run:

Code: Select all

words checkit
checkit ok

But there was no property to use then:

Code: Select all

mymac .
ffffffff ok

If we run it again now, the property is there:

Code: Select all

checkit mymac .
fd8e4532 ok


The problem is that when nvramrc runs, there is no mac-address property yet, because the enet device hasn't been probed. If we probe it ourselves the device tree gets messed up when OF does it again (tried that, OSX hangs on boot). What we need is to force some code to be run later, after probing is complete (when the console would be able to do it interactively).
The way that you continue booting OSX from the OF console is typing mac-boot. You can see what it does, funny enough, with the see word:

Code: Select all

see mac-boot
defer mac-boot : ...

A clue! interesting. We can change what happens when mac-boot runs since it is dynamic. It runs after all the probing and device init is done, after the console exits. But we still want that original code to run when we are finished for the OS to load.

Code: Select all

sudo nvram nvramrc='variable oldboot : changemac " local-mac-address" " enet" get-package get-package-property if else " "(aa bb cc dd ee ff)" drop -rot move then oldboot @ execute ;'" ' mac-boot behavior oldboot ! ' changemac to mac-boot"

(Notice the switch from single-quoting to double-quoting for the shell's sake.)
I tested this and it works.
:PI: :O2: :Indigo2IMP: :Indigo2IMP:

User avatar
ClassicHasClass
Donor
Donor
Posts: 1941
Joined: Wed Jul 25, 2012 7:12 pm
Location: Sunny So Cal
Contact:

Re: NIC EEprom, Apple PowerBook-G4 @ 1.6Ghz

Unread postby ClassicHasClass » Sun Feb 14, 2016 5:07 pm

Nicely done!
smit happens.

:Fuel: bigred, 900MHz R16K, 4GB RAM, V12 DCD, 6.5.30
:Indy: indy, 150MHz R4400SC, 256MB RAM, XL24, 6.5.10
:Indigo2IMP: purplehaze, 175MHz R10000, Solid IMPACT
probably posted from Image bruce, Quad 2.5GHz PowerPC 970MP, 16GB RAM, Mac OS X 10.4.11
plus IBM POWER6 p520 * Apple Network Server 500 * RDI PrecisionBook * BeBox * Solbourne S3000 * Commodore 128 * many more...

robespierre
Posts: 1438
Joined: Mon Sep 12, 2011 2:28 pm
Location: Boston

Re: NIC EEprom, Apple PowerBook-G4 @ 1.6Ghz

Unread postby robespierre » Sun Feb 14, 2016 6:41 pm

ClassicHasClass wrote:Nicely done!

Thanks, it was fun (and a dozen restarts). Apple OpenFirmware docs aren't much use, but Sun's OpenBoot 3 docs are very helpful.
:PI: :O2: :Indigo2IMP: :Indigo2IMP:


Return to “Apple”

Who is online

Users browsing this forum: No registered users and 2 guests