How to make the MacBook Air SuperDrive work with any Mac

ETC 2012. 2. 24. 14:30
반응형

How to make the MacBook Air SuperDrive work with any Mac

Update: I found a much simpler and safer method, which should work all Mac OS versions that support the MacBook Air with no scary driver patching required (original post see below).

Upon closer inspection of what goes on in the driver, I found that apparently Apple engineers had the need to test the superdrive with non-MacBookAir computers. The driver recognizes a boot parameter named “mbasd” (Mac Book Air Super Drive), which sets a debug flag in the driver which both overrides the check for the MBA and also tweaks something related to USB power management (the superdrive probably needs more power than regular USB allows). So just editing /Library/Preferences/SystemConfiguration/com.apple.Boot.plist and inserting the “mbasd=1″ into the “Kernel Flags” does the trick:

  1. open a terminal
  2. type (on a single line)

    sudo pico /Library/Preferences/SystemConfiguration/com.apple.Boot.plist

  3. Insert “mbasd=1″ in the <string></string> value below the <key>Kernel Flags</key> (If the string is not empty to begin with (it normally is), then use a space to separate the mbasd=1 from what’s already there). The file will then look like:

    <?xml version=”1.0″ encoding=”UTF-8″?>
    <!DOCTYPE plist PUBLIC “-//Apple//DTD PLIST 1.0//EN” “http://www.apple.com/DTDs/PropertyList-1.0.dtd”>
    <plist version=”1.0″>
    <dict>
    <key>Kernel Flags</key>
    <string>mbasd=1</string>
    </dict>
    </plist>

    [Update: As CyborgSam pointed out in the comments, the file might not yet exist at all on some Macs. In that case, the pico editor window will initially be empty - if so, just copy and paste the entire XML block from above].

  4. Save (press Ctrl-X, answer yes to save by pressing Y, press enter to confirm the file name).
  5. Restart your machine. That’s it!

I tested this on Lion 10.7.2 only, but I expect it to work for all Mac OS versions that came after the initial release of the Macbook Air Superdrive, which is probably 10.5.3, and is likely to work with future versions of OS X. Just let me know your experience in the comments!

BTW: the boot options plist and how it works is described in the Darwin man pages

[Update: seems this trick has found it's way into a Mac OS X Hints commentunfortunately lacking credit... [Update: was just accidental omission by the comment's author]]

[Original post, left here for the technically curious to read]

Warning: this is a hack, and it’s not for the faint at heart. If you do anything of what I’ll describe below, you are doing it entirely on your own risk. If the description below does not make at least a bit of sense to you, I would not recommend to try the recipe in the end.

The story is this – a while ago I replaced the built-in optical disk drive in my MacBook Pro 17″ by an OptiBay (in the meantime, there are alsoalternatives)  which allows to connect a second harddrive, or in my case, a SSD.

To be able to continue using the SuperDrive (Apple’s name for the CD/DVD read/write drive),  the Optibay came with an external USB case which worked fine, but was ugly. And I didn’t want to carry that around, so I left it at home and bought a shiny new MacBook Air SuperDrive for the office.

It just didn’t occur to me that this thing could possibly not just workwith any Mac, so I didn’t even ask before buying. I knew that many third-party USB optical drives work fine, so I just assumed that would be the same for the Apple drive. But I had to learn otherwise. This drive only works for Macs which, in their original form, do not have an optical drive. Which are the MacBook Airs and the new Minis.

But why doesn’t it work? Seaching the net, among a lot of inaccurate speculations, I found a very informative blog post from 2008 which pretty much explains everything and even provides a hardware solution – replacing the Apple specific USB-to-IDE bridge within the drive with a standard part.

However, I was challenged to find a software solution. I could not believe that there’s a technical reason for not using that drive as-is in any Mac.

There are a lot of good reasons for Apple not to allow it  - first and foremost avoiding complexity of possibly multiple CD/DVD drives, confusing users and creating support cases.

So I though it must be the driver intentionally blocking it, and a quick look into the console revealed that in fact it is, undisguised:

2011/10/27 5:32:37.000 PM kernel: The MacBook Air SuperDrive is not supported on this Mac.

Apparently the driver knows that drive, and refuses to handle it if it runs on the “wrong” Mac. From there, it was not too much work. The actual driver for Optical Disk Drives (ODD) is /System/Library/Extensions/ AppleStorageDrivers.kext/Contents/PlugIns/AppleUSBODD.kext

I fed it to the IDA evaluation version, searched in the strings for the message from the console, found where that text is used and once I saw the code nearby it was very clear how it works – the driver detects the MBA Superdrive, and then checks if it is running on a MBA or a Mini. If not, it prints that message and exits. It’s one conditional jump that must be made unconditional (to tell the driver: no matter what Mac, just use the drive!). In i386 opcode this means replacing a single 0×75 byte with 0xEB. IDA could tell me which one this was in the 32-bit version of the binary, and the nice 0xED hex editor allowed me to patch it. Only, most modern Macs run in 64-bit mode, and the evaluation version of IDA cannot disassemble these. So I had to search the hexdump of the driver for the same code sequence (similar, but not identical hex codes) in the 64-bit part of the driver. Luckily, that driver is not huge, and there was a pretty unique byte sequence that identified the location in both 32 and 64 bit. So the other byte location to patch was found. I patched both with 0xED – and the MacBook Air SuperDrive was working instantly with my MBP!

Now for the recipe (again – be warned, following it is entirely your own risk, and remember sudo is the tool which lifts all restrictions, you can easily and completely destroy your OS installation and data with it):

  1. Make sure you have Mac OS X 10.7.2 (Lion), Build 11C74. The patch locations are highly specific for a build of the driver, it is very unlikely it will work without modification in any other version of Mac OS X.
  2. get 0xED or any other hex editor of your choice
  3. Open a terminal
  4. Go to the location where all the storage kexts are (which is within an umbrella kext called AppleStorageDrivers.kext)
    cd  /System/Library/Extensions/AppleStorageDrivers.kext/Contents/PlugIns
  5. Make a copy of your original AppleUSBODD.kext (to the desktop for now, store in a safe place later – in case something goes wrong you can copy it back!)
    sudo cp  -R AppleUSBODD.kext ~/Desktop
  6. Make the binary file writable so you can patch it:
    sudo chmod 666  AppleUSBODD.kext/Contents/MacOS/AppleUSBODD
  7. Use the hex editor to open the file AppleUSBODD.kext/Contents/MacOS/AppleUSBODD
  8. Patch:
    at file offset 0x1CF8, convert 0×75 into 0xEB
    at file offset 0xBB25, convert 0×75 into 0xEB
    (if you find something else than 0×75 at these locations, you probably have another version of Mac OS X or the driver. If so, don’t patch, or it means asking for serious trouble)
  9. Save the patched file
  10. Remove the signature. I was very surprised that there’s nothing more to it, to make the patched kext load:
    sudo rm -R  AppleUSBODD.kext/Contents/_CodeSignature
  11. Restore the permissions, and make sure the owner is root:wheel, in case your hex editor has modified it.
    sudo chmod 644  AppleUSBODD.kext/Contents/MacOS/AppleUSBODD
    sudo chown root:wheel  AppleUSBODD.kext/Contents/MacOS/AppleUSBODD
  12. Make a copy of that patched driver to a safe place. In case a system update overwites the driver with a new unpatched build, chances are high you can just copy this patched version back to make the external SuperDrive work again.
  13. Plug in the drive and enjoy! (If it does not work right away, restart the machine once).

PS: Don’t ask me for a download the patched version – That’s Apple’s code, the only way is DIY!

http://www.hardturm.ch/luz/2011/10/how-to-make-the-macbook-air-superdrive-work-with-any-mac/ 

반응형

'ETC' 카테고리의 다른 글

http://old.casualcollective.com/#  (0) 2012.03.15
http://old.casualcollective.com/  (0) 2012.03.14
OSX 부팅시 옵션 키  (0) 2012.02.22
ProudNet .PIDL to .as  (0) 2012.02.22
SSD Trim patch  (0) 2012.02.22
: