-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #310 from AuxXxilium/dev
Revert "i915: fix"
- Loading branch information
Showing
5 changed files
with
38 additions
and
34 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,43 @@ | ||
#!/usr/bin/env ash | ||
|
||
# PLATFORMS="apollolake geminilake" | ||
# PLATFORM=$(/bin/get_key_value /etc.defaults/synoinfo.conf unique | cut -d"_" -f2) | ||
# if ! echo ${PLATFORM} | grep -q ${PLATFORM}; then | ||
# echo "${PLATFORM} is not supported" | ||
# exit 0 | ||
# fi | ||
|
||
if [ "${1}" = "patches" ]; then | ||
echo "Installing daemon for i915 patches" | ||
if [ -n "${2}" ]; then | ||
GPU="$(echo "${2}" | sed 's/://g' | tr '[:upper:]' '[:lower:]')" | ||
else | ||
GPU="$(lspci -n | grep 0300 | grep 8086 | cut -d " " -f 3 | sed 's/://g')" | ||
fi | ||
[ -z "${GPU}" -o $(echo -n "${GPU}" | wc -c) -ne 8 ] && echo "GPU is not detected" && exit 0 | ||
[ ! -f "/usr/lib/modules/i915.ko" ] && echo "i915.ko does not exist" && exit 0 | ||
|
||
if [ -n "${2}" ] || grep -iq ${GPU} /usr/bin/i915ids 2>/dev/null; then | ||
isLoad=0 | ||
if lsmod | grep -q ^i915; then | ||
isLoad=1 | ||
rmmod i915 | ||
if [ "${1}" = "late" ]; then | ||
echo "Installing daemon for i915" | ||
SED_PATH='/tmpRoot/usr/bin/sed' | ||
XXD_PATH='/tmpRoot/usr/bin/xxd' | ||
LSPCI_PATH='/tmpRoot/usr/bin/lspci' | ||
cp -vf "/usr/bin/sed" "/tmpRoot/usr/bin/sed" | ||
# Intel GPU | ||
if [ -f /tmpRoot/usr/lib/modules-load.d/70-video-kernel.conf ] && [ -f /tmpRoot/usr/lib/modules/i915.ko ]; then | ||
export LD_LIBRARY_PATH=/tmpRoot/usr/bin:/tmpRoot/usr/lib:${LD_LIBRARY_PATH} | ||
GPU="$(${LSPCI_PATH} -n | grep 0300 | grep 8086 | cut -d " " -f 3 | ${SED_PATH} -e 's/://g')" | ||
echo "${GPU}" >/tmpRoot/root/i915.GPU | ||
if [ -n "${GPU}" ] && [ $(echo -n "${GPU}" | wc -c) -eq 8 ]; then | ||
if [ $(grep -i ${GPU} /usr/bin/i915ids | wc -l) -eq 0 ]; then | ||
echo "Intel GPU is not detected (${GPU}), nothing to do" | ||
#${SED_PATH} -i 's/^i915/# i915/g' /tmpRoot/usr/lib/modules-load.d/70-video-kernel.conf | ||
else | ||
GPU_DEF="86800000923e0000" | ||
GPU_BIN="${GPU:2:2}${GPU:0:2}0000${GPU:6:2}${GPU:4:2}0000" | ||
KO_SIZE="$(${XXD_PATH} -p /tmpRoot/usr/lib/modules/i915.ko | wc -c)" | ||
${XXD_PATH} -c ${KO_SIZE} -p /tmpRoot/usr/lib/modules/i915.ko /tmpRoot/root/i915.ko.hex | ||
if [ $(grep -i "${GPU_BIN}" /tmpRoot/root/i915.ko.hex | wc -l) -gt 0 ]; then | ||
echo "Intel GPU is detected (${GPU}), already support" | ||
else | ||
echo "Intel GPU is detected (${GPU}), replace id" | ||
if [ ! -f /tmpRoot/usr/lib/modules/i915.ko.bak ]; then | ||
cp -f /tmpRoot/usr/lib/modules/i915.ko /tmpRoot/usr/lib/modules/i915.ko.bak | ||
fi | ||
${SED_PATH} -i "s/${GPU_DEF}/${GPU_BIN}/; s/308201f706092a86.*70656e6465647e0a//" /tmpRoot/root/i915.ko.hex | ||
if [ -n "$(cat /tmpRoot/root/i915.ko.hex)" ]; then | ||
${XXD_PATH} -r -p /tmpRoot/root/i915.ko.hex >/tmpRoot/usr/lib/modules/i915.ko | ||
rm -f /tmpRoot/root/i915.ko.hex | ||
rmmod i915 | ||
modprobe /tmpRoot/usr/lib/modules/i915.ko | ||
else | ||
echo "Intel GPU is detected (${GPU}), replace i915.ko error" | ||
fi | ||
fi | ||
fi | ||
fi | ||
GPU_DEF="86800000923e0000" | ||
GPU_BIN="${GPU:2:2}${GPU:0:2}0000${GPU:6:2}${GPU:4:2}0000" | ||
echo "GPU:${GPU} GPU_BIN:${GPU_BIN}" | ||
cp -vf "/usr/lib/modules/i915.ko" "/usr/lib/modules/i915.ko.bak" | ||
sed -i "s/${GPU_DEF}/${GPU_BIN}/; s/308201f706092a86.*70656e6465647e0a//" "/usr/lib/modules/i915.ko" | ||
[ "${isLoad}" = "1" ] && /usr/sbin/modprobe "/usr/lib/modules/i915.ko" | ||
fi | ||
elif [ "${1}" = "late" ]; then | ||
echo "Installing daemon for i915 late" | ||
|
||
KO_FILE="/tmpRoot/usr/lib/modules/i915.ko" | ||
[ ! -f "${KO_FILE}.bak" ] && cp -vf "${KO_FILE}" "${KO_FILE}.bak" | ||
cp -vf "/usr/lib/modules/i915.ko" "${KO_FILE}" | ||
fi |