ADC Home > Reference Library > Technical Q&As > Hardware & Drivers > Apple Hardware >

Reducing the size of Physical Memory in Open Firmware


Q: Can I configure the Power Macintosh system so that the system thinks that there is less physical memory present than there actually is without having to open the system to remove memory sticks.

A: For all Power Macintosh systems with Open Firmware, you can implement settings to make the system believe that there is less physical memory than is actually present. This is useful for testing purposes when you don't want to have to physically remove RAM such as on the earlier iMacs or PowerBooks which require disassembly. The simplest method is supported by Mac OS X only. Under Mac OS X, you can use the Terminal application to enter the nvram command and reboot the system. There are additional methods which work within the Open Firmware environment.



Using Terminal to Set the Physical Memory Size for Mac OS X

The following instructions works for Mac OS X only. You must have root privileges in order to make this change. You will use the Terminal application to issue the nvram command to set the "boot-arg" environment variable. Follow these steps.

Step 1. Launch the Terminal application. The Terminal application is found at /Applications/Utilities/Terminal

Step 2. Enter the following command



         % sudo nvram boot-args="maxmem=64"


Step 3. Restart the system

The above commands implements the "maxmem" setting into nonvolatile RAM. This means that the setting is persistent across system restarts. If you had previous set boot-args to a different value, then the original value will be lost to be replaced by the "maxmem" setting. If you decide to change the setting before restarting, a subsequent setting will overwrite a preceding setting. If you misspell "boot-args" , there is no warning, a (probably useless) new entry into NVRAM is made, and the RAM use will be unchanged after restart.

An important caveat - the "desired memory size" must be a multiple of 2. If you specify an odd setting of 65, 129, etc, your system may hang during the boot process. If this happens, you will need to "zap PRAM" as described in the next section "Clearing the "maxmem" Setting".

Note that you can also implement the boot-args setting within Open Firmware. This option is discussed at the end of this Q&A under the section "Setting the Physical Memory Size for Mac OS X using "maxmem" in Open Firmware".



Clearing the "maxmem" Setting

The maxmem setting is set in NVRAM and will affect all system restarts, unless the setting is changed or cleared. Use the instructions above to set "maxmem" to a different value. To clear the maxmem setting, there are three options.

1. Use the Terminal application to clear the boot-args setting. For example, you could enter the following command within the Terminal application



         % sudo nvram boot-args=""


This command sequence clears the value of boot-args.

2. You can clear boot-args by "zapping PRAM". Restart the system and hold down the "Command-Option-P-R" keys until you hear the start beep a second time. Release the keys and the system will restart normally with all memory recognized. Keep in mind that resetting PRAM has the effect of clearing all custom NVRAM settings.

3. Finally, you can clear the "maxmem" setting using the Startup Disk Preference Panel to switch startup to a different disk or to Mac OS 9. This clears the boot-args "maxmem" setting and is similar to using the Terminal application to clear this setting.



Setting the Physical Memory Size for Mac OS 8/9 and Mac OS X Under Open Firmware

The following method works for system starts into both Mac OS 8/9 and Mac OS X. To have less physical RAM recognized, you need to delete the existing "reg" property in the memory node and create a replacement property with less memory specified. Follow these instructions.

Step 1. Enter Open Firmware.
Restart the system and hold the "Command-Option-O-F" keys down until the Open Firmware screen is displayed.

Step 2. Set the current directory to the memory node.
Enter the following at the Open Firmware prompt.



         dev /memory


Step 3. Display the contents of the memory node.
Enter the following command.



         .properties


Remember to include the period character at the beginning of the command. The following are the memory node properties for a PowerBook G3 (FireWire) with a 32M SODIMM in the lower slot and a 128M SODIMM in the upper slot.



name memory
device_type memory
reg         00000000 08000000
            08000000 02000000
slot-names  00000003
            SODIMM0/J2
            SODIMM1/J1
available   00003000 09bfd000
dimm-info   8008040c 09024000 01a06000 80100001 8f040601 01000ec0 70000014 14143210
            20102010 00000000 00000000 00000000 00000000 00000000 00000000 0000123e
            ce000000 00000000 014b4d4d 34203634 53313732 34425431 2d464c31 42010023
            a85400ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffff64cd
            8008040c 08014000 01a08000 80100001 8f040601 01000ef0 8000001e 141e3c08
            00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000141
            1cffffff ffffffff 014d4834 53363442 4b472d31 304c2020 20202000 57631a33
            b00a1400 00000000 00000000 00000000 00000000 00000000 00000000 00006606
dimm-types  SDRAM
            SDRAM
dimm-speeds PC100-322S
            PC100-333S


Step 4. Identify the "reg" values
Case 1 - The "reg" property from above is



         reg 00000000 08000000
             08000000 02000000


The first column is the starting address for the DIMM and the second column is the size of the DIMM - 0x08000000 is equivalent to 128M, 0x02000000 is equivalent to 32M. Note that the memory space always begins at location 0. If you try to set the starting address to an address other than 0, the system may not boot.

Case 2 - For a system with only 1 memory DIMM present, you might see



         reg 00000000 08000000


In this case, there is a single DIMM (SODIMM) of 128M memory present.

Step 5. Decide how much memory you want the system to think is present. You can only specify the same or less memory than is physically present.

Let's assume you want the system to recognize only 32M of the 160M of RAM present in Case 1 above.

Step 6. Delete the existing " reg" property.
At the OF prompt enter



         " reg" delete-property


There is a leading space character in " reg"

You can verify that the property is gone by entering the ".properties" command.

Step 7. Enter in a replacement " reg" property array. You will enter pairs of values where the first value is the beginning address and the second value is the size of memory at that location. To simulate 32M we can enter the following for both cases noted above.



         0 encode-int 2000000 encode-int encode+ " reg" property


In this case, 0 is the memory starting address and 2000000 (32M) is the memory size.

Verify that the property is now present with only a single array entry by using the ".properties" command. You should now see the following " reg" entry



         reg 00000000 02000000


Step 8. Continue the boot process
Enter the following at the OF Prompt.



         mac-boot


Once the Mac OS is active, you can verify that the system now only thinks that there is 32M present.

Note that this information is not written to NVRAM. When you reboot the system, the system will recognize the Physical RAM which is present.



Another Example Open Firmware Example

You may have a system with only one or multiple RAM DIMMs present. For all cases, the generalized command is



         0 encode-int XXX00000 encode-int encode+ " reg" property


where XXX00000 is the desired size of memory to limit the system to. XXX00000 cannot be greater than the amount of physical memory present on the system.

For case 1, if we want the system to think that there is 144M of memory instead of the full 160M, we do the following for step 7. Enter the following for this step.



         0 encode-int 9000000 encode-int encode+


This creates a " reg" property for a memory DIMM starting at location 0 with a size of 144M. After booting, if you open Apple System Profiler, it will show that there is only a single memory DIMM of 144M in the first slot. While it is possible to recreate the " reg" property so that two DIMM's are listed, that is beyond the scope of this Q&A.



Three DIMM Open Firmware Example

Whether you have one, two or many more DIMMs present, the same command format is used. You might have a G4 with three 128M DIMMs installed as displayed using the .properties command.



         reg 00000000 08000000
             08000000 08000000
             10000000 08000000


The total memory present is 384M. Lets assume that you want to limit the system to recognizing only 320M. For step 7. Enter the following.



         0 encode-int 14000000 encode-int encode+ " reg" property




2M Limitation

When specifying the size of memory present, the size must be a multiple of 200000 (or 2M) else the system may hang on start or enter a kernel panic. You cannot specify that the available memory is 65M for example, but you can specify that it is 66M. If you specify an invalid value, you may have to "zap PRAM" as described in the section - "Clearing the "maxmem" Setting".



Setting the Physical Memory Size for Mac OS X using "maxmem" in Open Firmware

For Mac OS X, you can create the maxmem property in nonvolatile (NVRAM) memory, which Mac OS X uses, if present, to define the amount of physical memory present. If this setting is greater than the actual amount of physical memory present, then the setting is not used. Once the setting is in NVRAM, the setting persists across system restarts.

To define the maxmem property from within Open Firmware, follow these instructions:

Step 1. Enter Open Firmware.
Restart the system and hold the "Command-Option-O-F" keys down until the Open Firmware screen is displayed.

Step 2. Enter the following command



         setenv boot-args maxmem=64


Note that there are no "double" quote characters used in this command line as there are when using the Terminal application.

Step 3. After the "ok" response, enter



         mac-boot


to continue the boot process.

The above commands implements the maxmem setting into nonvolatile RAM, which means that the setting is persistent across system restarts. To clear this setting, refer to the options described above in the section "Clearing the "maxmem" Setting".



References

Tech Note 1061 Fundamentals of Open Firmware, Part I: The User Interface, Part I in the Open Firmware Technote Series

Tech Note 2004 Debugging Open Firmware Using Telnet

Tech Note 1062 Fundamentals of Open Firmware, Part II: The Device Tree Part II in the Open Firmware Technote Series

[Dec 20 2001]


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.