ºìÁªLinuxÃÅ»§
Linux°ïÖú

Ubuntu Linux·½Ê½±àÒëÒ»¸öÄÚºË

·¢²¼Ê±¼ä:2006-12-03 09:16:39À´Ô´:ºìÁª×÷Õß:samblue
ÿһ¸öLinux·¢Ðа涼ÓÐ×Ô¼º×¨ÃŵŤ¾ßÈ¥¹¹½¨×Ô¶¨ÒåµÄÄÚºË. ±¾ÎÄÖ÷Òª½éÉÜÔÚUbuntuƽ̨ÉϱàÒëÄÚºË, ÈçºÎ´Ówww.kernel.org(Ò²½Ðvanilla kernel)»ñµÃ×îÐÂÇÒδ¸Ä¶¯µÄÄÚºËÔ´´úÂëÀ´¹¹½¨Ò»¸ö×Ô¶¨ÒåµÄÄÚºË, ÕâÑùÄã¿ÉÒÔʹÓÃ×Ô¼ºµÄÄں˶ø²»ÊÇ·¢ÐаæµÄÄÚºË, ÁíÍâÒ²½éÉÜÁËÈçºÎ¸øÄں˴ò²¹¶¡, ´Ó¶ø·½±ãÔö¼ÓÐµĹ¦ÄÜ.

ÏÂÃæµÄ¹¤×÷ÎÒ¶¼ÔÚUbuntu 6.10 Server ("Edgy Eft")ºÍUbuntu 6.06 Desktop ("Dapper Drake")ÉϾ­¹ýÁ˲âÊÔ.

ÎÒÏëÊ×ÏÈҪ˵µÄÊÇÎÄÕÂÖй¹½¨×Ô¶¨ÒåÄں˵ķ½Ê½²»ÊÇΨһµÄ, »¹ÓÐÐí¶àÆäËüµÄ·½Ê½, Õâ²»¹ýÊÇÎÒÏ°¹ßµÄ·½Ê½. ÎÒ²»Äܱ£Ö¤Ê¹Óú󲻻á³öÏÖÈκÎÎÊÌâ.

1. Ô¤±¸¹¤×÷

ÎÒÍƼöʹÓÃrootÓû§Ö´ÐÐÏÂÃæËùÓеIJ½Öè. Èç¹ûÄ㻹ûÓд´½¨rootµÇ½¿ÚÁî, ÇëÔËÐÐÏÂÃæµÄÃüÁî:
sudo passwd root

È»ºó, ÒÔrootÉí·ÝµÇ½:
su

Èç¹ûÄãÏëʹÓÃÒ»°ãÓû§À´Ìæ´úrootÓû§, ¼ÇסÔÚ±¾ÎÄËùÓÐÃüÁîÇ°ÊäÈësudo, ±ÈÈçµ±ÎÒÔËÐÐ
apt-get update

ÄãÐèÒªÔËÐÐÏÂÃæµÄÃüÁîÀ´Ìæ´ú, µÈ.
sudo apt-get update

1.1 Ubuntu 6.10ÉϵÄ/bin/sh ("Edgy Eft")
ÔÚUbuntu 6.10, /bin/shȱʡÊÇÒ»¸öÁ´½Óµ½/bin/dashµÄ×Ö·ûÁ´½Ó. µ±Äã±àÒëÈí¼þÔ´´úÂëµÄʱºò, /bin/dashËƺõ»¹´æÔÚÎÊÌâ. ÖÁÉÙÎÒÒѾ­Óöµ½ÁËһЩÎÊÌâ. ËùÒÔÎÒ°Ñ/bin/shÁ´½Óµ½ÁË/bin/bash.

Èç¹ûÄãʹÓÃUbuntu 6.10, ÏÖÔÚÄã¿ÉÒÔÔËÐÐ:
rm -f /bin/sh
ln -s /bin/bash /bin/sh

2 °²×°±ØÐèµÄÈí¼þ°ü (ΪÄں˱àÒë×ö×¼±¸)

Ê×ÏÈÎÒÃÇÉý¼¶Èí¼þ(°ü)¿â:
apt-get update

È»ºóÎÒÃÇ°²×°ËùÓÐÐèÒªµÄÈí¼þ°ü:
apt-get install kernel-package libncurses5-dev fakeroot wget bzip2

3 ÏÂÔØÄÚºËÔ´´úÂë

½ÓÏÂÀ´ÎÒÃÇÏÂÔØÐèÒªµÄÄں˵½/usr/srcĿ¼(È¥www.kernel.orgÍøÕ¾ÏÂÔØÄãÐèÒªµÄÄں˰汾, ±ÈÈç. linux-2.6.18.1tar.bz2(Äã¿ÉÒÔ´ÓÕâÀïÏÂÔØËùÓеÄ2.6ÄÚºË: http://www.kernel.org/pub/linux/kernel/v2.6/). È»ºóÏÂÔص½/usr/srcĿ¼:
cd /usr/src
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.18.1.tar.bz2

È»ºó½âѹÄÚºËÔ´´úÂë, ´´½¨Ò»¸öÖ¸ÏòÄÚºËÔ´´úÂëĿ¼µÄlinux×Ö·ûÁ´½Ó:
tar xjf linux-2.6.18.1.tar.bz2
ln -s linux-2.6.18.1 linux
cd /usr/src/linux

4 ¸øÄÚºËÔ´´úÂë´ò²¹¶¡(¿ÉÑ¡)

ÓÐʱÄãµÄȱʡÄں˲»Ö§³ÖÐÂÂòµÄÉ豸, ÄãÐèÒª°²×°ÐµÄÇý¶¯. »òÕßÄãÐèҪʹÓÃÐéÄâ¼¼Êõ»òÆäËü¸ß¼¶µÄ¼¼Êõ, ¶øÕâЩÏÖÓеÄÄں˶¼²»Ö§³Ö. ÕâÑùÇé¿öÏÂÄãÐèÒª¸ø¸øÄÚºËÔ´´úÂë´ò²¹¶¡(µ±È»²¹¶¡ÒѾ­·¢²¼..)

ÏÖÔÚÎÒÃǼÙÉèÄãÒѾ­ÏÂÔØÐèÒªµÄ²¹¶¡(ÒÔÏÂÀý×ÓÎÒ½ÐËüpatch.bz2)µ½/usr/src. ÔËÐÐÏÂÃæµÄÃüÁî¸øÄÚºËÔ´´úÂëÖ±½Ó´òÉϲ¹¶¡(ÄãµÄÓû§±ØÐëλÓÚ/usr/src/linuxĿ¼):
bzip2 -dc /usr/src/patch.bz2 | patch -p1 --dry-run
bzip2 -dc /usr/src/patch.bz2 | patch -p1

µÚÒ»¸öÃüÁîÓÃÓÚ²âÊÔ, ¶ÔÄÚºËûÓÐÈκÎÓ°Ïì. Èç¹ûûÓÐÏÔʾ´íÎó, Äã¿ÉÒÔÔËÐеڶþ¸öÃüÁî¸øÄں˴ò²¹¶¡. Èç¹ûµÚÒ»¸öÃüÁîÓÐÎó, ÇëÎñ¼ÌÐøµÄ²Ù×÷!

ÄãÒ²Äܹ»Í¨¹ýÄں˵Äprepatches·½Ê½´ò²¹¶¡. ±ÈÈç, Èç¹ûÄãÐèÒªÒ»¸ö¹¦ÄÜ, ¶øÕâ¸ö¹¦Äܽö´æÔÚÓÚ2.6.19-rc4ÖÐ, ÕýʽÍêÕûµÄÄں˰汾ÈÔûÓз¢²¼, ¶øpatch-2.6.19-rc4.biz2ÒѾ­·¢²¼. Äã¿ÉÒÔ°ÑÕâ¸ö²¹¶¡´òµ½2.6.18µÄÄÚºËÔ´´úÂëÖÐ, µ«Çë²»Òª´ïµ½2.6.18.1»ò2.6.18.2, µÈ. Õâ¸ö¹æÔòÔÚ½ÓÏÂÀ´µÄÍøÒ³ÖÐ×¢Ã÷: http://kernel.org/patchtypes/pre.html

prepatchesµÈͬÓÚlinuxÖеIJâÊÔ·¢ÐÐ; ËûÃÇλÓÚ´æµµµÄ²âÊÔĿ¼ÖÐ, ÎÒÃÇ¿ÉÒÔʹÓÃpatch(1)¹¤¾ß¶ÔÉÏÒ»¸öÍêÕû·¢Ðаæ(°æ±¾ºÅ·ÖÈý²¿·Ö)´ò²¹¶¡(ÀýÈç, 2.6.12-rc4 prepatchÖ»¿ÉÒÔ¸ø2.6.11ÄÚºËÔ´´úÂë´ò²¹¶¡, ¶ø²»ÊÇ2.6.11.10.)

ËùÒÔÈç¹ûÄãÏë±àÒë2.6.19-rc4ÄÚºË, Äã±ØÐëÔÚ²½Öè3.1ÏÂÔØ2.6.18(http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.18.tar.bz2)Ìæ´ú2.6.18.1ÄÚºËÔ´´úÂë!

ÏÂÃæÊÇÈçºÎ¸ø2.6.18´òÉÏ2.6.19-rc4²¹¶¡:
cd /usr/src
wget http://www.kernel.org/pub/linux/kernel/v2.6/testing/patch-2.6.19-rc4.bz2
cd /usr/src/linux
bzip2 -dc /usr/src/patch-2.6.19-rc4.bz2 | patch -p1 --dry-run
bzip2 -dc /usr/src/patch-2.6.19-rc4.bz2 | patch -p1

5. ÅäÖÃÄÚºË

ʹÓõ±Ç°¹¤×÷Äں˵ÄÅäÖÃÎļþ×öΪÐÂÄÚºËÅäÖÃÎļþµÄ»ù´¡ÊÇÒ»¸öºÜºÃµÄÖ÷Òâ. Òò´ËÎÒÃÇ¿½±´ÒÑ´æµÄÅäÖÃÎļþµ½/usr/src/linux:
cp /boot/config-`uname -r` ./.config

È»ºóÔËÐÐ
make menuconfig

È»ºóÎÒÃÇ¿´µ½Äں˵ÄÅäÖò˵¥. Òƶ¯ÂÌÉ«¹â±êµ½ Load an Alternate Configuration File ÐкóÑ¡Ôñ.configÎļþ(°üº¬Á˵±Ç°¹¤×÷Äں˵ÄÅäÖÃ)×öΪÅäÖÃÎļþ:

[align=center]
[/align]

È»ºóä¯ÀÀÄÚºËÅäÖò˵¥, Ñ¡ÔñÄãÐèÒªµÄ¹¦ÄÜ. Íê³ÉÅäÖúó, Ñ¡ÔñExit, »Ø´ðÏÂÃæµÄÎÊÌâ(Do you wish to save your new kernel configuration? ÄãÏ£Íû±£´æеÄÄÚºËÅäÖÃÂð?), Ñ¡ÔñYes:
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 3 ÌõÆÀÂÛ

  1. 219.159.229.* ÓÚ 2006-12-05 11:23:40·¢±í:

    лл£¡·Ç³£¾­µä
    Ö»ÊÇÅäÖõIJ˵¥ÎÒ¶¼¿´²»¶®¡£¡£¡£

  2. samblue ÓÚ 2006-12-03 09:17:47·¢±í:

    [align=center][/align]

    °´ESC½øÈëGRUB²Ëµ¥:

    [align=center][/align]

    Ñ¡ÔñÄãÒÔÇ°µÄÄÚºËÆô¶¯ÏµÍ³, ÏÖÔÚÄãÄÜÔٴγ¢ÊÔ±àÒëÐµĹ¤×÷ÄÚºË. ²»ÒªÍü¼Ç´Ó/boot/grub/menu.1stÎļþÖÐÒÆÈ¥²»ÐèÒªµÄÒýµ¼ÄÚºËÐÅÏ¢.

  3. samblue ÓÚ 2006-12-03 09:17:15·¢±í:

    6 ¹¹½¨ÄÚºË

    Ö´ÐÐÏÂÃæÃüÁîÀ´¹¹½¨ÄÚºË:
    make-kpkg clean
    fakeroot make-kpkg --initrd --append-to-version=-custom kernel_image
    kernel_headers

    ÔÚ--append-to-version= ºóÃæÄã¿ÉÒÔдÉÏÈκÎ×Ö·û´®À´Çø±ðÄں˰汾, µ«ÊDZØÐëÒÔ" - "·ûºÅ¿ªÊ¼¶øÇÒºóÃæ²»°üÀ¨Èκοոñ.

    ±£³ÖÄÍÐÄ, Äں˱àÒëÐèÒªÒ»¶¨Ê±¼ä, Ö÷Òª¿´ÄãµÄÄÚºËÅäÖÃÍ´?íÆ÷ËÙ¶?

    7 °²×°ÐÂÄÚºË

    Ôڳɹ¦¹¹½¨Äں˺ó, ÄãÔÚ/usr/srcĿ¼ÄÜ·¢ÏÖÁ½¸ö.debÈí¼þ°ü.
    cd /usr/src
    ls -l

    ÔÚÎҵIJâÊÔϵͳÉÏ, ËûÃÇ·Ö±ðÃûΪ linux-image-2.6.18.1-custom_2.6.18.1-custom-10.00.Custom_i386.deb (°üº¬ÁËʵ¼ÊµÄÄÚºË) ºÍ linux-headers-2.6.18.1-custom_2.6.18.1-custom-10.00.Custom_i386.deb (°üº¬ÁËÐèÒªµÄÎļþ, ÓÃÓÚÒÔºóÐèÒª±àÒë¶îÍâµÄÄÚºËÄ£¿é). ÎÒÊÇÕâÑù°²×°µÄ:
    dpkg -i linux-image-2.6.18.1-custom_2.6.18.1-custom-10.00.Custom_i386.deb
    dpkg -i linux-headers-2.6.18.1-custom_2.6.18.1-custom-10.00.Custom_i386.deb

    (ÏÖÔÚÄãÉõÖÁÄܹ»¿½±´ÕâÁ½¸ö.debÎļþµ½ÆäËüµÄUbuntuϵͳ, ͨ¹ýÉÏÃæµÄ·½Ê½°²×°. Ä㽫²»ÔÙÐèÒª±àÒëÄÚºË.)

    È»ºó¼ì²é /boot/grub/menu.lstÎļþ, ÏÖÔÚÄ㽫ÄÜ·¢ÏÖÐÂÄÚºËʹÓõÄÁ½¸öÒýµ¼ÅäÖÿé:
    vi /boot/grub/menu.lst

    ÔÚÎÒ²âÊÔϵͳÉÏÒѾ­Ìí¼ÓºÃµÄÒýµ¼ÅäÖÿéÊÇÕâÑùµÄ:
    title Ubuntu, kernel 2.6.18.1-custom
    root (hd0,0)
    kernel /boot/vmlinuz-2.6.18.1-custom root=/dev/sda1 ro quiet splash
    initrd /boot/initrd.img-2.6.18.1-custom
    savedefault
    boot

    title Ubuntu, kernel 2.6.18.1-custom (recovery mode)
    root (hd0,0)
    kernel /boot/vmlinuz-2.6.18.1-custom root=/dev/sda1 ro single
    initrd /boot/initrd.img-2.6.18.1-custom
    boot

    ÏÖÔÚÖØÆôϵͳ:
    shutdown -r now

    Èç¹ûÒ»Çнøչ˳Àû, ÄãµÄÐÂÄÚºËÕý³£¹¤×÷. Ä㻹¿ÉÒÔͨ¹ýÔËÐÐÏÂÃæÃüÁîÀ´¼ì²éÐÂÄÚºËÊÇ·ñÔËÐÐ:
    uname -r

    Õ⽫»áÏÔʾÈç:
    2.6.18.1-custom

    Èç¹ûϵͳûÓÐÆðÀ´, ÖØÆôÒ»ÏÂ, Äã»á¿´µ½: