Add kext injection support during ISO creation (unsupported)

mine
Dhiru Kholia 7 years ago
parent 2920b46bfa
commit a12802ca88

@ -197,7 +197,7 @@ Valid options are:
Method 3 can produce bootable images without super
user rights.
-n, --nosudo
Do not use sudo command
Do not use sudo command (untested, unsupported)
-v, --verify
Do not skip verifications (slow down image creation)
-h, --help Print this message and exit
@ -218,6 +218,7 @@ exit_with_cmd_err() {
unset cmd_par_app cmd_par_iso test_name ver_opt cr_method || exit_with_error "Can't unset variable"
ver_opt='--noverify'
inject_kexts='no'
while [[ -n "$1" ]]; do
case "$1" in
-a | --app | --application ) cmd_par_app="$2"
@ -233,6 +234,7 @@ while [[ -n "$1" ]]; do
--method* ) cr_method="method${1#--method}"; shift ;;
-n | --nosudo ) allow_sudo='no'; shift ;;
-v | --verify ) unset ver_opt; shift ;;
-k ) inject_kexts='yes'; shift ;;
-h | --h | --help ) print_help; exit 0 ;;
-V | --version ) print_version; exit 0 ;;
*) exit_with_cmd_err "Unknown option \"$1\""
@ -433,7 +435,7 @@ if [[ "$cr_method" == "method1" ]] || [[ "$cr_method" == "method2" ]]; then
stage_start_nl "Mounting writable image"
OSX_inst_img_rw_mnt="$tmp_dir/OS_X_Install_img_rw_mnt"
hdiutil attach "$OSX_inst_img_rw" -readwrite -nobrowse -mountpoint "$OSX_inst_img_rw_mnt" ${ver_opt+-noverify} || exit_with_error "Can't mount writable image"
hdiutil attach "$OSX_inst_img_rw" -readwrite -nobrowse -mountpoint "$OSX_inst_img_rw_mnt" ${ver_opt+-noverify} -owners on || exit_with_error "Can't mount writable image"
stage_end_ok "Mounting succeed"
elif [[ "$cr_method" == "method3" ]]; then
stage_start_nl "Creating blank writable image"
@ -529,6 +531,26 @@ cd "$OSX_inst_img_rw_mnt"
cd "$work_dir"
stage_end_ok
# Inject kext(s) into ISO image
if [[ "$inject_kexts" == "yes" ]]; then
stage_start "Injecting kext(s) into ISO image (unsupported)"
cd "$OSX_inst_img_rw_mnt"
kext_name="QemuUSBTablet1011.kext"
cp -a "$script_dir/kexts/$kext_name" ./System/Library/Extensions/
chmod -R 755 ./System/Library/Extensions/$kext_name
chown -R root:wheel ./System/Library/Extensions/$kext_name
kext_name="FakeSMC.kext"
cp -a "$script_dir/kexts/$kext_name" ./System/Library/Extensions/
chmod -R 755 ./System/Library/Extensions/$kext_name
chown -R root:wheel ./System/Library/Extensions/$kext_name
touch ./System/Library/Extensions
cd "$work_dir"
stage_end_ok
fi
stage_start "Replacing Packages symlink with real files"
rm -f "$OSX_inst_img_rw_mnt/System/Installation/Packages" || exit_with_error "Deleting Packages symlink failed"
cp -pPR "$OSX_inst_inst_dmg_mnt/Packages" "$OSX_inst_img_rw_mnt/System/Installation/" || exit_with_error "Copying Packages failed"

@ -0,0 +1,83 @@
<?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>BuildMachineOSBuild</key>
<string>15G31</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>QemuUSBTablet1011</string>
<key>CFBundleIdentifier</key>
<string>eu.dennis-jordan.driver.QemuUSBTablet</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>QemuUSBTablet1011</string>
<key>CFBundlePackageType</key>
<string>KEXT</string>
<key>CFBundleShortVersionString</key>
<string>1.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>1.2</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>7D1014</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>15E60</string>
<key>DTSDKName</key>
<string>macosx10.11</string>
<key>DTXcode</key>
<string>0731</string>
<key>DTXcodeBuild</key>
<string>7D1014</string>
<key>IOKitPersonalities</key>
<dict>
<key>QemuUSBTabletHIDDevice</key>
<dict>
<key>AbsoluteAxisBoundsRemovalPercentage</key>
<integer>0</integer>
<key>CFBundleIdentifier</key>
<string>eu.dennis-jordan.driver.QemuUSBTablet</string>
<key>HIDDefaultBehavior</key>
<string></string>
<key>IOClass</key>
<string>eu_dennis_jordan_driver_QemuUSBTablet1011</string>
<key>IOProviderClass</key>
<string>IOUSBHostInterface</string>
<key>bConfigurationValue</key>
<integer>1</integer>
<key>bInterfaceNumber</key>
<integer>0</integer>
<key>idProduct</key>
<integer>1</integer>
<key>idVendor</key>
<integer>1575</integer>
</dict>
</dict>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2016 Phil &amp; Laura Dennis-Jordan. Provided under the GNU Lesser General Public License Version 3</string>
<key>OSBundleLibraries</key>
<dict>
<key>com.apple.driver.usb.IOUSBHostHIDDevice</key>
<string>1.0</string>
<key>com.apple.iokit.IOHIDFamily</key>
<string>1.0</string>
<key>com.apple.kpi.iokit</key>
<string>15.0</string>
<key>com.apple.kpi.libkern</key>
<string>15.0</string>
<key>com.apple.kpi.mach</key>
<string>15.0</string>
</dict>
</dict>
</plist>

@ -0,0 +1,105 @@
<?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>files</key>
<dict/>
<key>files2</key>
<dict/>
<key>rules</key>
<dict>
<key>^Resources/</key>
<true/>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^version.plist$</key>
<true/>
</dict>
<key>rules2</key>
<dict>
<key>.*\.dSYM($|/)</key>
<dict>
<key>weight</key>
<real>11</real>
</dict>
<key>^(.*/)?\.DS_Store$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>2000</real>
</dict>
<key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^.*</key>
<true/>
<key>^Info\.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^PkgInfo$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^[^/]+$</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^embedded\.provisionprofile$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^version\.plist$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
</dict>
</dict>
</plist>
Loading…
Cancel
Save