Saturday, November 19, 2011

how to patch mac os x manually

how to patch mac os x manually


Introduction

In a nutshell, kexts are the drivers in the Mac OS X world.
The base Mac OS X has several kernel extensions, known as .kext, which are compatible with more than the device IDs they are programmed with. First and foremost, a .kext is not a file, but a directory of files and subfolders which together create a working kernel extension.
An alternative to patching kexts is adding EFI-Strings or patching DSDT.
Here's a list of the default kernel extensions with their behaviour

.kext Patching Procedure

If we say patching kexts, we mean, that we add the PNPID number of our device to a kext. The PNPID is a unique identifer for the device. (Think of it as a model number.) As a result, OSX will try to use the patched kext on our device.
quote by zhell:
Some KEXTs use the "device-id" of devices attached to the PCI bus to decide (i) whether to start and (ii) to tweak their behavior depending on the specific device.
This allows some but far from all KEXTs to be tricked into believing that you have hardware that is used by Apple and thus enjoying support from Apple's drivers.
In some cases, a release of OS X, 10.4.1 or 10.4.3 for example, may have a working .kext for your hardware, but the version you are using does not. Generally speaking, a .kext from an older release of the OS usually can run without any changes when put into proper place in your current Operating System.
In other cases, an Info.plist file inside a .kext needs to have some information added. Usually this information comes in the form of a Plug-And-Play (PNP) device ID code. The following information is adapted from the entry for Audio, because the procedure fits most any kext changes involving PNP ID.
This guide assumes you have a working OS X system with limited functionality (e.g., Ethernet or audio not working) that you wish to patch. This guide relies on a patch table (at the end) which must be contributed to by readers, to help smooth the road to OS X functionality for those who follow. Please contribute to the Hardware .kext Patching List#Patch Table if you have discovered something that belongs there.
If you are simply copying an extension from some other drive or disc, you can proceed with Hardware

Find IDs

You need to find the PNPID for your device. The PNPID consists of the Device ID + the Vendor ID of your device. By the way, the PCIID is the PNPID in reverse order (VendorID and DeviceID have changed positions), Vendor ID+Device ID. So you have to find the Vendor ID and Device ID for your device.
PNPID = DeviceID+VendorID
Windows users may
1) find the Device id in Windows Device Manager (Control Panel > System > Hardware > Device Manager) Right Click the device > Properties > Details > Device Instance Id.
-OR-
2) use DXdiag (Start > Run > dxdiag) can give you Device ID from the "device" panel (upper left) of whatever tab pertains to your device. Note that devices that either do not install in Windows or are not used by DirectX cannot be learned about in this fashion.
-OR-
3) Software like the free Unknown Devices program can list all PNP devices in your system, and when you expand details, you'll get chip information (useful for finding who really makes the guts of the product, and a possible lead to a manufacturer's driver site), and as well the PNP ID itself.
No matter how you get this long string you will find a pattern like VEN_ABCD&DEV_DEF0 - though not necessarily in that order, and definitely not exactly matching this example. The 4 characters that follow "VEN_" are the Vendor ID (telling us whether this comes from Intel, nVidia, Rockwell, whomever) and the 4 characters that follow "DEV_" are the Device ID. The two together form a PNP ID that for this example would be expressed as 0xDEF0ABCD. First you put a 0x (indicating the code is a hexadecimal, or binary-representative code), then the 4 characters (0-9, A-F) for the Device first, then the 4 characters for the vendor second.
Linux users can use lspci. The listing for a peripheral will look like "0000:00:04.0 0401: 10de:0059 (revsomething)" 10de would be the Vendor ID, and 0059 would be the Device ID.

Run in native mode

Run OSX in NATIVE MODE. These procedures may have additional gotchas or drawbacks if you are running under VMware. However, the basic procedure is the same - just that results under VMware can be misleading.

[edit]Start Terminal

Run the Terminal program found in the Applications/Utilities folder.

[edit]Login as root

Get root access. (sudo -s is a secure method.) You will need to know an administrator password. If you are the only user set up for OS X, the password you created for your account should work.
sudo -s .

[edit]Enter the target directory

For this example, we will show modifying the Apple AC97 (audio) kernel extension. Note that the pattern of directories and subdirectories tends to be the same, only the "AppleAC97" parts (both) would change when patching some other kext. Note that this example regards changing a PlugIn that is inside the kext. This tends to be the most common form of patching. However, sometimes the Contents of the kernel extension are what need changing. cd /System/Library/Extensions/AppleAC97Audio.kext/Contents/PlugIns/AppleAC97AudioIntelICH.kext/Contents

[edit]Change permissions

chmod 644 Info.plist is the typical procedure, as most patches to a PlugIn require you edit the contents of the Info.plist file.

[edit]Edit your patch file

nano Info.plist is the simple editor for text files. Most new users can understand its use quickly. Mind you that anything you do has no harmful effect until you actually save your work. Therefore if you make an error, you can quit without saving and try again. In some instances, files other than Info.plist need to be changed. The Patch Table should indicate this. Assume Info.plist if there is no contrary instruction.

[edit]Insert your ID

Scroll down until you see Device Name in the text file. The Device Name here should be a human-readable device description, like "Intel ICH6 Audio" or "Realtek 81xx Ethernet". The Patch Table should indicate what Device Name to look for. You will see a part below this that says 0xABCD0EFF. This is the PNP ID string. Multiple IDs can appear between the  and  separated by a space. Enter yours in so it looks like 0x11470090 0xABCD0EFF. Generally speaking, listing your PNP ID first in this region is the way to go. Comments in the Patch Table should indicate otherwise. In some cases, you need to overwrite the old information and only leave your pertinent information in its place.

[edit]Save changes

If you believe you have made a successful edit to the file, press Ctrl+O to save it and then Ctrl+X to quit nano.

[edit]Testing your new .kext

You often can try out a kernel extension after patching. You change to the directory where the specific PlugIn you changed exists (example follows), and then kextload (example follows):
cd /System/Library/Extensions/AppleAC97Audio.kext/Contents/PlugIns/
kextload AppleAC97AudioIntelICH.kext

[edit]Check functionality

The plugin should be loaded - check your terminal screen for any error messages. Most plugins will affect the system in some way, e.g. add or change the behavior of an icon in System Preferences. Here it's up to you to decide whether you can (or need to) make more changes.

[edit]Housekeeping

Clean your extensions cache:
rm /System/Library/Extensions.kextcache
rm /System/Library/Extensions.mkext
(You may also just drag these two to the trash and give your password.)
Setup file permissions
chown -R 0:0 /System/Library/Extensions/YourExtension.kext
chmod -R 755 /System/Library/Extensions/YourExtension.kext
kextcache -k /System/Library/Extensions

Now you may reboot!

[edit]Patch Table

Warning: This part is similar to User_talk:Penguino_loco and to PCI_ID_CL.
Device NamePNP IDkext / PlugIn NameComments
nVidia AC97 AudiovariesAppleAC97Audio, AudioIntelICH PlugInAdd your PNP ID to the list. Will work with nForce 3/4.
Realtek 8139 Ethernet0x813910ec 0x13001186 0x12111113IONetworkingFamily.kextUnsure Info.plist is in Contents, or need a PlugIn selection. Browse around for yourself.
ATI x700 PCIe0x56531002ATIRadeon9700.kextAdd your ID to the Info.plist and HEX modify.
ATI (Sapphire) x800 PCIe0x554f1002ATIRadeon9700.kextAdd your ID to the Info.plist and HEX modify.
ATI (Powercolor) 9550 AGP 256Mb0x41531002ATIRadeon9700.kextAdd your ID to the Info.plist. CI, DVD, Quartz
ATI (Sapphire) 9600XT AGP 256MB0x41521002ATIRadeon9700.kextAdd ID to Info.plist
Belkin F5D 50830x815C050DRT2870USBWirelessDriver.kext
Maxtor 6Y120M0 (120 GB SATA)0x00E310DEAppleVIAATA.kextAdd your ID to the Info.plist.



Saturday, November 12, 2011

How to re sizing photos in adobe photoshop cs5?