None 发表于 2023-11-2 13:08:16

UNAS6 n5105升级内核开启硬解

本帖最后由 None 于 2023-11-2 13:41 编辑

1.升级内核
因为N5105的核显驱动,需要在linux内核5.18以上才可以,UNAS使用的内核是5.10,是无法加载核显驱动的,所以第一步需要升级内核。
​最新稳定版内核可在官网查询:https://tracker.debian.org/pkg/linux

Debian 11 升级内核需在 root 权限下执行,首先添加 Backports 源并更新
echo "deb http://deb.debian.org/debian bullseye-backports main" > /etc/apt/sources.list.d/backports.list
接着安装新内核及更新 grub:
​apt -t bullseye-backports install linux-image-amd64
然后重启 ,检查内核版本是否已更新:​
# 重启
确认内核已经升级成功,就可以卸载旧内核节省空间,列出已安装内核:​
dpkg --list | grep linux-image需保留至少一个新内核,然后卸载旧内核,比如列出信息如下:​
iilinux-image-5.10.0-19-amd64         5.10.149-2                     amd64      Linux 5.10 for 64-bit PCs (signed)
iilinux-image-6.1.0-0.deb11.11-amd64    6.1.38-4~bpo11+1               amd64      Linux 6.1 for 64-bit PCs (signed)
iilinux-image-amd64                     6.1.38-4~bpo11+1               amd64      Linux for 64-bit PCs (meta-package)
那么执行命令卸载 linux-image-5.10.0-19-amd64 即可:​
apt purge linux-image-5.10.0-19-amd64列出内核头文件:​
dpkg --list | grep linux-headers需保留至少一个新内核头文件,然后卸载旧内核头,比如列出信息如下:​root@VM-0-8-debian:~# dpkg --list | grep linux-headers
我卸载旧内核后,再查看内核头文件,并没有发现旧的,如果有旧的,把 5.10 两个内核头清理掉即可:​
apt purge linux-headers-5.10.0-19-amd64 linux-headers-5.10.0-19-common
更新 grub,重启:
update-grubreboot至此 Debian 11 升级内核完成。

注:如果以后不打算再继续升级内核,可以将Backports源删除

rm -f /etc/apt/sources.list.d/backports.list
参考连接:https://0xo.net/640


2.安装驱动

UNAS中其实已经有了核显驱动,只不过是内核不支持而已,内核升级以后,其实是不需要在安装驱动的。UNAS用户可以跳过2.1,直接查看2.2

2.1为了做个记录,这里也记录一下安装驱动

使用non-free源安装驱动

wget -qO - https://repositories.intel.com/graphics/intel-graphics.key | apt-key add -

nano /etc/apt/source.list
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free

deb https://repositories.intel.com/graphics/ubuntu bionic main   

存盘退出

apt-get update
安装驱动及工具
apt-get install intel-media-va-driver-non-free
apt-get install intel-gpu-tools
apt-get install vainfo运行 lspci 观察硬件信息00:00.0 Host bridge: Intel Corporation Device 4e2400:02.0 VGA compatible controller: Intel Corporation Device 4e61 (rev 01) 这一行 记录下 4e61 录入到下面文件中 (n6005这个地方值不一样,可能是4e71)

nano /etc/default/grub
GRUB_CMDLINE_LINUX="之前的内容 quiet i915.force_probe=4e71"
#存盘退出

# 更新grub
update-grub

# 启用guc
nano /etc/modprobe.d/i915.conf
# 输入
options i915 force_probe=1 enable_guc=2
# 存盘退出

# 重启
reboot更多信息,可以参考 n6005/n5105在debian11实现jellyfin硬解_debian jellyfin-CSDN博客


2.2 安装/升级guc/huc固件
n5105/n6005 开启jellyfin硬解的话,需要开启低电压模式 Intel GPU | Jellyfin,开启低电压模式需要启用guc和huc,详情可以查看官方文档Intel GPU | Jellyfin ,这里记录一下我的处理过程

首先查看i915内核是否可以使用GUC
​sudo modinfo i915 | egrep -i "guc|huc|dmc"如果命令显示内容包含guc、huc、dmc,说明当前包含了Guc,如下

firmware:       i915/skl_huc_2.0.0.bin
firmware:       i915/bxt_huc_2.0.0.bin
firmware:       i915/kbl_huc_4.0.0.bin
firmware:       i915/glk_huc_4.0.0.bin
firmware:       i915/kbl_huc_4.0.0.bin
firmware:       i915/kbl_huc_4.0.0.bin
firmware:       i915/cml_huc_4.0.0.bin
firmware:       i915/icl_huc_9.0.0.bin
firmware:       i915/ehl_huc_9.0.0.bin
firmware:       i915/ehl_huc_9.0.0.bin
firmware:       i915/tgl_huc_7.9.3.bin
firmware:       i915/tgl_huc_7.9.3.bin
firmware:       i915/dg1_huc.bin
firmware:       i915/tgl_huc_7.9.3.bin
firmware:       i915/tgl_huc.bin
firmware:       i915/tgl_huc_7.9.3.bin
firmware:       i915/tgl_huc.bin
firmware:       i915/skl_guc_70.1.1.bin
firmware:       i915/bxt_guc_70.1.1.bin
firmware:       i915/kbl_guc_70.1.1.bin
firmware:       i915/glk_guc_70.1.1.bin
firmware:       i915/kbl_guc_70.1.1.bin
firmware:       i915/kbl_guc_70.1.1.bin
firmware:       i915/cml_guc_70.1.1.bin
firmware:       i915/icl_guc_70.1.1.bin
firmware:       i915/ehl_guc_70.1.1.bin
firmware:       i915/ehl_guc_70.1.1.bin
firmware:       i915/tgl_guc_70.1.1.bin
firmware:       i915/tgl_guc_70.1.1.bin
firmware:       i915/dg1_guc_70.bin
firmware:       i915/tgl_guc_69.0.3.bin
firmware:       i915/tgl_guc_70.1.1.bin
firmware:       i915/tgl_guc_70.bin
firmware:       i915/adlp_guc_69.0.3.bin
firmware:       i915/adlp_guc_70.1.1.bin
firmware:       i915/adlp_guc_70.bin
firmware:       i915/dg2_guc_70.bin
firmware:       i915/bxt_dmc_ver1_07.bin
firmware:       i915/skl_dmc_ver1_27.bin
firmware:       i915/kbl_dmc_ver1_04.bin
firmware:       i915/glk_dmc_ver1_04.bin
firmware:       i915/icl_dmc_ver1_09.bin
firmware:       i915/tgl_dmc_ver2_12.bin
firmware:       i915/rkl_dmc_ver2_03.bin
firmware:       i915/dg1_dmc_ver2_02.bin
firmware:       i915/adls_dmc_ver2_01.bin
firmware:       i915/adlp_dmc_ver2_16.bin
firmware:       i915/dg2_dmc_ver2_07.bin
parm:         enable_guc:Enable GuC load for GuC submission and/or HuC load. Required functionality can be selected using bitmask values. (-1=auto , 0=disable, 1=GuC submission, 2=HuC load) (int)
parm:         guc_log_level:GuC firmware logging level. Requires GuC to be loaded. (-1=auto , 0=disable, 1..4=enable with verbosity min..max) (int)
parm:         guc_firmware_path:GuC firmware path to use instead of the default one (charp)
parm:         huc_firmware_path:HuC firmware path to use instead of the default one (charp)
parm:         dmc_firmware_path:DMC firmware path to use instead of the default one (charp)UNAS还需要启用一下GUC(如果按照2.1中启用过guc了,此处无需再启用一次)

sudo mkdir -p /etc/modprobe.d
sudo sh -c "echo 'options i915 enable_guc=2' >> /etc/modprobe.d/i915.conf"<span style="font-size: 12px; background-color: rgb(255, 255, 255);">​</span>启用guc后,更新 initramfs 和 grub
sudo update-initramfs -u && sudo update-grub然后重启系统
​reboot
检查i915的状态

sudo dmesg | grep i915<span style="font-size: 12px; background-color: rgb(255, 255, 255);">​</span>
查看GuC状态

sudo cat /sys/kernel/debug/dri/0/gt/uc/guc_info


#如果返回信息中status为RUNNING则正常
GuC firmware: i915/ehl_guc_70.1.1.bin
      status: RUNNING
      version: found 70.1.1
      uCode: 274112 bytes
      RSA: 256 bytes

GuC status 0x8003f0ec:
      Bootrom status = 0x76
      uKernel status = 0xf0
      MIA Core status = 0x3

Scratch registers:
         0:   0x0
         1:   0x1773d7
         2:   0x44000
         3:   0x4000
         4:   0x40
         5:   0x514
         6:   0x4e610001
         7:   0x0
         8:   0x0
         9:   0x0
      10:   0x0
      11:   0x0
      12:   0x0
      13:   0x0
      14:   0x0
      15:   0x0

GuC logging stats:
      Relay full count: 0
      DEBUG:flush count          0, overflow count          0
      CRASH:flush count          0, overflow count          0
      CAPTURE:      flush count          0, overflow count          0

查看HuC状态
​sudo cat /sys/kernel/debug/dri/0/gt/uc/huc_info

#如果返回信息中status为RUNNING则正常
HuC firmware: i915/ehl_huc_9.0.0.bin
      status: RUNNING
      version: found 9.0.0
      uCode: 498496 bytes
      RSA: 256 bytes
HuC status: 0x0007c001<span style="font-size: 12px; background-color: rgb(255, 255, 255);">​</span>
UNAS直接启用Guc和Huc是异常的,如果显示状态时Running,则无需处理,异常的话,则需要升级一下GuC和HuC。在异常信息中,提示了在哪里可以下载Guc,也可以直接访问https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git下载最新的tag,解压后得到其中i915文件夹,或者使用附件提供的i915,然后复制到 /lib/firmware/​
​cp -r ./i915 /lib/firmware/<span style="font-size: 12px; background-color: rgb(255, 255, 255);">​</span>
然后重启电脑,再次执行命令查看GuC和HuC的状态,变成Running则正常

登录jellyfin,在控制台-播放-硬件加速中,选择Intel QuickSync(QSV),启用所有硬件解码
重点:
启用低电压模式的 Intel H.264 硬件编码器
启用低电压模式的 Intel HEVC 硬件编码器
允许以 HEVC 格式编码
启用色调映射

打开一部影片,可以使用​intel_gpu_top​命令查看gpu使用情况


特别说明:个人升级内核有风险,可能会有造成系统不稳定的风险,官方是不会负责的,所以升级的小伙伴三思而后行,我目前升级后使用了几天,倒是没发现什么问题,但是使用ZFS的小伙伴,千万不要升级哦


页: [1]
查看完整版本: UNAS6 n5105升级内核开启硬解