What tools are essential for building a new linux kernel?

Hello friends
can i make my own linux kernel for my acadmic project, if yes then what tools are i need and your suggestions.
Thank you

Replies

  • Abhishek Rawal
    Abhishek Rawal
    1) Linux desktop
    2) Dependencies as follows :
    xmlto, kmod, bc, inetutils, docbook-xsl, coreutils, linux-firmware, mkinitcpio, modeprobed-db, make, base-devel, libncurses, libncurses-devel
    3) Go to The Linux Kernel Archives and download the tarball of the kernel version you want. Here, I will use latest stable 4.3
    wget -c #-Link-Snipped-#
    4) Verify kernel sig from Linux kernel releases PGP signatures [Optional but smart thing to do]
    5) mkdir -p mykernel
    6) cp linux-4.3.tar.xz ~/mykernel/
    7) tar -xvJf linux-4.3.tar.xz
    8) cd linux-4.3
    9) make mrproper (to verify kernel tree is clean or not)

    This was all basic and simple task, crucial part is build configuration. However, since you're new into this, I won't recommend configuring trimmed version of linux kernel as per your system. Rather than you can use .config from your running kernel.

    zcat /proc/config.gz > running.config
    Actually, if you wanna try making your own config simply cd into kernel directory and type :
    make nconfig
    (Modern approach)
     make menu-config 
    (Traditional)

    Now configure it as per your requirement, remember this will generate new .config.

    The compilation time varies from 10 minutes to hours, depending on the system on which you're compiling and the make flags you're using. You can even move directory to tmpfs to reduce compiling time.

    Now, run
     make 
     sudo make modules_install 
    You'll able to see compiled modules in /lib/modules/yourkernel directory

    Now, copy the kernel to /boot directory and make initial RAM disk
    mkinitcpio -k skynetkernel -c /etc/mkinitcpio.conf -g /boot/initramfs-skynetkernel.img
    Note : You can change 'skynetkernel' to anything you want. I love cybernetic organism so I use skynet.

    Joke apart, now update the grub and reboot and see if your own compiled linux is working properly or not.
    When you use prebuilt kernel's .config, it actually works out of box, but that's not why we compile kernel, do we ?
    Making your own .config according to your hardware and purging the unnecessary modules will make slimmed down version of kernel will make an impact.

    On side note,apply this GitHub - graysky2/kernel_gcc_patch: legacy name with info to new name, you'll see performance improvement with your new optimized kernel.

    If you're stuck somewhere, feel free to ask queries. Cheers.
  • Jasim Chouhan
    Jasim Chouhan
    Thank you Abhishiek, you give me a lot of about linux kernel and now i am confident ,thanks again

You are reading an archived discussion.

Related Posts

Hello sir, i just read one of your responses to some CEian's querry, and i liked it so much i couldn't wait to ask one myself, hope you will respond....
after b.tech its very difficult to decide whether to opt for private or government sector?? In both sides you have to struggle a lot...
ISRO has released a free eBook about India's Space Journey, titled 'From Fishing Hamlet To Red Planet', edited by P.V. Manoranjan Rao along with associate editors B.N. Suresh and V.P....
Acer Liquid series of smartphones in India has just got two new entrants with Acer Liquid Z530 and Liquid Z630s launching amidst the festive season. Falling in two different budget...
TinyOwl is currently in the news for all the wrong reasons. It's laying off employees and the fired employees held the founders as hostages for several hours. Reason: the fired...