作者:semes 有疑问进群询问
参考了许多大佬的文章,还有gentoo官方的wiki,如果有哪位大佬看到文章里有你的内容,希望别生气哈
全过程root用户或者普通用户sudo,建立在gentoo已经安装完桌面的基础上,我就不讲gentoo整么安装了
gentoo linux安装nvidia(内核开始):
获取内核源码
emerge --ask sys-kernel/gentoo-sources
eselect kernel list
eselect kernel set 1
(可选)安装genkennel配置内核 ##有时候nvidia安装不上和内核配置有关,他需要根据你的内核配置文件来编译模块,所以我用genkernel,会自己陪内核的还是自己来配置内核
emerge --ask sys-kernel/genkernel
cd /usr/src/linux
genkernel all
禁用nouveau
mkdir /etc/modprobe.d/
touch /etc/modprobe.d/blacklist.conf
nano /etc/modprobe.d/blacklist.conf
#加入这些begin
blacklist nouveau
blacklist lbm-nouveau
options nouveau modeset=0
#加入这些end
安装显卡驱动
nano /etc/portage/make.conf
#加入这些begin
VIDEO_CARDS="intel i965 iris nvidia" #Intel UHD630和Nvidia双显卡
#加入这些end
emerge -av x11-base/xorg-server x11-apps/xrandr x11-base/xorg-drivers media-libs/mesa x11-drivers/nvidia-drivers
配置nvidia
nano /etc/modules-load.d/nvidia.conf
#加入这些begin
nvidia
#加入这些end
systemctl start systemd-modules-load.service
或者
rc-update add modules boot
nano /etc/modprobe.d/nvidia-drm.conf
#加入这些begin
options nvidia-drm modeset=1
#加入这些end
nano /etc/X11/xorg.conf
##############加入这些begin##############################
# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig: version 440.100
Section "ServerLayout"
Identifier "Layout0"
Screen 0 "Screen0"
Inactive "InactiveDevice1"
Option "AllowNVIDIAGPUScreens" "true"
Option "AllowPRIMEDisplayOffloadSink" "true"
EndSection
Section "Files"
EndSection
Section "InputClass"
Identifier "libinput pointer catchall"
Driver "libinput"
MatchIsPointer "on"
MatchDevicePath "/dev/input/event*"
Option "AccelProfile" "flat" #禁用鼠标加速,玩游戏必备
Option "AccelSpeed" "0"
EndSection
Section "InputClass"
Identifier "libinput keyboard catchall"
Driver "libinput"
MatchIsKeyboard "on"
MatchDevicePath "/dev/input/event*"
EndSection
Section "InputClass"
Identifier "libinput touchpad catchall"
Driver "libinput"
MatchIsTouchpad "on"
MatchDevicePath "/dev/input/event*"
option "Tapping" "True"
option "TappingDrag" "True"
option "NaturalScrolling" "True"
EndSection
Section "Module"
Load "fb"
Load "shadow"
Load "exa"
Load "glamoregl"
Load "glx"
Load "dri3"
EndSection
Section "Monitor"
Identifier "Monitor0"
VendorName "Unknown"
ModelName "Unknown"
Option "DPMS"
EndSection
Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BusID "PCI:1:0:0"
Option "Accel" "true"
Option "RenderAccel" "true"
Option "NoFlip" "false"
Option "SWCursor" "false"
Option "HWCursor" "true"
Option "DamageEvents" "true"
Option "ModeDebug" "false"
Option "AllowSHMPixmaps" "false"
Option "SidebandSocketPath" "/tmp"
Option "UseSysmemPixmapAccel" "true"
Option "MultisampleCompatibility" "true"
Option "AllowEmptyInitialConfiguration" "true"
Option "ForceCompositionPipeline" "true"
Option "ForceFullCompositionPipeline" "true" #大幅度减少屏幕画面撕裂tearing,类似于垂直同步Vsync
Option "AllowIndirectGLXProtocol" "false"
Option "TripleBuffer" "true" #开启三重缓冲、并配合CompositionPipeline,能明显提升桌面和3D游戏的流畅度和响应速度,并且浏览器加载页面的速度也明显的感觉快了很多
Option "Stereo" "0"
Option "BaseMosaic" "false"
Option "MultiGPU" "false"
Option "SLI" "false"
Option "PrimaryGPU" "yes"
EndSection
Section "Device"
Identifier "InactiveDevice1"
Driver "modesetting"
VendorName "Unknown"
Option "AccelMethod" "glamor"
Option "DRI" "3"
Option "TearFree" "true"
EndSection
Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
DefaultDepth 24
SubSection "Display"
Depth 24
EndSubSection
EndSection
Section "Screen"
Identifier "Screen1"
Device "InactiveDevice1"
EndSection
Section "ServerFlags"
Option "DontVTSwitch" "True"
Option "DontZap" "True"
EndSection
#############加入这些end###############
nano /usr/share/sddm/scripts/Xsetup
#加入这些begin
xrandr --setprovideroutputsource modesetting NVIDIA-0 #加入这一行
xrandr --auto #加入这一行
#加入这些end
chmod u+s /usr/bin/xinit
修改grub启动参数
nano /etc/default/grub
找到
#GRUB_CMDLINE_LINUX=""
改为
GRUB_CMDLINE_LINUX="nvidia-drm.modeset=1"
然后更新grub引导
grub-mkconfig -o /boot/grub/grub.cfg
#详细的intel&nvidia双显卡****prime****设置可以参照这位大佬的文章——
gentoo linux配置intel和nvidia双显卡电脑,使用prime方案
www.jianshu.com/p/515a1f39b438
换intel_GPU就改xorg.conf
把/etc/X11/xorg.conf的内容修改为:
##############################################################
Section "ServerLayout"
Identifier "layout"
Screen 0 "iGPU"
Option "AllowNVIDIAGPUScreens"
EndSection
Section "Device"
Identifier "iGPU"
Driver "modesetting"
BusID "PCI:0:2:0"
EndSection
Section "Screen"
Identifier "iGPU"
Device "iGPU"
EndSection
Section "Device"
Identifier "nvidia"
Driver "nvidia"
BusID "PCI:1:0:0"
EndSection
###################################################################
安装timshift备份软件
Gentoo Portage Overlays - News
gpo.zugaina.org/
emerge layman
layman -a guru
layman -s guru
nano /etc/portage/package.keywords
#加入这些begin
app-backup/timeshift
#加入这些end
emerge app-backup/timeshift --autounmask-write
etc-update --automode -3
emerge app-backup/timeshift
安装gentoo储存库的steam
nano /etc/portage/make.conf
#加入这些begin
USE=" -gpm " ##解决一个循环依赖问题,我遇到的大问题,后面才想到备份系统
#加入这些end
安装 app-eselect/eselect-repository和dev-vcs/git:
emerge --ask --noreplace app-eselect/eselect-repository dev-vcs/git
添加 Steam 存储库:
eselect repository enable steam-overlay
或者layman -a steam-overlay
然后与任一特定的 emaint 同步:
emaint sync -r steam-overlay
或
emerge --sync
或
layman -s steam-overlay
nano /etc/portage/package.accept_keywords/steam
#加入这些begin
*/*::steam-overlay
#加入这些end
nano /etc/portage/package.keywords
#加入这些begin
games-util/game-device-udev-rules
#加入这些end
emerge games-util/steam-launcher games-util/steam-meta --autounmask-write
etc-update --automode -3
emerge games-util/steam-launcher games-util/steam-meta
安装过程要把依赖gpm的程序程序编译大概30几个包
我在安装steam的时候跌了一脚,我把gpm卸载了,大家遇到循环依赖的时候,不要向我一样哈,这导致了第11次重新安装系统
编译完后重启gentoo steam就可以正常用了
离线