AMD 开源了专门的 ROCm 的kmd Linux Kernel,
1,下载源代码
git clone --recursive https://github.com/ROCm/ROCK-Kernel-Driver.git
cd ROCK-Kernel-Driver/
git checkout rocm-6.0.2
2,配置kernel
cp -v /boot/config-$(uname -r) .config
make menuconfig
Graphic Support -->
跟AMD gpu 相关的 kernel 配置项:
CONFIG_DRM_RADEON=m
# CONFIG_DRM_RADEON_USERPTR is not set
CONFIG_DRM_AMDGPU=m
CONFIG_DRM_AMDGPU_SI=y
CONFIG_DRM_AMDGPU_CIK=y
CONFIG_DRM_AMDGPU_USERPTR=y
# CONFIG_DRM_AMDGPU_WERROR is not set
#
# ACP (Audio CoProcessor) Configuration
#
CONFIG_DRM_AMD_ACP=y
# end of ACP (Audio CoProcessor) Configuration
#
# Display Engine Configuration
#
CONFIG_DRM_AMD_DC=y
CONFIG_DRM_AMD_DC_FP=y
CONFIG_DRM_AMD_DC_SI=y
# CONFIG_DEBUG_KERNEL_DC is not set
CONFIG_DRM_AMD_SECURE_DISPLAY=y
# end of Display Engine Configuration
CONFIG_HSA_AMD=y
CONFIG_HSA_AMD_SVM=y
CONFIG_HSA_AMD_P2P=y
将 .config 中的如下选项设置为空:
CONFIG_SYSTEM_TRUSTED_KEYS=“”
#LL:: CONFIG_SYSTEM_REVOCATION_KEYS="debian/canonical-revoked-certs.pem"
CONFIG_SYSTEM_REVOCATION_KEYS=""
3, 编译安装
如果主机是18核的,虽然超线程是2*18,但还是应该写 make -j18,如果写更大值的话,会交通堵塞。
make -j18
sudo make modules_install
sudo make install
sudo update-grub
4,测试
可大概知道,跟amd gpu相关的 ko 有:
amdgpu
amddrm_ttm_helper
amdttm
amddrm_buddy
amdxcp
amd_sched
amdkcl
drm_display_helper
drm_kms_helper
drm
video
i2c_algo_bit
我们看一下是否生成了这些ko文件: