×
Create a new article
Write your page title here:
We currently have 3,189 articles on s23. Type your article name above or create one of the articles listed here!



    s23
    3,189Articles

    Debian/Building a kernel: Difference between revisions

    Content added Content deleted
    imported>Hundfred
    No edit summary
    imported>mutante
    mNo edit summary
     
    Line 1: Line 1:
    taken from [http://www.falkotimme.com/howtos/debian_kernel2.6_compile/]
    taken from [http://www.falkotimme.com/howtos/debian_kernel2.6_compile/]


    '''Kernel-Compile-Howto'''
    <pre>

    Kernel-Compile-Howto
    First login to your [[Debian]] machine on the command line as root.


    First login to your Debian machine on the command line as root. Install the prerequisites that we need to compile the new kernel:
    Install the prerequisites that we need to compile the new kernel:


    apt-get install kernel-package ncurses-dev fakeroot wget bzip2
    apt-get install kernel-package ncurses-dev fakeroot wget bzip2


    Then go to /usr/src:
    Then go to /usr/src:


    cd /usr/src
    cd /usr/src


    Then get the latest Linux kernel source (or the kernel source you need) from http://www.kernel.org/pub/linux/kernel/v2.6/:
    Then get the latest Linux kernel source (or the kernel source you need) from http://www.kernel.org/pub/linux/kernel/v2.6/:


    wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.8.1.tar.bz2
    wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.8.1.tar.bz2


    Unpack the kernel sources:
    Unpack the kernel sources:


    tar xjf linux-2.6.8.1.tar.bz2
    tar xjf linux-2.6.8.1.tar.bz2


    cd linux-2.6.8.1/
    cd linux-2.6.8.1/


    It is normally a good idea to take the configuration of your existing (working!) kernel 2.6 as a starting point for the configuration of your new kernel. Usually the current kernel configuration is saved in a file under /boot, e.g. /boot/config-2.6.3. We will load this configuration and then do the changes we desire. If you do not have the config file of a working kernel 2.6 this one might help you.
    It is normally a good idea to take the configuration of your existing (working!) kernel 2.6 as a starting point for the configuration of your new kernel. Usually the current kernel configuration is saved in a file under /boot, e.g. /boot/config-2.6.3. We will load this configuration and then do the changes we desire. If you do not have the config file of a working kernel 2.6 this one might help you.


    make menuconfig
    make menuconfig


    Select Load an Alternate Configuration File and enter the location of the configuration file of your current kernel (or upload my kernel configuration to your machine and enter its path):
    Select Load an Alternate Configuration File and enter the location of the configuration file of your current kernel (or upload my kernel configuration to your machine and enter its path):
    Line 32: Line 33:
    Then run the following commands (please note that make dep is not needed any more for kernel 2.6):
    Then run the following commands (please note that make dep is not needed any more for kernel 2.6):


    make-kpkg clean
    make-kpkg clean
    fakeroot make-kpkg --initrd --revision=custom.1.0 kernel_image !!!INSERT --INITRD
    fakeroot make-kpkg --initrd --revision=custom.1.0 kernel_image !!!INSERT --INITRD


    If the compilation stops with an error, run
    If the compilation stops with an error, run


    make clean
    make clean


    and then re-run the previous commands starting with
    and then re-run the previous commands starting with


    make menuconfig
    make menuconfig


    Change the kernel configuration where the error occurs. If no error occurs you will find the new kernel as a Debian package called kernel-image-2.6.8.1_custom.1.0_i386.deb under /usr/src.
    Change the kernel configuration where the error occurs. If no error occurs you will find the new kernel as a Debian package called kernel-image-2.6.8.1_custom.1.0_i386.deb under /usr/src.


    cd ../
    cd ../


    Now you have to install some packages that are needed by kernel 2.6. Add the following line to /etc/apt/sources.list:
    Now you have to install some packages that are needed by kernel 2.6. Add the following line to /etc/apt/sources.list:


    deb http://www.backports.org/debian/ woody module-init-tools initrd-tools procps
    deb http://www.backports.org/debian/ woody module-init-tools initrd-tools procps


    Then run:
    Then run:


    apt-get update
    apt-get update
    apt-get install module-init-tools initrd-tools procps
    apt-get install module-init-tools initrd-tools procps


    If you are asked the following question:
    If you are asked the following question:
    Line 60: Line 61:
    "If you really want to remove modutils type 'yes':"
    "If you really want to remove modutils type 'yes':"


    type yes.
    type yes.


    It might also be necessary to update packages like bind9, quota, etc. - depending on your configuration. If you have problems with your existing packages try to get the appropriate package from www.backports.org.
    It might also be necessary to update packages like bind9, quota, etc. - depending on your configuration. If you have problems with your existing packages try to get the appropriate package from www.backports.org.
    Line 66: Line 67:
    Install your new kernel:
    Install your new kernel:


    dpkg -i kernel-image-2.6.8.1_custom.1.0_i386.deb
    dpkg -i kernel-image-2.6.8.1_custom.1.0_i386.deb

    </pre>


    you don'need to do this, because if you put --initrd as an option to make-kpkg, it will generated automatically for you
    you don'need to do this, because if you put --initrd as an option to make-kpkg, it will generated automatically for you

    --------
    --------


    Create a ramdisk of your new kernel (otherwise your system will most likely not boot):
    Create a ramdisk of your new kernel (otherwise your system will most likely not boot):


    cd /boot/
    cd /boot/
    mkinitrd -o initrd.img-2.6.8.1 2.6.8.1
    mkinitrd -o initrd.img-2.6.8.1 2.6.8.1






    dont need this, better use bootload grub instead !
    dont need this, better use bootload grub instead !

    -----
    -----

    We are almost finished now. Edit the image=/vmlinuz stanza of your /etc/lilo.conf and add the line initrd=/boot/initrd.img-2.6.8.1:
    We are almost finished now. Edit the image=/vmlinuz stanza of your /etc/lilo.conf and add the line initrd=/boot/initrd.img-2.6.8.1:


    <pre>
    # Boot up Linux by default.
    # Boot up Linux by default.
    #
    #
    Line 94: Line 97:
    # restricted
    # restricted
    # alias=1
    # alias=1
    </pre>


    Run
    Run


    lilo
    lilo


    to update your boot loader and reboot your machine:
    to update your boot loader and reboot your machine:


    shutdown -r now
    shutdown -r now


    and if everything is ok your machine should come up with the new kernel. You can run
    and if everything is ok your machine should come up with the new kernel. You can run


    uname -a
    uname -a


    [[Category:Linux]]
    [[Category:English]]
    [[Category:Debian]]

    Latest revision as of 07:09, 6 July 2005

    taken from [1]

    Kernel-Compile-Howto

    First login to your Debian machine on the command line as root.

    Install the prerequisites that we need to compile the new kernel:

    apt-get install kernel-package ncurses-dev fakeroot wget bzip2
    

    Then go to /usr/src:

    cd /usr/src
    

    Then get the latest Linux kernel source (or the kernel source you need) from http://www.kernel.org/pub/linux/kernel/v2.6/:

    wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.8.1.tar.bz2
    

    Unpack the kernel sources:

    tar xjf linux-2.6.8.1.tar.bz2
    
    cd linux-2.6.8.1/
    

    It is normally a good idea to take the configuration of your existing (working!) kernel 2.6 as a starting point for the configuration of your new kernel. Usually the current kernel configuration is saved in a file under /boot, e.g. /boot/config-2.6.3. We will load this configuration and then do the changes we desire. If you do not have the config file of a working kernel 2.6 this one might help you.

    make menuconfig
    

    Select Load an Alternate Configuration File and enter the location of the configuration file of your current kernel (or upload my kernel configuration to your machine and enter its path):

    The configuration of your current kernel will be loaded, and you can now browse through the menu and change the configuration to suit your needs. When you are finished, save your new kernel configuration:

    Then run the following commands (please note that make dep is not needed any more for kernel 2.6):

    make-kpkg clean
    fakeroot make-kpkg --initrd --revision=custom.1.0 kernel_image !!!INSERT --INITRD
    

    If the compilation stops with an error, run

    make clean
    

    and then re-run the previous commands starting with

    make menuconfig
    

    Change the kernel configuration where the error occurs. If no error occurs you will find the new kernel as a Debian package called kernel-image-2.6.8.1_custom.1.0_i386.deb under /usr/src.

    cd ../
    

    Now you have to install some packages that are needed by kernel 2.6. Add the following line to /etc/apt/sources.list:

    deb http://www.backports.org/debian/ woody module-init-tools initrd-tools procps
    

    Then run:

    apt-get update
    apt-get install module-init-tools initrd-tools procps
    

    If you are asked the following question:

    "If you really want to remove modutils type 'yes':"

    type yes.
    

    It might also be necessary to update packages like bind9, quota, etc. - depending on your configuration. If you have problems with your existing packages try to get the appropriate package from www.backports.org.

    Install your new kernel:

    dpkg -i kernel-image-2.6.8.1_custom.1.0_i386.deb
    


    you don'need to do this, because if you put --initrd as an option to make-kpkg, it will generated automatically for you


    Create a ramdisk of your new kernel (otherwise your system will most likely not boot):

    cd /boot/
    mkinitrd -o initrd.img-2.6.8.1 2.6.8.1
    


    dont need this, better use bootload grub instead !


    We are almost finished now. Edit the image=/vmlinuz stanza of your /etc/lilo.conf and add the line initrd=/boot/initrd.img-2.6.8.1:

    # Boot up Linux by default.
    #
    default=Linux
    
    image=/vmlinuz
            label=Linux
            read-only
            initrd=/boot/initrd.img-2.6.8.1
    #        restricted
    #        alias=1
    

    Run

    lilo
    

    to update your boot loader and reboot your machine:

    shutdown -r now
    

    and if everything is ok your machine should come up with the new kernel. You can run

    uname -a
    
    Cookies help us deliver our services. By using our services, you agree to our use of cookies.
    Cookies help us deliver our services. By using our services, you agree to our use of cookies.