Results 1 to 6 of 6

Thread: How to compile a new Kernel for the Linux?

  1. #1
    Senior Member
    Join Date
    Aug 2006
    Location
    India
    Posts
    289

    How to compile a new Kernel for the Linux?

    I am trying to compile a new linux kernel. The first thing I would like to tell that I am doing all experiments on a virtual environment with a snapshot already taken. So I am not in a problem with my data or anything.

    I have done some preliminary steps.

    I have taken the kernel source from the host system. The version is 2.6.22.5 (from openSuSE 10.3). Here is what I have done:

    But at the second step when I pass the command

    make bZimage

    the following error is displayed:
    Code: make: *** No rule to make target `bZimage'. Stop.

    I am showing you a part of the commands I pass and what it shows. Hope that helps:
    Code:

    linux-virtual:/home/trojan/linux-2.6.22.5-31 # make xconfig
    scripts/kconfig/qconf arch/i386/Kconfig
    #
    # configuration written to .config
    #
    linux-virtual:/home/trojan/linux-2.6.22.5-31 # make bZimage
    HOSTLD scripts/kconfig/conf
    scripts/kconfig/conf -s arch/i386/Kconfig
    make: *** No rule to make target `bZimage'. Stop.
    linux-virtual:/home/trojan/linux-2.6.22.5-31 #

    What could be the error? How do I make the RULES for making the kernel.

    I have also done some more steps. They are here. Can someone tell me how to compile the kernel?
    "Everything should be made as simple as possible, but not simpler."

    - Albert Einstein

  2. #2
    AO Curmudgeon rcgreen's Avatar
    Join Date
    Nov 2001
    Posts
    2,716
    Try bzImage instead of bZimage
    I came in to the world with nothing. I still have most of it.

  3. #3
    Senior Member
    Join Date
    Aug 2006
    Location
    India
    Posts
    289
    Well Thanks for the reply. Yes, I have been able to makew up the kernel and make th modules and install the modules. Now I need to make the initrd. Will the old one do or I will have to make new one? If yes, then what command do I need for that?
    "Everything should be made as simple as possible, but not simpler."

    - Albert Einstein

  4. #4
    Senior Member Maestr0's Avatar
    Join Date
    May 2003
    Posts
    604
    You need an initrd if the modules required to pivot root to your root device are not statically compiled in the kermel. eg. If your root drive is an Nvidia SATA the nvsata needs to be compiled in, if your root fs is resierfs, then reiserfs needs to be compiled in. If you do not include ALL the required modules in the kernel than you must create an initial ramdisk (initrd) that will allow the kernel to load the modules dynamically in order to locate and access the root filesystem, this is easier for most people since statically compiling them in requires you to understand your hardware and the associated linux modules in detail, whereas the initrd tools generally determine what is required for you. There is more than on way to create an initrd, in SuSE I imagine you will need the 'mkinitrd' package installed (check yast) I assume it works properly now although 'mkinitrd' had trouble with udev in the past, other options are 'yaird' (yet another initial ramdisk) and 'mkinitramfs'. The syntax for these tools are all fairly simliar. An example would be:

    mkinitrd -o /boot/initrd.img-2.6.22.5.img 2.6.22.5

    This tells initrd to create the output file in /boot and then specifies the kernel version. The initrd program will check the modules in /lib/modules/{kernel version} (2.6.22.5 in this case) for the proper modules, assuming you have done a 'make modules_install' from your kernel source directory. you must then update GRUB to make sure the initrd is passed at boot time from grub. The command 'update-grub' will add your new kernel to your /boot/grub/menu.list but you should go check that file and insure there is a line pointing to your initrd as sometimes the update command will not add this for you. (I think you need to name it exactly the way grub likes it, the above example is probably close but check the naming convention of existing initrd's in /boot) If the entry under 'kernel' is not a line for your initrd add it in. (You should see the syntax from the previous entry) Hope this helps.

    -Maestr0
    \"If computers are to become smart enough to design their own successors, initiating a process that will lead to God-like omniscience after a number of ever swifter passages from one generation of computers to the next, someone is going to have to write the software that gets the process going, and humans have given absolutely no evidence of being able to write such software.\" -Jaron Lanier

  5. #5
    Senior Member
    Join Date
    Aug 2006
    Location
    India
    Posts
    289
    Well, Thanks a lot for the reply Maestr0.

    Well, I use ext3 filesystem. I have got SATA hard drives connected to a ASUS Motherboard. Other things like RAM and Sound Card etc fall under standard devices. They are detected by most distros with kernel 2.6.8 or above. I have no graphics card. I have added all the required modules. I had first compiled the kernel then I did

    make modules

    and then

    make modules_install

    I think that the modules were added separately. Are they installed directly to the kernel or do they needed to be loaded separately?

    And yes, I am trying to make the new kernel coexist with the old one. I just want to test the new kernel. Actually this is just a learning process I am using on the VirtualBox. I am trying to learn the actual compilation process so that I could use that on my real system in the future if needed.
    "Everything should be made as simple as possible, but not simpler."

    - Albert Einstein

  6. #6
    Senior Member
    Join Date
    Aug 2006
    Location
    India
    Posts
    289
    OK, So I created the kernel and I loaded it (added to menu.lst and booted from it). It complains that device hda1 was not found! the mesage is from the kernel and not from the grub?

    mkinitrd compains that kernel version 2.6.22.5-31 was not found! What may be the cause?
    "Everything should be made as simple as possible, but not simpler."

    - Albert Einstein

Similar Threads

  1. Which version of Linux to use
    By gore in forum Operating Systems
    Replies: 83
    Last Post: June 1st, 2017, 01:33 PM
  2. Installing SUSE Linux 9.1 Professional
    By gore in forum Other Tutorials Forum
    Replies: 12
    Last Post: May 18th, 2005, 04:58 AM
  3. Linux VS BSD (Funny and true/Old)
    By gore in forum Operating Systems
    Replies: 0
    Last Post: September 2nd, 2004, 07:14 AM
  4. suse is crap on finding cdrom
    By rajunpl in forum Operating Systems
    Replies: 43
    Last Post: July 1st, 2004, 07:30 AM
  5. Security flaws force Linux kernel upgrade
    By SDK in forum *nix Security Discussions
    Replies: 2
    Last Post: January 7th, 2004, 02:25 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •