赞
踩
之前的现象描述
办公电脑的显卡是Intel HD Graphics 630,系统是 Ubuntu 16.04 x64 版本,之前外接一个 VGA 显示器时使用正常。最近又外接了一个 HDMI 显示器做扩展屏幕,发现系统经常死机,只能强制重启,升级了 kernel 之后也没有解决。找到了这篇教程,自己也整理一下。
升级4.7的内核,步骤如下:
下载脚本:
https://software.intel.com/en-us/forums/opencl/topic/738108
使用:
mv install_OCL_driver.txt install_OCL_driver.sh
chmod 755 install_OCL_driver.sh
sudo su
./install_OCL_driver.sh install
完成后的提示信息:
...
Installation completed successfully.
Next steps:
Add OpenCL users to the video group: 'sudo usermod -a -G video USERNAME'
e.g. if the user running OpenCL host applications is foo, run: sudo usermod -a -G video foo
If you have Intel Pentium J4000 or Intel Celeron J3000, you will need to add:
i915.preliminary_hw_support=1
to the 4.7 kernel command line, in order to enable OpenCL functionality for these platforms.
Reboot into the patched 4.7 kernel
HINT: to boot into the 4.7 kernel do the following:
1) Hold the "shift" button during boot
2) When the GRUB menu appears, select "Advanced options for Ubuntu"
3) Select the Linux 4.7.0.intel.r5.0 kernel from the list
重启后即可。
如果中途出现APT的错误,参考:http://www.cnblogs.com/EasonJim/p/7343892.html
install_OCL_driver.sh
#!/bin/bash
#
# Installs the Graphics Driver for OpenCL (SRB5.0) on Linux.
#
# Usage: sudo -E ./install_OCL_driver.sh [OPTION]...
#
# Supported platforms:
# 5th, 6th or 7th generation Intel® processor with Intel(R)
# Processor Graphics Technology not previously disabled by the BIOS
# or motherboard settings or Intel Pentium J4000 and Intel Celeron
# J3000 processors.
#
# Official document:
# http://registrationcenter-download.intel.com/akdlm/irc_nas/11396/SRB5.0_linux64.zip
# replace this with link to download
#
# Optimization note: at the end of installation you will have on:
#
# 1) CentOS
# /rpmbuild/RPMS/x86_64/kernel-4.7.0.intel.r*-1.x86_64.rpm
# /rpmbuild/RPMS/x86_64/kernel-devel-4.7.0.intel.r*-1.x86_64.rpm
#
# 2) Ubuntu
# /linux-image-4.7.0.intel.r*-*.deb
# /linux-headers-4.7.0.intel.r*-*.deb
#
# You may deploy these packages on other systems you have, and
# then launch this script on these systems. This will result in a
# *significantly faster* installation time.
#
#
RELEASE_NUM="5.0"
BUILD_ID="r5.0-63503"
EXIT_FAILURE=1
SRB_5_0=http://registrationcenter-download.intel.com/akdlm/irc_nas/11396/SRB5.0_linux64.zip
KERNEL_4_7=https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.7.tar.xz
SRB_5_0_SHA="a3989a7a00f216b1a50bad37dc49629c3f7ce65104a2ca665e59d8c699bf7443"
KERNEL_4_7_SHA="5190c3d1209aeda04168145bf50569dc0984f80467159b1dc50ad731e3285f10"
KERNEL_BUILD_MARKER=".intel_kernel_built"
LINUX_KERNEL_UNAME="4.7.0.intel.r*"
# The devel/headers package is required for the OpenCL GPU kernel debugger,
# as the kernel module (igfxdcd) needs kernel sources in order to build.
#
CENTOS_RPMS=("kernel-4.7.0.intel.r*"
"kernel-devel-4.7.0.intel.r*")
DEBIAN_DEBS=("linux-image-4.7.0.intel.r*"
"linux-headers-4.7.0.intel.r*")
PKGS=
SKIP_DOWNLOADS=0
INTERACTIVE=1 # 0/1 prompt/don't prompt for yum installations, set by parse_args
FAIL_ON_SHA_MISMATCH=1
TIMEOUT=5 # curl connect timeout
WORKSPACE=~/intel-opencl
CENTOS_UPGRADE_TO_72=1
BUILD_KERNEL=1
CHECK_DISTRO_VER=1
INSTALL_MODE= # 0/1 means uninstall/install, set by parse_args
CENTOS_MINOR=
UBUNTU_VERSION=
RPMBUILD_DIR=
DISTRO=
_install_prerequisites_centos()
{
# yum doesn't accept timeout in seconds as parameter
echo
echo "Note: if yum becomes non-responsive, try aborting the script and run:"
echo " sudo -E $0"
echo
local coreutils=""
$(sha256sum --version >& /dev/null) || coreutils="coreutils"
local minus_y=""
[[ $INTERACTIVE -eq 0 ]] && minus_y="-y"
CMDS=("yum $minus_y install tar libpciaccess numactl-libs $coreutils"
"yum $minus_y groupinstall 'Development Tools'"
"yum $minus_y install rpmdevtools openssl openssl-devel bc")
for cmd in "${CMDS[@]}"; do
echo $cmd
eval $cmd
if [[ $? -ne 0 ]]; then
echo ERROR: failed to run $cmd >&2
echo Problem
echo . Verify that you have enough disk space, and run the script again. >&2
exit $EXIT_FAIULRE
fi
done
if [[ $CENTOS_UPGRADE_TO_72 -eq 1 && -n $CENTOS_MINOR && $CENTOS_MINOR -lt 2 ]]; then
echo Upgrading from CentOS 7.$CENTOS_MINOR to CentOS 7.2...
cmd="yum $minus_y update"
echo $cmd
eval $cmd
if [[ $? -ne 0 ]]; then
echo ERROR: failed to run $cmd >&2
echo problem
echo 2. Verify that you have enough disk space, and run the script again. >&2
exit $EXIT_FAIULRE
fi
fi
}
_install_prerequisites_ubuntu()
{
# apt-get doesn't accept timeout in seconds as parameter
echo
echo "Note: if apt-get becomes non-responsive, try aborting the script and run:"
echo " sudo -E $0"
echo
local minus_y=""
[[ $INTERACTIVE -eq 0 ]] && minus_y="-y"
local xz="xz-utils"
CMDS=("apt-get $minus_y update"
"apt-get $minus_y install openssl libnuma1 libpciaccess0"
"apt-get $minus_y install $xz"
"apt-get $minus_y install build-essential openssl bc curl libssl-dev")
for cmd in "${CMDS[@]}"; do
echo $cmd
eval $cmd
if [[ $? -ne 0 ]]; then
echo ERROR: failed to run $cmd >&2
echo Problem
echo " sudo -E $0" >&2
echo 2. Verify that you have enough disk space, and run the script again. >&2
exit $EXIT_FAIULRE
fi
done
}
install_prerequisites()
{
if [[ $DISTRO == "centos" ]]; then
echo Installing prerequisites...
_install_prerequisites_centos
elif [[ $DISTRO == "ubuntu" ]]; then
echo Installing prerequisites...
_install_prerequisites_ubuntu
fi
}
# Download the url (if needed) and compares its sha256sum against source sha.
#
# Arguments:
# $1 - source sha256sum
# $2 - url
#
_fetch_and_compare_sha()
{
local src_sha=$1
local url=$2
local fname=$(basename $url)
local dst_sha=""
local should_download=0
local cmd="curl --connect-timeout $TIMEOUT -O $url"
if [[ -f $fname ]]; then
dst_sha=
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。