Skip to content

Commit

Permalink
Merge pull request #310 from AuxXxilium/dev
Browse files Browse the repository at this point in the history
Revert "i915: fix"
  • Loading branch information
AuxXxilium authored Jan 30, 2024
2 parents 787733c + d70382b commit 1c7c4eb
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 34 deletions.
Binary file removed i915/all/usr/bin/lspci
Binary file not shown.
Binary file removed i915/all/usr/bin/sed
Binary file not shown.
Binary file removed i915/all/usr/bin/tr
Binary file not shown.
Binary file removed i915/all/usr/lib/libudev.so.1
Binary file not shown.
72 changes: 38 additions & 34 deletions i915/install.sh
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

0 comments on commit 1c7c4eb

Please sign in to comment.