nix

跳到主文

Seize...

部落格全站分類:數位生活

  • 相簿
  • 部落格
  • 留言
  • 名片
  • 10月 10 週三 200710:10
  • Compile The Ubuntu Kernel

這次是在Ubuntu 7.04的環境Compile 2.6.22.9的Kernel。在Ubuntu的環境下Compile Linux kernel是件輕鬆的事,要做的事很少喔。


在Compile kernel前要先確定的就是有個gcc可以用啦,如果不確定就用apt-get build-dep gcc再安裝一次gcc吧,安裝完隨便寫個Hello Wrold測試一下就行啦。


先確認一下/bin/sh是link到/bin/bash,Ubuntu預設是link到/bin/dash,還是用bash比較習慣。


接下來要安裝Cimpile kernel時需要用的一些tool,我們需要kernel-package、libncurses5-dev、fakeroot、wget、bzip2。


抓一版Kernel來用,連上http://www.kernel.org找到最新的Kernel版本是2.6.22.9,所以就抓這版來用吧。在/usr/src目錄下用wget抓Linux kernel soruce code。


解壓縮Linux kernel,Create一個linux的soft link到linux-2.6.22.9。並切換到/usr/src/linux目錄。


先把舊的.config copy來用吧,至少確定是可以work的Kernel設定,而且可以以舊的設定為基礎再去修改自己需要的Kernel功能,不用一切從頭來。
執行cp /boot/config-`uname -r' ./.config就會把目前用的Kernel的.config copy到現在目錄下囉。


make menuconfig。


這時就可以選"Load an Alternate Configuration File"啦。


把剛剛的.config load進來吧,之後再去修改自己想要的Kernel設定。


設定好Kernel就可以存檔離開啦。


執行make-kpkg clean。


執行fakeroot make-kpkg --initrd kernel_image kernel_headers。接下來就是漫長的等待啦,Build kernel是要花不少時間的,可以泡茶啦。


Build完Kernel後切換到/usr/src目錄,會看到多了"linux-image-2.6.22.9_2.6.22.9-10.00.Custom_i386.deb"和"linux-headers-2.6.22.9_2.6.22.9-10.00.Custom_i386.deb"這兩個檔案。
執行dpkg -i linux-image-2.6.22.9_2.6.22.9-10.00.Custom_i386.deb。


執行dpkg -i linux-headers-2.6.22.9_2.6.22.9-10.00.Custom_i386.deb。


檢查一下開機選單/boot/grub/menu.lst。


太棒啦,開機選單也是自動建好的,什麼都不用改囉。可以重開機測試一下了。


開機後按[Esc]進入開機選單,果然看到了2.6.22.9版的Kernel呢。


開完機再用uname -r確認一下。太棒啦,現在run的是2.6.22.9的Kernel喔。


文章標籤
全站熱搜
創作者介紹
創作者 nix 的頭像
nix

nix

nix 發表在 痞客邦 留言(0) 人氣(35,454)

  • 全站分類:
  • 個人分類:Linux
▲top

GNU

GNU

Firefox

Spreadfirefox Affiliate Button

Ubuntu

Free Software Foundation

Visit the Free Software Directory

Pentax 645D

個人資訊

nix
暱稱:
nix
分類:
數位生活
好友:
累積中
地區:

文章分類

  • Computer Architecture (0)
  • Computer Language (0)
  • Funny Story (0)
  • Life (0)
  • GNU (0)
  • Operating System (0)
  • Reading (0)
  • Compiler (0)
  • Memory Diary (0)
  • VMware Workstation 6 (0)
  • Share (0)
  • Linux (0)
  • Algorithms (0)
  • Uboot (0)
  • make (0)
  • VirtualBox 2.0.2 (0)
  • 未分類文章 (1)

最新文章

    最新留言

    參觀人氣

    • 本日人氣:0
    • 累積人氣:366,048

    文章精選

    nixchun
    PIXNET Logo登入