作者: Baron. Wan
1. RedHat Linux 的kernel source 位置在 /usr/src 中。以版本為例,在 /usr/src/linux-2.4.21 -4.EL/ 中的 .config 是 kernel 相關參數值,建議如要修改,請另存別的檔名,不要直接覆蓋!
2. 從 http://www.kernel.org/pub/linux 中找到 2.4 版本的更新 kernel,我是用 2.4.35 .3 版本來更新。
3. 解壓縮完畢後,執行 make menuconfig 來進行 kernel 參數設定;先進入主畫面,load 原舊有的設定檔 è /usr/src/linux-2.4.21 -4.EL/.config,調整完畢後 Save 到其他的位置,我是將檔案存放在 linux-2.4.35.3 裡面,檔名為 config-2.4.35.3-1 來表示這是我第一次編輯的設定檔,結束時請再儲存一次。
4. 用 make dep 來編譯設定資料,用 make bzImage 來編譯成 vmlinuz,完成後會產生 ./vmlinux、./System.map,arch/i386/boot/bzImage 等檔案。
5. cp vmlinux /boot/vmlinux-2.4.35 .3
cp System.map /boot/System.map-2.4.35.3
cp arch/i386/boot/bzImage /boot/vmlinuz-2.4.35.3
cp System.map /boot/System.map-2.4.35.3
cp arch/i386/boot/bzImage /boot/vmlinuz-2.4.35.3
6. make modules 來編譯 kernel modules
make modules_install 將編譯好的 modules 安裝到 /lib/modules/2.4.35 .3 當中。在執行 make modules_install 時,程式會先到 /boot 檢查有無相關的 vmlinuz and System.map,所以第五個步驟一定要在之前完成。
make modules_install 將編譯好的 modules 安裝到 /lib/modules/
7. 如果以上都編譯無誤,使用 mkinitrd /boot/initrd-2.4.35 .3.img 2.4.35.3 來建立 image 檔。
8. 最後,在 /etc/grub.conf or /boot/grub/grub.conf 當中編輯開機資訊,重新開機測試。
==================================================
/usr/src 是 Kernel 安裝路徑, 請將 linux-2.4.xx 目錄整個 copy 到 /usr/src , 然後進入 /usr/src/linux-2.4.xx 開始 compiler kernel 的動作
/* 刪除一些以前留下來的 .o 檔案 */
# make mrproper
/* Makefile 的 config 設定 (.config) */
# make menuconfig
/* 將以前曾經進行過的 .o 檔案刪掉, 才不會產生新舊版本的差別 */
# make clean
/* 開始編譯
編譯完成後, 應該會看到: …./arch/i386/boot/bzImage , 若有錯誤則請重新編譯 */
# make bzImage
/* 製作相關模組 */
# make modules
/* 若同一個核心模組重複被 Compiler 兩次以上, 那請先將該版的模組 move 掉 */
/* Install Modules , 安裝完成後, 會將模組放在 /lib/modules/ 內 */
# make modules_install
/* 之前執行 make bzImage 成功後, 會在 /arch/i386/boot/ 多個 bzImage 檔案 , 請放入 /boot */
# cp /usr/src/linux-2.4.xx/arch/i386/boot/bzImage /boot/vmlinuz-2.4.xx
# cp /usr/src/linux-2.4.xx/vmlinux /boot/vmlinux-2.4.xx
# cp /usr/src/linux-2.4.xx/System.map /boot/System.map-2.4.xx
# vi /boot/grub/menu.lst
加入一段 TITLE , 並在下一行加入: kernel /vmlinuz-2.4.xx ro root=/dev/hda3 rhgb quiet
或是 kernel /vmlinuz-2.4.xx ro root=LABEL=/
注: 後面的寫法可能只能適用在 2.4.21 以前的版本.
==================================================
/usr/src 是 Kernel 安裝路徑, 請將 linux-2.4.xx 目錄整個 copy 到 /usr/src , 然後進入 /usr/src/linux-2.4.xx 開始 compiler kernel 的動作
/* 刪除一些以前留下來的 .o 檔案 */
# make mrproper
/* Makefile 的 config 設定 (.config) */
# make menuconfig
/* 將以前曾經進行過的 .o 檔案刪掉, 才不會產生新舊版本的差別 */
# make clean
/* 開始編譯
編譯完成後, 應該會看到: …./arch/i386/boot/bzImage , 若有錯誤則請重新編譯 */
# make bzImage
/* 製作相關模組 */
# make modules
/* 若同一個核心模組重複被 Compiler 兩次以上, 那請先將該版的模組 move 掉 */
/* Install Modules , 安裝完成後, 會將模組放在 /lib/modules/ 內 */
# make modules_install
/* 之前執行 make bzImage 成功後, 會在 /arch/i386/boot/ 多個 bzImage 檔案 , 請放入 /boot */
# cp /usr/src/linux-2.4.xx/arch/i386/boot/bzImage /boot/vmlinuz-2.4.xx
# cp /usr/src/linux-2.4.xx/vmlinux /boot/vmlinux-2.4.xx
# cp /usr/src/linux-2.4.xx/System.map /boot/System.map-2.4.xx
# vi /boot/grub/menu.lst
加入一段 TITLE , 並在下一行加入: kernel /vmlinuz-2.4.xx ro root=/dev/hda3 rhgb quiet
或是 kernel /vmlinuz-2.4.xx ro root=LABEL=/
注: 後面的寫法可能只能適用在 2.4.21 以前的版本.
沒有留言:
張貼留言