Check "uname -r"
"make-kpkg" will read "Makefile", and it will use the result of "uname -r" to be the name of dictionary.
2.6.0-1-k7
#!/bin/bash
# 參數設定...
# 指定所下載的 Debian Package 版本
DEBPackageVer="unstable"
# 設定原始碼的存放位置,要依 Debian Package 內容而改變!
Source='/usr/src'
# 指定 nVIDIA 的 Driver 原始檔案名稱,要依 Debian Package 內容而改變!
nVidiaSource='nvidia-kernel-source.tar.gz'
# 指定所下載的 Debian Package 版本
DEBPackageVer="unstable"
# 設定在編譯時所使用的暫存位置
Temporary='/tmp'
# Pause 指令...
Pause()
{
echo ""
echo "Press <Enter> To Continue, Or <Ctrl><C> To Interrupt..."
read EnterKey
}
# 下載 nVIDIA 的 Driver 的原始檔
apt-get -t "$DEBPackageVer" install nvidia-kernel-source
apt-get -t "$DEBPackageVer" install nvidia-kernel-common
Pause
# 檢查檔案是否存在?
if [ -f "$Source"/"$nVidiaSource" ]; then
# 解開檔案
tar -xvzf "$Source"/"$nVidiaSource" -C $Temporary
cd "$Temporary"/modules/nvidia-kernel/
# 設定編譯的變數
KernelVersion=$(uname -r)
# 注意:以下的變數應該是沒有問題,但是最好再確實檢查一下!
if [ -d /usr/src/kernel-headers-"$KernelVersion" -o -f /usr/src/kernel-headers-"$KernelVersion" ]; then
# 指定 Kernel Headers 的位置
export KSRC=/usr/src/kernel-headers-"$KernelVersion"
else
echo "Sorry, Can NOT Find Kernel Headers in [ /usr/src/kernel-headers-"$KernelVersion" ]..."
Pause
exit 1
fi
# 指定所要安裝的 Kernel Modules 的位置
export KVERS="$KernelVersion"
# 注意:在這裡不檢查 GCC 的版本,但是最好再親自確認一下!
export IGNORE_CC_MISMATCH=yes
# 編譯 nVidia Video Card Driver 的 DEB Package
debian/rules binary_modules | tee "$Temporary"/modules/CompileMsg
echo "nVidia Video Card DEB Package Compilation is Finished..."
Pause
# 找出剛剛所編譯出來的 deb 檔案名稱...
DEBFile=$( grep dpkg-deb "$Temporary"/modules/CompileMsg | tr -s "'" '\n' | tr -s '`' '\n' | grep "\.deb" )
echo "nVidia Video Card DEB Package is [ $DEBFile ]..."
Pause
if [ -f "$DEBFile" ];then
# 安裝剛才所編譯的 nVidia Video Card Driver Package
dpkg -i "$DEBFile"
# 同時也把 nvidia-glx 套件安裝進來!
apt-get -t "$DEBPackageVer" install nvidia-glx
Pause
else
echo "Sorry, Can NOT Find nVidia Video Card DEB Package in [ "$DEBFile" ]..."
Pause
exit 1
fi
# 將編譯時的暫存檔案清掉!
rm -R "$Temporary"/modules/
echo "The Installation of nVidia Video Card Driver was Successful Finished."
else
# 檔案檢查有誤...
echo "Sorry, Can NOT Find SourceFile [ "$Source"/"$nVidiaSource" ]..."
Pause
exit 1
fi
小黑 寫:有下 make-kpkg clean 嗎?
palmpilote3:~# dpkg -c /usr/src/nvidia-kernel-2.6.0-custom_1.0.5328-2+2.6.0.custom-1_i386.deb
drwxr-xr-x root/root 0 2004-01-20 10:12:12 ./
drwxr-xr-x root/root 0 2004-01-20 10:12:11 ./lib/
drwxr-xr-x root/root 0 2004-01-20 10:12:11 ./lib/modules/
drwxr-xr-x root/root 0 2004-01-20 10:12:11 ./lib/modules/2.6.0-custom/
drwxr-xr-x root/root 0 2004-01-20 10:12:11 ./lib/modules/2.6.0-custom/nvidia/
-rw-r--r-- root/root 2373850 2004-01-20 10:12:11 ./lib/modules/2.6.0-custom/nvidia/nvidia.ko
drwxr-xr-x root/root 0 2004-01-20 10:12:11 ./usr/
drwxr-xr-x root/root 0 2004-01-20 10:12:11 ./usr/share/
drwxr-xr-x root/root 0 2004-01-20 10:12:11 ./usr/share/lintian/
drwxr-xr-x root/root 0 2004-01-20 10:12:11 ./usr/share/lintian/overrides/
-rw-r--r-- root/root 247 2004-01-20 10:12:11 ./usr/share/lintian/overrides/nvidia-kernel-2.6.0-custom
drwxr-xr-x root/root 0 2004-01-20 10:12:11 ./usr/share/doc/
drwxr-xr-x root/root 0 2004-01-20 10:12:12 ./usr/share/doc/nvidia-kernel-2.6.0-custom/
-rw-r--r-- root/root 307 2004-01-17 15:54:59 ./usr/share/doc/nvidia-kernel-2.6.0-custom/README.Debian
-rw-r--r-- root/root 8056 2004-01-17 15:54:59 ./usr/share/doc/nvidia-kernel-2.6.0-custom/copyright
-rw-r--r-- root/root 2141 2004-01-17 15:54:59 ./usr/share/doc/nvidia-kernel-2.6.0-custom/changelog.Debian.gz
正在瀏覽這個版面的使用者:沒有註冊會員 和 1 位訪客