Skip to content

Instantly share code, notes, and snippets.

@tslmy
Created November 30, 2025 10:13
Show Gist options
  • Select an option

  • Save tslmy/984813b7d9ec4a9919928c305aa17583 to your computer and use it in GitHub Desktop.

Select an option

Save tslmy/984813b7d9ec4a9919928c305aa17583 to your computer and use it in GitHub Desktop.
trying to get IOKit work for iOS 6.1

The framework I had to temper with is IOKit, for it didn't include header files by default:

darwin/Platform.c:30:10: fatal error: 'IOKit/IOKitLib.h' file not found
   30 | #include <IOKit/IOKitLib.h>
      |          ^~~~~~~~~~~~~~~~~~
darwin/Platform.c:30:10: note: did not find header 'IOKitLib.h' in framework 'IOKit' (loaded from '/Volumes/Xcode/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/System/Library/Frameworks')
9 errors generated.

The first thing I tried was to dump headers myself:

# Get the class-dump utility. Oddly, Homebrew doesn't have it.
wget -qO- http://stevenygard.com/download/class-dump-3.5.tar.gz  | tar xvz - -C .
set -gx foo "iPhoneOS6.1.sdk/System/Library/Frameworks/IOKit.framework"
class-dump-3.5/class-dump -H $foo/IOKit -o $foo/Headers

I saw:

2025-11-30 00:06:53.605 class-dump[23264:24884301] Warning: This file does not contain any Objective-C runtime information.

Then I realized $foo/IOKit was a C binary whereas class-dump was for Obj-C. I felt stupid.

Another option is to use someone else's dump:

git clone --depth=1 https://github.com/guoxuzan/IOKit.git
cp -r IOKit/IOKit/Headers iPhoneOS6.1.sdk/System/Library/Frameworks/IOKit.framework/

(I have no idea where guoxuzan got those headers.)

This didn't work. I saw:

In file included from darwin/Platform.c:34:
/Users/lmy/Projects/ios6-jailbroken/iPhoneOS6.1.sdk/System/Library/Frameworks/IOKit.framework/Headers/storage/IOBlockStorageDriver.h:34:10: fatal error: 'IOTypes.h' file not found
   34 | #include "IOTypes.h"
      |          ^~~~~~~~~~~

So I added -I$IOS6_SDK_PATH/System/Library/Frameworks/IOKit.framework/Headers to the CFLAGS. Now I saw:

In file included from darwin/Platform.c:32:
/Users/lmy/Projects/ios6-jailbroken/iPhoneOS6.1.sdk/System/Library/Frameworks/IOKit.framework/Headers/ps/IOPowerSources.h:360:106: error: expected function body after function declarator
  360 | CFRunLoopSourceRef IOPSCreateLimitedPowerNotification(IOPowerSourceCallbackType callback, void *context) __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_7_0);
      |                                                                                                          ^
/Users/lmy/Projects/ios6-jailbroken/iPhoneOS6.1.sdk/usr/include/Availability.h:150:50: note: expanded from macro '__OSX_AVAILABLE_STARTING'
  150 |     #define __OSX_AVAILABLE_STARTING(_osx, _ios) __AVAILABILITY_INTERNAL##_ios
      |                                                  ^
<scratch space>:132:1: note: expanded from here
  132 | __AVAILABILITY_INTERNAL__IPHONE_7_0
      | ^

which implies that those headers were extracted from iOS 7.

~~Let me try someone else's dump:

git clone --depth=1 https://github.com/obaby/IOKit.git iPhoneOS6.1.sdk/System/Library/Frameworks/IOKit.framework/Headers

~~This alone raised this problem:

darwin/Platform.c:32:10: fatal error: 'IOKit/ps/IOPowerSources.h' file not found
   32 | #include <IOKit/ps/IOPowerSources.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
darwin/Platform.c:32:10: note: did not find header 'ps/IOPowerSources.h' in framework 'IOKit' (loaded from '/Users/lmy/Projects/ios6-jailbroken/iPhoneOS6.1.sdk/System/Library/Frameworks')

~~So it's a combination of:

cp -r IOKit/IOKit/Headers iPhoneOS6.1.sdk/System/Library/Frameworks/IOKit.framework/
git clone --depth=1 https://github.com/obaby/IOKit.git IOKit-2
cp IOKit-2/*.h iPhoneOS6.1.sdk/System/Library/Frameworks/IOKit.framework/Headers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment