LexHimself Posted March 8, 2015 Share Posted March 8, 2015 Hi, I'm currently working on a script to automatically patch the files to get the HD4600 working. The script works as intended, but has no checks. What i would like to do is check for a value in a plist or binary, if present, continue patching, if the value is not found, skip the file. Did some research, but failed to get it working. Any help would be appreciated. #!/bin/bash #Definitions p5000=/System/Library/Extensions/AppleIntelHD5000Graphics.kext/Contents/Info.plist b5000=/System/Library/Extensions/AppleIntelHD5000Graphics.kext/Contents/MacOS/AppleIntelHD5000Graphics pazul=/System/Library/Extensions/AppleIntelFramebufferAzul.kext/Contents/Info.plist bazul=/System/Library/Extensions/AppleIntelFramebufferAzul.kext/Contents/MacOS/AppleIntelFramebufferAzul if [ $(id -u) != 0 ]; then echo "You need to run this script as root. Type sudo -s, enter password and run this script again." exit fi #Inject ID to AppleIntelHD5000Graphics Info.plist echo "Patching $p5000" sudo sed -i.bak 's/0412/0416/g' $p5000 echo "Info.plist patched" #Patch AppleIntelHD5000Graphics.kext binary echo "Patching $b5000" sudo perl -pi -e 's|\x86\x80\x12\x04|\x86\x80\x16\x04|g' -i.bak $b5000 echo "AppleIntelHD5000 binary patched" #Inject ID to AppelIntelFramebufferAzul Info.plist echo "Patching $pazul" sudo sed -i.bak 's/0412/0416/g' $pazul echo "Info.plist patched" #Patch AppleIntelFramebufferAzul binary echo "Patching $bazul" sudo perl -pi -e 's|\x60\x00\x00\x00\x00\x60\xD9|\x90\x00\x00\x00\x00\x80\xD9|g' -i.bak $bazul echo "AppleIntelFramebufferAzul binary patched" #Update caches echo "Updating caches" sudo touch /System/Library/Extensions sudo kextcache -u / echo "Finished" Example: #Inject ID to AppleIntelHD5000Graphics Info.plist echo "Patching $p5000" if 0412 found then sudo sed -i.bak 's/0412/0416/g' $p5000 echo "Info.plist patched" else skip file echo " file skipped" Link to comment Share on other sites More sharing options...
Administrators Hervé Posted March 8, 2015 Administrators Share Posted March 8, 2015 I believe your Azul binary patch may be incorrect or meant for some specific systems. Personally, this is not how I binmodded my framebuffer when working on my mobile HD 4600-based Dell E6440. I presume you're looking at patching for Yosemite. You did not make that clear and that's pretty critical to avoid confusions and mistakes for/by other people. Link to comment Share on other sites More sharing options...
LexHimself Posted March 8, 2015 Author Share Posted March 8, 2015 Hi, The azul binary patch is to fix artifacts and increase the vram, the value that is being changed belongs to 06 00 26 0A, and only is found once in the binary. 06 00 26 0A 01 03 03 03 00 00 00 02 00 00 30 01 00 00 60 00 00 00 00 60 D9 0A 00 00 D9 0A 00 00 Edit: I'm patching on Yosemite indeed, but as stated, the patch works, just want the failsafe mode added Link to comment Share on other sites More sharing options...
Administrators Hervé Posted March 8, 2015 Administrators Share Posted March 8, 2015 So you're not changing references of Desktop 0x80860412 to Mobile 0x80860416 In the Azul FrameBuffer? Link to comment Share on other sites More sharing options...
LexHimself Posted March 8, 2015 Author Share Posted March 8, 2015 No, not in the frame buffer binary, only in the plist. The frame buffer is injected through DSDT: If (LEqual (Arg2, Zero)) { Return (Buffer() { 0x03 } ) }\n Return (Package()\n {\n "device-id", Buffer() { 0x16, 0x04, 0x00, 0x00 },\n "AAPL,ig-platform-id", Buffer() { 0x06, 0x00, 0x26, 0x0a },\n Link to comment Share on other sites More sharing options...
Administrators Hervé Posted March 8, 2015 Administrators Share Posted March 8, 2015 Mmm, I don't believe that's sufficient. I had to binmod the Azul framebuffer to change desktop id 0412 to mobile id 0416. You sure need to inject the layout-id, either through DSDT injection like you posted or through boot loader parameter. The device-id, on the other hand, is not necessary in the DSDT. 1 Link to comment Share on other sites More sharing options...
Administrators Bronxteck Posted March 9, 2015 Administrators Share Posted March 9, 2015 my guess you would have to if with a pearl script that has the original data unmodified before the mod so that it has a compare? Link to comment Share on other sites More sharing options...
LexHimself Posted March 9, 2015 Author Share Posted March 9, 2015 Something in those lines. I tried defaults read 0412 which extracts the IOPCIPrimarymatch line and prints it in terminal, lets say i called it check. That worked, it's the comparison where i get stuck, can't find the right command. Modified the command of example since my kext has been patched: bash-3.2# defaults read /System/Library/Extensions/AppleIntelHD5000Graphics.kext/Contents/Info | grep 0416 IOPCIPrimaryMatch = "0x0d268086 0x0a268086 0x0a2e8086 0x0d228086 0x04168086"; bash-3.2# This output needs to be compared to, how would i go about that? Thanks in advance. Link to comment Share on other sites More sharing options...
Recommended Posts