Loading ...
Sorry, an error occurred while loading the content.
 

How to compile linux kernel ?

Expand Messages
  • vin_vrs
    Hello guyz, i would like to know how to compile linux kernel ( v2.6.29 ). i did download the latest kernel from kernel.org. what next ? Thanks in advance.
    Message 1 of 9 , May 1, 2009
      Hello guyz,
      i would like to know how to compile linux kernel ( v2.6.29 ).
      i did download the latest kernel from kernel.org. what next ?

      Thanks in advance.
      Vinod
    • janeesh attri
      hi step follow  take tarball of kernel source code from  kernel.org  extracted it u also grt latest kernel version in linux 4 u magzine  cds ,  step top
      Message 2 of 9 , May 2, 2009
        hi
        step follow
         take tarball of kernel source code from  kernel.org  extracted it u also grt latest kernel version in linux 4 u magzine  cds ,
         step top extract if  kernel.tar.gz  -------- gunzip (kernelsource file)
         one thing u should extract source  in /usr/src/kernel /
        after that cd kernelversion

        run  command

        ./configure
        make
        make install

        after that change the grub.conf  as per as requirment of which version to run by changing defaults option in grub.cong


        --- On Fri, 5/1/09, vin_vrs <vinod.chum@...> wrote:
        From: vin_vrs <vinod.chum@...>
        Subject: [blug-prog] How to compile linux kernel ?
        To: linux-bangalore-programming@yahoogroups.com
        Date: Friday, May 1, 2009, 11:43 AM

















        Hello guyz,

        i would like to know how to compile linux kernel ( v2.6.29 ).

        i did download the latest kernel from kernel.org. what next ?



        Thanks in advance.

        Vinod































        [Non-text portions of this message have been removed]
      • Mayank
        ... If it is a native build - simpler yet. Get the existing .config from /usr/src/linux /.config and put it in the untarred kernel source.
        Message 3 of 9 , May 2, 2009
          >
          > Hello guyz,
          > i would like to know how to compile linux kernel ( v2.6.29 ).
          > i did download the latest kernel from kernel.org. what next ?
          >
          > Thanks in advance.
          >
          > Vinod
          >
          >

          If it is a native build - simpler yet. Get the existing .config from

          /usr/src/linux<version from uname>/.config

          and put it in the untarred kernel source. Then:

          make oldconfig # update the values for the newer kernel.
          make uImage
          make modules

          This is the easiest way to get started. If you want to customize -

          make menuconfig # you can use gconfig, xconfig, etc for GUI
          interface

          For a cross compile -

          make ARCH=xxx CROSS_COMPILE=toolchain- default_config_for_xxx # u can
          usually find under <linux-src>/arch/xxx/configs
          make ARCH=xxx CROSS_COMPILE=toolchain- uImage
          make ARCH=xxx CROSS_COMPILE=toolchain- modules
          make ARCH=xxx CROSS_COMPILE=toolchain-
          INSTALL_MOD_PATH=/home/mayank/workdir/filesys modules_install


          Had jotted down some really useful links on the blog -

          http://techydodo.wordpress.com/2008/07/17/wannabe_a_kernel_hacker/

          Hope this helps...

          --
          Have a nice day,
          Mynk

          http://ngopost.org/story.php?title=Food_wasted_is_a_life_wasted-1
          o__
          _> /__
          (_) \(_)... Burn fat not fuel - Byke along to a healthier life and cleaner world! :)
        • vishal.gnutech@gmail.com
          Hi There, *Step 1 *Download the kernel from below link ftp://ftp.kernel.org/pub/linux/kernel/v2.6 *Step 2* Extracting the kernel if its a archive with tar.gz
          Message 4 of 9 , May 4, 2009
            Hi There,

            *Step 1
            *Download the kernel from below link

            ftp://ftp.kernel.org/pub/linux/kernel/v2.6


            *Step 2*

            Extracting the kernel

            if its a archive with tar.gz extension then do below in your /usr/src

            # tar -zxvf linux-2.6.x.x.tar.gz

            If its a .tar.bz2 then do below in your /usr/src

            # tar -jxvf linux-2.6.x.x.tar.bz2


            *Step 3

            *You must have a folder now in your /usr/src dir with the name of
            linux-2.6.x.x just symlink it with dir linux

            # ln -sf linux-2.6.x.x linux

            Now change the dir to linux

            # cd linux

            once you are inside the dir issue any of the below commands to configure
            your new kernel

            # make menuconfig (This will show you a command line screen to configure
            the kernel)

            or

            # make xconfig (This will open up a qt based gui window to configure
            the kernel)


            Note : -- if you want to configure the new kernel same as of your old
            one then you just need to issue the below commands

            # make oldconfig && make modules_install && make install


            This will install your new kernel with the old config and also install
            the boot image and other files in your /boot

            *Step 4

            *I am assuming now that you have configured your new kernel and ready to
            compile it , just follow the below steps

            # make && make modules_install && make install





            *NOTE - i am assuming you are using grub here for that you need to
            select the option on boot for the new kernel

            lilo users - here comes my lilo.conf

            boot="/dev/hda"
            lba32
            prompt
            timeout="50"
            default=gentoo
            vga="792"

            image="/boot/kernel-2.6.18"
            label="gentoo"
            root="/dev/hda4"
            read-only
            # initrd="/boot/kernel-2.6.17"
            #root=/dev/ram0
            #append="init=/linuxrc real_root=/dev/hda4"

            image="/boot/kernel-2.6.20.3"
            label="2.6.20.3"
            root="/dev/hda4"
            read-only*
          • vinod
            Hi vishal, Firstly thanks for your info on how to compile linux kernel. The info that you passed on was very helpful , so for so good, everything went fine,
            Message 5 of 9 , May 4, 2009
              Hi vishal,

              Firstly thanks for your info on how to compile linux kernel.
              The info that you passed on was very helpful , so for so good,
              everything went fine,
              but im stuck at the second half of the step4, i would like to know
              how to boot my new
              kernel ( in other words the modifcations that are to be done to GRUB
              settings).

              Thanks in advance
              Vinod
              On Mon, May 4, 2009 at 1:12 PM, vishal.gnutech@... <
              vishal.gnutech@...> wrote:

              >
              >
              > Hi There,
              >
              > *Step 1
              > *Download the kernel from below link
              >
              > ftp://ftp.kernel.org/pub/linux/kernel/v2.6
              >
              > *Step 2*
              >
              > Extracting the kernel
              >
              > if its a archive with tar.gz extension then do below in your /usr/src
              >
              > # tar -zxvf linux-2.6.x.x.tar.gz
              >
              > If its a .tar.bz2 then do below in your /usr/src
              >
              > # tar -jxvf linux-2.6.x.x.tar.bz2
              >
              > *Step 3
              >
              > *You must have a folder now in your /usr/src dir with the name of
              > linux-2.6.x.x just symlink it with dir linux
              >
              > # ln -sf linux-2.6.x.x linux
              >
              > Now change the dir to linux
              >
              > # cd linux
              >
              > once you are inside the dir issue any of the below commands to configure
              > your new kernel
              >
              > # make menuconfig (This will show you a command line screen to configure
              > the kernel)
              >
              > or
              >
              > # make xconfig (This will open up a qt based gui window to configure
              > the kernel)
              >
              > Note : -- if you want to configure the new kernel same as of your old
              > one then you just need to issue the below commands
              >
              > # make oldconfig && make modules_install && make install
              >
              > This will install your new kernel with the old config and also install
              > the boot image and other files in your /boot
              >
              > *Step 4
              >
              > *I am assuming now that you have configured your new kernel and ready to
              > compile it , just follow the below steps
              >
              > # make && make modules_install && make install
              >
              > *NOTE - i am assuming you are using grub here for that you need to
              > select the option on boot for the new kernel
              >
              > lilo users - here comes my lilo.conf
              >
              > boot="/dev/hda"
              > lba32
              > prompt
              > timeout="50"
              > default=gentoo
              > vga="792"
              >
              > image="/boot/kernel-2.6.18"
              > label="gentoo"
              > root="/dev/hda4"
              > read-only
              > # initrd="/boot/kernel-2.6.17"
              > #root=/dev/ram0
              > #append="init=/linuxrc real_root=/dev/hda4"
              >
              > image="/boot/kernel-2.6.20.3"
              > label="2.6.20.3"
              > root="/dev/hda4"
              > read-only*
              >
              >


              [Non-text portions of this message have been removed]
            • vishal.gnutech@gmail.com
              Dear Vinod, make && make modules_install && make install if you see make install in the end it installs the kernel and put the image in boot partition now if
              Message 6 of 9 , May 5, 2009
                Dear Vinod,

                make && make modules_install && make install if you see make install in
                the end it installs the kernel and put the image in boot partition now
                if you reboot your system grub will show you the installed kernel
                versions and you can select your kernel which you have just
                compiled.Also in few distros it boots too fast so while you are
                rebooting your system press down arrow key and it will show you the
                option.Laters if your new kernel is working fine you can remove your old
                kernel. and use the new one.

                Regards
              • Mayank
                If you are compiling the kernel for use on your local machine the following link is pretty good - http://www.howtoforge.com/kernel_compilation_ubuntu specific
                Message 7 of 9 , May 5, 2009
                  If you are compiling the kernel for use on your local machine the
                  following link is pretty good -

                  http://www.howtoforge.com/kernel_compilation_ubuntu

                  specific to Ubuntu but most things should apply to the other distros.

                  --
                  Have a nice day,
                  Mynk

                  http://ngopost.org/story.php?title=The_Sunfeast_World_10K_Run_Bangalore_2009_-_Run_Maadi_Run
                  o__
                  _> /__
                  (_) \(_)... Burn fat not fuel - Byke along to a healthier life and cleaner world! :)
                • vinod
                  Dear Friends, Thanks for your constant support and your valuable inputs, which helped me a lot in compilation of kernel. Finally i have managed to compile the
                  Message 8 of 9 , May 9, 2009
                    Dear Friends,

                    Thanks for your constant support and your valuable inputs, which helped me a
                    lot in
                    compilation of kernel. Finally i have managed to compile the linux kernel.
                    I would try to explore much more with the linux and its environment.

                    Thank you
                    Vinod

                    On Tue, May 5, 2009 at 7:31 AM, vishal.gnutech@... <
                    vishal.gnutech@...> wrote:

                    >
                    >
                    > Dear Vinod,
                    >
                    > make && make modules_install && make install if you see make install in
                    > the end it installs the kernel and put the image in boot partition now
                    > if you reboot your system grub will show you the installed kernel
                    > versions and you can select your kernel which you have just
                    > compiled.Also in few distros it boots too fast so while you are
                    > rebooting your system press down arrow key and it will show you the
                    > option.Laters if your new kernel is working fine you can remove your old
                    > kernel. and use the new one.
                    >
                    > Regards
                    >
                    >
                    >


                    [Non-text portions of this message have been removed]
                  • Mayank
                    ... One of the things I discovered recently and was looking for quite sometime was a single place with all the kernel API. The best Documentation can be found
                    Message 9 of 9 , May 12, 2009
                      >
                      > Dear Friends,
                      >
                      > Thanks for your constant support and your valuable inputs, which
                      > helped me a
                      > lot in
                      > compilation of kernel. Finally i have managed to compile the linux kernel.
                      > I would try to explore much more with the linux and its environment.
                      >

                      >
                      >

                      One of the things I discovered recently and was looking for quite
                      sometime was a single place with all the kernel API. The best
                      Documentation can be found in the Linux sources itself.

                      You can run the following command in the source directory to generate
                      the DocBook:

                      make ARCH=xxx CROSS_COMPILE=xxx-linux- *htmldocs

                      *or simly

                      *make htmldocs* # for a native build
                      *
                      *A folder - DocBook is generated under <linux-src>/Documentation. This
                      contains a lot of folders one being kernel API. Havent' explored the
                      others but the API one I found pretty useful when writing drivers.

                      --
                      Have a nice day,
                      Mynk

                      http://ngopost.org/story.php?title=Mirakles_do_happen
                      o__
                      _> /__
                      (_) \(_)... Burn fat not fuel - Byke along to a healthier life and cleaner world! :)
                    Your message has been successfully submitted and would be delivered to recipients shortly.