-
Notifications
You must be signed in to change notification settings - Fork 6
/
DELLM3800.sh
executable file
·380 lines (306 loc) · 17.3 KB
/
DELLM3800.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
#!/bin/sh
# Bold / Non-bold
BOLD="\033[1m"
RED="\033[0;31m"
GREEN="\033[0;32m"
BLUE="\033[1;34m"
#echo -e "\033[0;32mCOLOR_GREEN\t\033[1;32mCOLOR_LIGHT_GREEN"
OFF="\033[m"
# Repository location
REPO=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
GIT_DIR="${REPO}"
git_update()
{
cd ${REPO}
echo "${GREEN}[GIT]${OFF}: Updating local data to latest version"
echo "${BLUE}[GIT]${OFF}: Updating to latest PRECISION-M3800-OSX git master"
git pull
echo "${BLUE}[GIT]${OFF}: Initializing Laptop-DSDT-Patch & ssdtPRgen"
git submodule update --init --recursive
echo "${BLUE}[GIT]${OFF}: Updating Laptop-DSDT-Patch & ssdtPRgen"
git submodule foreach git pull origin master
}
decompile_dsdt()
{
echo "${GREEN}[DSDT]${OFF}: Decompiling DSDT / SSDT in ./DSDT/raw"
cd "${REPO}"
./tools/iasl -w1 -da -dl ./DSDT/raw/DSDT.aml ./DSDT/raw/SSDT-*.aml &> ./logs/dsdt_decompile.log
echo "${BLUE}[DSDT]${OFF}: Log created in ./logs/dsdt_decompile.log"
rm ./DSDT/decompiled/* 2&>/dev/null
cp ./DSDT/raw/DSDT.dsl ./DSDT/decompiled/
cp ./DSDT/raw/SSDT-1[0235].dsl ./DSDT/decompiled/
}
patch_dsdt()
{
echo "${GREEN}[DSDT]${OFF}: Patching DSDT / SSDT"
echo "${BLUE}[DSDT]${OFF}: Patching DSDT in ./DSDT/decompiled"
echo "${BOLD}[syn] Fix PARSEOP_ZERO Error${OFF}"
./tools/patchmatic ./DSDT/decompiled/DSDT.dsl ./externals/Laptop-DSDT-Patch/syntax/fix_PARSEOP_ZERO.txt ./DSDT/decompiled/DSDT.dsl
echo "${BOLD}[syn] Fix ADBG Error${OFF}"
./tools/patchmatic ./DSDT/decompiled/DSDT.dsl ./externals/Laptop-DSDT-Patch/syntax/fix_ADBG.txt ./DSDT/decompiled/DSDT.dsl
echo "${BOLD}[gfx] Rename GFX0 to IGPU${OFF}"
./tools/patchmatic ./DSDT/decompiled/DSDT.dsl ./externals/Laptop-DSDT-Patch/graphics/graphics_Rename-GFX0.txt ./DSDT/decompiled/DSDT.dsl
echo "${BOLD}[usb] 7-series/8-series USB${OFF}"
./tools/patchmatic ./DSDT/decompiled/DSDT.dsl ./externals/Laptop-DSDT-Patch/usb/usb_7-series.txt ./DSDT/decompiled/DSDT.dsl
echo "${BOLD}[bat] Acer Aspire E1-571${OFF}"
./tools/patchmatic ./DSDT/decompiled/DSDT.dsl ./externals/Laptop-DSDT-Patch/battery/battery_Acer-Aspire-E1-571.txt ./DSDT/decompiled/DSDT.dsl
echo "${BOLD}[sys] IRQ Fix${OFF}"
./tools/patchmatic ./DSDT/decompiled/DSDT.dsl ./externals/Laptop-DSDT-Patch/system/system_IRQ.txt ./DSDT/decompiled/DSDT.dsl
echo "${BOLD}[sys] SMBus Fix${OFF}"
./tools/patchmatic ./DSDT/decompiled/DSDT.dsl ./externals/Laptop-DSDT-Patch/system/system_SMBUS.txt ./DSDT/decompiled/DSDT.dsl
echo "${BOLD}[sys] HPET Fix${OFF}"
./tools/patchmatic ./DSDT/decompiled/DSDT.dsl ./externals/Laptop-DSDT-Patch/system/system_HPET.txt ./DSDT/decompiled/DSDT.dsl
echo "${BOLD}[sys] OS Check Fix${OFF}"
./tools/patchmatic ./DSDT/decompiled/DSDT.dsl ./DSDT/patches/system_OSYS.txt ./DSDT/decompiled/DSDT.dsl
echo "${BOLD}[sys] AC Adapter Fix${OFF}"
./tools/patchmatic ./DSDT/decompiled/DSDT.dsl ./externals/Laptop-DSDT-Patch/system/system_ADP1.txt ./DSDT/decompiled/DSDT.dsl
echo "${BOLD}[sys] Add MCHC${OFF}"
./tools/patchmatic ./DSDT/decompiled/DSDT.dsl ./externals/Laptop-DSDT-Patch/system/system_MCHC.txt ./DSDT/decompiled/DSDT.dsl
echo "${BOLD}[sys] Fix _WAK Arg0 v2${OFF}"
./tools/patchmatic ./DSDT/decompiled/DSDT.dsl ./externals/Laptop-DSDT-Patch/system/system_WAK2.txt ./DSDT/decompiled/DSDT.dsl
echo "${BOLD}[sys] Add IMEI${OFF}"
./tools/patchmatic ./DSDT/decompiled/DSDT.dsl ./externals/Laptop-DSDT-Patch/system/system_IMEI.txt ./DSDT/decompiled/DSDT.dsl
echo "${BOLD}[sys] Fix PNOT/PPNT${OFF}"
./tools/patchmatic ./DSDT/decompiled/DSDT.dsl ./externals/Laptop-DSDT-Patch/system/system_PNOT.txt ./DSDT/decompiled/DSDT.dsl
echo "${BOLD}[sys] Fix Non-zero Mutex${OFF}"
./tools/patchmatic ./DSDT/decompiled/DSDT.dsl ./externals/Laptop-DSDT-Patch/system/system_Mutex.txt ./DSDT/decompiled/DSDT.dsl
echo "${BOLD}[sys] Add Haswell LPC${OFF}"
./tools/patchmatic ./DSDT/decompiled/DSDT.dsl ./externals/Laptop-DSDT-Patch/misc/misc_Haswell-LPC.txt ./DSDT/decompiled/DSDT.dsl
echo "${BOLD}Audio Layout${OFF}"
./tools/patchmatic ./DSDT/decompiled/DSDT.dsl ./DSDT/patches/audio_HDEF-layout1.txt ./DSDT/decompiled/DSDT.dsl
echo "${BOLD}Rename B0D3 to HDAU${OFF}"
./tools/patchmatic ./DSDT/decompiled/DSDT.dsl ./DSDT/patches/audio_B0D3_HDAU.txt ./DSDT/decompiled/DSDT.dsl
echo "${BOLD}Remove GLAN device${OFF}"
./tools/patchmatic ./DSDT/decompiled/DSDT.dsl ./DSDT/patches/remove_glan.txt ./DSDT/decompiled/DSDT.dsl
echo "${BOLD}Rename EHCX to EH0X${OFF}"
./tools/patchmatic ./DSDT/decompiled/DSDT.dsl ./DSDT/patches/usb_EHC_EHC0.txt ./DSDT/decompiled/DSDT.dsl
########################
# SSDT-10 Patches
########################
echo "${BLUE}[SSDT-10]${OFF}: Patching SSDT-10 in ./DSDT/decompiled"
echo "${BOLD}_BST package size${OFF}"
./tools/patchmatic ./DSDT/decompiled/SSDT-10.dsl ./DSDT/patches/_BST-package-size.txt ./DSDT/decompiled/SSDT-10.dsl
echo "${BOLD}[gfx] Rename GFX0 to IGPU${OFF}"
./tools/patchmatic ./DSDT/decompiled/SSDT-10.dsl ./externals/Laptop-DSDT-Patch/graphics/graphics_Rename-GFX0.txt ./DSDT/decompiled/SSDT-10.dsl
########################
# SSDT-12 Patches
########################
echo "${BLUE}[SSDT-12]${OFF}: Patching SSDT-12 in ./DSDT/decompiled"
echo "${BOLD}[gfx] Rename GFX0 to IGPU${OFF}"
./tools/patchmatic ./DSDT/decompiled/SSDT-12.dsl ./externals/Laptop-DSDT-Patch/graphics/graphics_Rename-GFX0.txt ./DSDT/decompiled/SSDT-12.dsl
echo "${BOLD}Haswell HD4400/HD4600/HD5000 (Yosemite - Modified)${OFF}"
./tools/patchmatic ./DSDT/decompiled/SSDT-12.dsl ./DSDT/patches/graphics_Intel_HD4600.txt ./DSDT/decompiled/SSDT-12.dsl
echo "${BOLD}[gfx] Brightness fix (Haswell)${OFF}"
./tools/patchmatic ./DSDT/decompiled/SSDT-12.dsl ./externals/Laptop-DSDT-Patch/graphics/graphics_PNLF_haswell.txt ./DSDT/decompiled/SSDT-12.dsl
echo "${BOLD}Rename B0D3 to HDAU${OFF}"
./tools/patchmatic ./DSDT/decompiled/SSDT-12.dsl ./DSDT/patches/audio_B0D3_HDAU.txt ./DSDT/decompiled/SSDT-12.dsl
echo "${BOLD}Insert HDAU device${OFF}"
./tools/patchmatic ./DSDT/decompiled/SSDT-12.dsl ./DSDT/patches/audio_Intel_HD4600.txt ./DSDT/decompiled/SSDT-12.dsl
########################
# SSDT-13 Patches
########################
echo "${BLUE}[SSDT-13]${OFF}: Patching SSDT-13 in ./DSDT/decompiled"
echo "${BOLD}[gfx] Rename GFX0 to IGPU${OFF}"
./tools/patchmatic ./DSDT/decompiled/SSDT-13.dsl ./externals/Laptop-DSDT-Patch/graphics/graphics_Rename-GFX0.txt ./DSDT/decompiled/SSDT-13.dsl
echo "${BOLD}Disable Nvidia card (Non-operational in OS X)${OFF}"
./tools/patchmatic ./DSDT/decompiled/SSDT-13.dsl ./DSDT/patches/graphics_Disable_Nvidia.txt ./DSDT/decompiled/SSDT-13.dsl
########################
# SSDT-15 Patches
########################
echo "${BLUE}[SSDT-15]${OFF}: Patching SSDT-15 in ./DSDT/decompiled"
echo "${BOLD}Remove invalid operands${OFF}"
./tools/patchmatic ./DSDT/decompiled/SSDT-15.dsl ./DSDT/patches/WMMX-invalid-operands.txt ./DSDT/decompiled/SSDT-15.dsl
echo "${BOLD}[gfx] Rename GFX0 to IGPU${OFF}"
./tools/patchmatic ./DSDT/decompiled/SSDT-15.dsl ./externals/Laptop-DSDT-Patch/graphics/graphics_Rename-GFX0.txt ./DSDT/decompiled/SSDT-15.dsl
}
compile_dsdt()
{
echo "${GREEN}[DSDT]${OFF}: Compiling DSDT / SSDT in ./DSDT/compiled"
cd "${REPO}"
rm ./DSDT/compiled/*
echo "${BLUE}[SSDT]${OFF}: Copying untouched original SSDTs to ./DSDT/compiled"
cp ./DSDT/raw/SSDT-0.aml ./DSDT/compiled
cp ./DSDT/raw/SSDT-1.aml ./DSDT/compiled
cp ./DSDT/raw/SSDT-2.aml ./DSDT/compiled
cp ./DSDT/raw/SSDT-3.aml ./DSDT/compiled
cp ./DSDT/raw/SSDT-7.aml ./DSDT/compiled
cp ./DSDT/raw/SSDT-8.aml ./DSDT/compiled
cp ./DSDT/raw/SSDT-9.aml ./DSDT/compiled
cp ./DSDT/raw/SSDT-11.aml ./DSDT/compiled
cp ./DSDT/raw/SSDT-14.aml ./DSDT/compiled
echo "${BLUE}[DSDT]${OFF}: Compiling DSDT to ./DSDT/compiled"
./tools/iasl -vr -w1 -ve -p ./DSDT/compiled/DSDT.aml -I ./DSDT/decompiled/ ./DSDT/decompiled/DSDT.dsl
echo "${BLUE}[SSDT-10]${OFF}: Compiling SSDT-10 to ./DSDT/compiled"
./tools/iasl -vr -w1 -ve -p ./DSDT/compiled/SSDT-10.aml -I ./DSDT/decompiled/ ./DSDT/decompiled/SSDT-10.dsl
echo "${BLUE}[SSDT-12]${OFF}: Compiling SSDT-12 to ./DSDT/compiled"
./tools/iasl -vr -w1 -ve -p ./DSDT/compiled/SSDT-12.aml -I ./DSDT/decompiled/ ./DSDT/decompiled/SSDT-12.dsl
echo "${BLUE}[SSDT-13]${OFF}: Compiling SSDT-13 to ./DSDT/compiled"
./tools/iasl -vr -w1 -ve -p ./DSDT/compiled/SSDT-13.aml -I ./DSDT/decompiled/ ./DSDT/decompiled/SSDT-13.dsl
echo "${BLUE}[SSDT-15]${OFF}: Compiling SSDT-15 to ./DSDT/compiled"
./tools/iasl -vr -w1 -ve -p ./DSDT/compiled/SSDT-15.aml -I ./DSDT/decompiled/ ./DSDT/decompiled/SSDT-15.dsl
# Additional custom SSDT
# ssdtPRgen (P-states / C-states)
echo "${BLUE}[PRgen]${OFF}: Compiling ssdtPRgen to ./DSDT/compiled"
if [[ `sysctl machdep.cpu.brand_string` == *"i7-4702HQ"* ]]
then
echo "${BLUE}[PRgen]${OFF}: Intel ${BOLD}i7-4702HQ${OFF} processor found"
./tools/iasl -vr -w1 -ve -p ./DSDT/compiled/SSDT-pr.aml ./DSDT/custom/SSDT-pr-i7-4702HQ.dsl
fi
if [[ `sysctl machdep.cpu.brand_string` == *"i7-4712HQ"* ]]
then
echo "${BLUE}[PRgen]${OFF}: Intel ${BOLD}i7-4712HQ${OFF} processor found"
./tools/iasl -vr -w1 -ve -p ./DSDT/compiled/SSDT-pr.aml ./DSDT/custom/SSDT-pr-i7-4712HQ.dsl
fi
# Rehabman NullEthernet.kext
echo "${BLUE}[RMNE]${OFF}: Compiling SSDT-rmne to ./DSDT/compiled"
./tools/iasl -vr -w1 -ve -p ./DSDT/compiled/SSDT-rmne.aml ./DSDT/custom/SSDT-rmne.dsl
}
patch_iokit()
{
iokit_md5=$(md5 -q "/System/Library/Frameworks/IOKit.framework/Versions/Current/IOKit")
echo "${GREEN}[IOKit]${OFF}: Patching IOKit for maximum pixel clock"
echo "${BLUE}[IOKit]${OFF}: Current IOKit md5 is ${BOLD}${iokit_md5}${OFF}"
case $iokit_md5 in
"2a8cbc2f6616d3f7a5e499bd2d5593ab")
echo " --> Yosemite 10.10.1 IOKit (${GREEN}unpatched${OFF})"
sudo perl -i.bak -pe 's|\xB8\x01\x00\x00\x00\xF6\xC1\x01\x0F\x85|\x33\xC0\x90\x90\x90\x90\x90\x90\x90\xE9|sg' /System/Library/Frameworks/IOKit.framework/Versions/Current/IOKit
sudo codesign -f -s - /System/Library/Frameworks/IOKit.framework/Versions/Current/IOKit
echo " Patched"
;;
"a94dc8e1b6bb6491e5f610f0a3caf960")
echo " --> Yosemite 10.10.2 IOKit (${GREEN}unpatched${OFF})"
sudo perl -i.bak -pe 's|\xB8\x01\x00\x00\x00\xF6\xC1\x01\x0F\x85|\x33\xC0\x90\x90\x90\x90\x90\x90\x90\xE9|sg' /System/Library/Frameworks/IOKit.framework/Versions/Current/IOKit
sudo codesign -f -s - /System/Library/Frameworks/IOKit.framework/Versions/Current/IOKit
echo " Patched"
;;
"29d7632362b2fa4993156717671a5642")
echo " --> Yosemite 10.10.3 / 10.10.4 / 10.10.5 IOKit (${GREEN}unpatched${OFF})"
sudo perl -i.bak -pe 's|\xB8\x01\x00\x00\x00\xF6\xC1\x01\x0F\x85|\x33\xC0\x90\x90\x90\x90\x90\x90\x90\xE9|sg' /System/Library/Frameworks/IOKit.framework/Versions/Current/IOKit
sudo codesign -f -s - /System/Library/Frameworks/IOKit.framework/Versions/Current/IOKit
echo " Patched"
;;
"cd40217cd8d2ed8f16fa4ca513253109")
echo " --> El Capitan 10.11 GM IOKit (${GREEN}unpatched${OFF})"
sudo perl -i.bak -pe 's|\xB8\x01\x00\x00\x00\xF6\xC1\x01\x0F\x85|\x33\xC0\x90\x90\x90\x90\x90\x90\x90\xE9|sg' /System/Library/Frameworks/IOKit.framework/Versions/Current/IOKit
sudo codesign -f -s - /System/Library/Frameworks/IOKit.framework/Versions/Current/IOKit
echo " Patched"
;;
"8756e20f979c9e74c80f07b452ebfadd")
echo " --> Yosemite 10.10.1 IOKit (${RED}patched, not signed${OFF})"
;;
"20849598dcfa1e8c59038d28e0ab5fd5")
echo " --> Yosemite 10.10.2 IOKit (${RED}patched, not signed${OFF})"
;;
"4bd81492fd13e905ef10719ef391e8a0")
echo " --> Yosemite 10.10.3 / 10.10.4 / 10.10.5 IOKit (${RED}patched, not signed${OFF})"
;;
"7eb8d7c5b98706c5e27bf294f929abf0")
echo " --> El Capitan 10.11 GM IOKit (${RED}patched, not signed${OFF})"
;;
"f834136d72126cc9479604879270d24f")
echo " --> Yosemite 10.10.1 IOKit (${RED}patched${OFF})"
echo " IOKit is already patched, no action taken."
;;
"9f99c861294afc3d643987782ce45e4f")
echo " --> Yosemite 10.10.2 IOKit (${RED}patched${OFF})"
echo " IOKit is already patched, no action taken."
;;
"a045c1ac523fece1f1b083b2c5ee842c"|"4c99100b36f37df4bdcc5dc4cd2b8237")
echo " --> Yosemite 10.10.3 / 10.10.4 / 10.10.5 IOKit (${RED}patched${OFF})"
echo " IOKit is already patched, no action taken."
;;
"bf69b91f7d76b4097426ad4c2f003af3")
echo " --> El Capitan 10.11 GM IOKit (${RED}patched${OFF})"
echo " IOKit is already patched, no action taken."
;;
*)
echo " --> Unknown IOKit version (${RED}no action taken${OFF})"
;;
esac
}
patch_hda()
{
echo "${GREEN}[HDA]${OFF}: Creating AppleHDA injection kernel extension for ${BOLD}ALC668${OFF}"
cd "${REPO}"
plist=./audio/AppleHDA_ALC668.kext/Contents/Info.plist
echo " --> ${BOLD}Creating AppleHDA_ALC668 file layout${OFF}"
rm -R ./audio/AppleHDA_ALC668.kext 2&>/dev/null
cp -R /System/Library/Extensions/AppleHDA.kext ./audio/AppleHDA_ALC668.kext
rm -R ./audio/AppleHDA_ALC668.kext/Contents/Resources/*
rm -R ./audio/AppleHDA_ALC668.kext/Contents/PlugIns
rm -R ./audio/AppleHDA_ALC668.kext/Contents/_CodeSignature
rm -R ./audio/AppleHDA_ALC668.kext/Contents/MacOS/AppleHDA
rm ./audio/AppleHDA_ALC668.kext/Contents/version.plist
ln -s /System/Library/Extensions/AppleHDA.kext/Contents/MacOS/AppleHDA ./audio/AppleHDA_ALC668.kext/Contents/MacOS/AppleHDA
echo " --> ${BOLD}Copying AppleHDA_ALC668 audio platform & layouts${OFF}"
cp ./audio/*.zlib ./audio/AppleHDA_ALC668.kext/Contents/Resources/
echo " --> ${BOLD}Configuring AppleHDA_ALC668 Info.plist${OFF}"
replace=`/usr/libexec/plistbuddy -c "Print :NSHumanReadableCopyright" $plist | perl -Xpi -e 's/(\d*\.\d*)/9\1/'`
/usr/libexec/plistbuddy -c "Set :NSHumanReadableCopyright '$replace'" $plist
replace=`/usr/libexec/plistbuddy -c "Print :CFBundleGetInfoString" $plist | perl -Xpi -e 's/(\d*\.\d*)/9\1/'`
/usr/libexec/plistbuddy -c "Set :CFBundleGetInfoString '$replace'" $plist
replace=`/usr/libexec/plistbuddy -c "Print :CFBundleVersion" $plist | perl -Xpi -e 's/(\d*\.\d*)/9\1/'`
/usr/libexec/plistbuddy -c "Set :CFBundleVersion '$replace'" $plist
replace=`/usr/libexec/plistbuddy -c "Print :CFBundleShortVersionString" $plist | perl -Xpi -e 's/(\d*\.\d*)/9\1/'`
/usr/libexec/plistbuddy -c "Set :CFBundleShortVersionString '$replace'" $plist
/usr/libexec/plistbuddy -c "Add ':HardwareConfigDriver_Temp' dict" $plist
/usr/libexec/plistbuddy -c "Merge /System/Library/Extensions/AppleHDA.kext/Contents/PlugIns/AppleHDAHardwareConfigDriver.kext/Contents/Info.plist ':HardwareConfigDriver_Temp'" $plist
/usr/libexec/plistbuddy -c "Copy ':HardwareConfigDriver_Temp:IOKitPersonalities:HDA Hardware Config Resource' ':IOKitPersonalities:HDA Hardware Config Resource'" $plist
/usr/libexec/plistbuddy -c "Delete ':HardwareConfigDriver_Temp'" $plist
/usr/libexec/plistbuddy -c "Delete ':IOKitPersonalities:HDA Hardware Config Resource:HDAConfigDefault'" $plist
/usr/libexec/plistbuddy -c "Delete ':IOKitPersonalities:HDA Hardware Config Resource:PostConstructionInitialization'" $plist
/usr/libexec/plistbuddy -c "Add ':IOKitPersonalities:HDA Hardware Config Resource:IOProbeScore' integer" $plist
/usr/libexec/plistbuddy -c "Set ':IOKitPersonalities:HDA Hardware Config Resource:IOProbeScore' 2000" $plist
/usr/libexec/plistbuddy -c "Merge ./audio/ahhcd.plist ':IOKitPersonalities:HDA Hardware Config Resource'" $plist
echo " --> ${BOLD}Created AppleHDA_ALC668.kext${OFF}"
sudo cp -r ./audio/AppleHDA_ALC668.kext /Library/Extensions
echo " --> ${BOLD}Installed AppleHDA_ALC668.kext to /Library/Extensions${OFF}"
sudo cp -r ./audio/CodecCommander.kext /Library/Extensions
echo " --> ${BOLD}Installed CodecCommander.kext to /Library/Extensions${OFF}"
}
RETVAL=0
case "$1" in
--update)
git_update
RETVAL=1
;;
--decompile-dsdt)
decompile_dsdt
RETVAL=1
;;
--compile-dsdt)
compile_dsdt
RETVAL=1
;;
--patch-dsdt)
patch_dsdt
RETVAL=1
;;
--patch-iokit)
patch_iokit
RETVAL=1
;;
--patch-hda)
patch_hda
RETVAL=1
;;
*)
echo "${BOLD}Dell Precision M3800${OFF} - Yosemite 10.10.2 (14C109)"
echo "https://github.com/AustinSMU/PRECISION-M3800-OSX"
echo
echo "\t${BOLD}--update${OFF}: Update to latest git version (including externals)"
echo "\t${BOLD}--decompile-dsdt${OFF}: Decompile DSDT files in ./DSDT/raw"
echo "\t${BOLD}--patch-dsdt${OFF}: Patch DSDT files in ./DSDT/decompiled"
echo "\t${BOLD}--compile-dsdt${OFF}: Compile DSDT files to ./DSDT/compiled"
echo "\t${BOLD}--patch-iokit${OFF}: Patch maximum pixel clock in IOKit"
echo "\t${BOLD}--patch-hda${OFF}: Create AppleHDA injector kernel extension"
echo
echo "Credits:"
echo "${BLUE}Laptop-DSDT${OFF}: https://github.com/RehabMan/Laptop-DSDT-Patch"
echo "${BLUE}ssdtPRgen${OFF}: https://github.com/Piker-Alpha/ssdtPRGen.sh"
echo "${BLUE}AppleHDA ALC668${OFF}: https://github.com/vbourachot/Dell-XPS13-9333-DSDT-Patch/"
echo
RETVAL=1
;;
esac
exit $RETVAL