舊機改造計畫之二 CPU and 顯示卡驅動

續之前的老舊電腦改裝成NAS分享伺服器之後
工作室的地上還躺著一台從同事那接收過來的
使用LGA775 CPU的ASUS P5B-E-Plus主機板
習慣是機器放在工作室常常看著
那天也許會突然想到可以應用在什麼用途也不一定
就是研究對岸的圾垃佬玩洋垃圾的Youtube影片中
看到最早的報癈電腦零件中有大神
把伺服器專用的CPU想方設法弄到桌機上來使用
一來報廢伺服器CPU很便宜
二來是效能可對比桌機版的高階CPU效能。

對岸指的洋垃圾都是在國外被汰換下來的伺服器零組件
有CPU、記憶體、主機版、硬碟、介面卡被廢棄回收商收購重回到二手巿場上
因為是專為長時間不關機設計
所以零件的耐用度比桌機要耐用上許多
理所當然成為最佳升級材料來源。

目前服務的公司每年也都會有汰換下來的各式電腦
伺服器主版都是特殊規格不是很適合放在家中使用
多半把CPU、RAM、HDD和擴充卡留下來當備品。

這次要用到的LGA771就是從Dell PowerEdge 2950汰舊的Xeon 5410
在公司服務的時間早己超過十年
至今仍有一部份2950還在線上工作著。
看網上分享的作法要先把Xeon的觸點絕緣掉
是用碳筆把觸點塗滿碳粉作絕緣
這個作法有很高的風險會失敗
後來在網上就有人賣專門的絕緣貼紙
目前露拍還買得到魔改用的貼紙
一張30怕失敗買了二張。

主機的部份要做二件事
一是切CPU糟的防呆凸點
才能把Xeon CPU轉90度放入插糟
二是主機版的BIOS Files要自行增加對應的CPU micro-code
再重新寫入主機版的BIOS內
開機才能正確判讀出54XX和Xeon系列的CPU我不寫作法
這裡就貼上參考網站就好。

主機板支援的LGA771如下:
主機板支援65nm 775 的 CPU -> 可以裝任何65nm 771 的 XEON CPU
主機板支援45nm 775 的 CPU -> 可以裝任何 771 的 XEON CPU

[MOD] LGA775 Support For LGA771 Xeon CPUs
hello. I Asus P5Q Delux + Xeon X5450. help to make it to the mod bios?I wrote To unleash this CPU’s full power, please perform bios updatehttp://dlcdnet.asus.com/pub/ASUS/mb/socket775/P5Q_Deluxe/P5Q-ASUS-DELUXE-2301.zipI myself from Belarus, writing through an interpreter.thank you.

在魔改成功開機測試之後又把舊機器躺了半年之久
才因最近需要一台跑Linux Ubuntu桌面來處理一些特殊應用
又面臨老舊顯卡在最近版Linux Kernel不支援問題。

Linux Ubuntu 20.04.03 LTS安裝來源
是用一個老舊的IDE轉USB HDD的接頭
把40G IDE HDD當開機碟
在Windows桌面下載安裝ventoy-1.0.64-windows
Ventory可以選擇格式化外接碟成開機碟並新增磁區命名為Ventoy的空間
方便存入ubuntu-20.04.3-desktop-amd64.iso
之後用此USB HDD開機就會出現選單選擇安裝ISO系統。

因為XEON的CPU是沒有內顯輸出的必需另外插上顯卡
手上有Nvidia GeForce GT 220這著老卡可用
在安裝好Ubuntu後要驅動這張卡遇到不少因難就記錄如下:

After the Ubuntu 20.04 LTS  boot up.
Try to install and complete the Linux kernel nvidia-340 driver to enable graphics card for X-Windows optimized performance.

sudo apt install nvidia-340
dpkg --configure nvidia-340

That will return failed error from command apt and dpkg, check the error log and know reason.

make: *** [Makefile:202: nvidia.ko] Error 1
 make: Target 'module' not remade because of errors.
 make: Entering directory '/var/lib/dkms/nvidia/340-340.108/build/uvm'
 cd ./..; make module SYSSRC=/lib/modules/5.13.0-27-generic/build SYSOUT=/lib/modules/5.13.0-27-generic/build KBUILD_EXTMOD=./..
 make[1]: Entering directory '/var/lib/dkms/nvidia/340-340.108/build'
 NVIDIA: calling KBUILD...
....

Do a lot of analysis error, finally we found that nvidia-340 source code have reference two kernel source files. 
vim /usr/src/nvidia-340-340.108/nv-linux.h +122 # nv-linux.h line #122
#include <asm/kmap_types.h>         /* page table entry lookup          

vim /usr/src/nvidia-340-340.108/nv-linux.h +139 # nv-linux.h line #139
#include <linux/ioctl32.h>          /* register_ioctl32_conversion()    


That mean the next, need to search necessary included files for current kernel header directors, but there was no existing in 5.1x.xx source tree.

After do more search the "kmap_tyoes.h" and "ioctl32.h" filename as key work in google then know that old Nvidia driver v340 didn't support latest kernel version , we need to downgrade the kernel to 5.8.1x.

The refer link have description as below. https://bbs.archlinux.org/viewtopic.php?id=259936

From nvidia forum: "Linux Kernel 5.9+ is incompatible with current and previous NVIDIA Linux GPU drivers.". Yes, this is true. I am using one of older NVIDIA GPUs. The driver for it is in the 390xx version. After today's kernel upgrade to 5.9 my graphical environment didn't start. So I had do revert linux and linu-headers to the latest 5.8.14. If there is any help before the mid of November, please be so kind and give us a hint.For sure I can wait a month or so without current upgrades, as my environment is completed and I don't preview any urgent need of installing additional apps...What's worse, 390xx drivers are in AUR and they have been abandoned...


The Ubuntu 20.04 LTS installed kernel version is 5.13.0-xx-xxxxxxx , so the first  thing is switch to kernel version to 5.8.14 or above.

Refer below link to found the solution, before do that we need to remove nvidia-340 package with command 'sudo apt remove nvidia-340 nvidia-340-update'.
https://askubuntu.com/questions/1291655/is-there-a-kernel-5-8-ppa-for-ubuntu-20-04

sudo add-apt-repository ppa:cappelikan/ppa
apt update
sudo apt install mainline
sudo mainline --list
sudo vi /etc/initramfs-tools/initramfs.conf 
# then change the line with COMPRESS=zstd to COMPRESS=gzip
sudo mainline --install 5.8.18 # and then reboot with this kernel version

check to /boot/grub/grub.cfg which have add kernel 5.8.18 boot menu.
After rebooted, execute below command for install and setup nvidia-340 driver

sudo apt-get build-dep linux linux-image-$(uname -r)
sudo apt install nvidia-340 nvidia-340-updates 
# if adapter newer maybe be installed nvidia-dkms-390 xserver-xorg-video-nvidia-390
sudo mkdir -p /etc/X11/xorg.conf.d
sudo cp /usr/share/x11/xorg.conf.d/10-nvidia.conf /etc/x11/xorg.conf.d/
sudo vi /etc/x11/xorg.conf.d/10-nvidia.conf 
#Add # Option "RegistryDwords" "EnableBrightnessControl=1;"

Check file /etc/X11/xorg.conf.d/10-nvidia.conf and then reboot
Check the GPU by command nvidia-smit that output info as below screenshot