LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Kernel compile - Please clarify (https://www.linuxquestions.org/questions/linux-newbie-8/kernel-compile-please-clarify-263321/)

ksun 12-06-2004 02:58 PM

Kernel compile - Please clarify
 
I have read a lot of threads and done a lot of googling to find a difinitive answer, but the more I read, the further I am confused.

Some methods say "Do 1, 2, 3, 4 ..." some say "Don't do 2, but do 1, 3, 4 ..." and I am mega-confused (and can't compile a kernel without errors, but that isn't what I want to address in this thread.

Will you all help me understand when and if you need to do each of these steps when doing a kernel compile. For the purposes of this thread, let's please just assume you are NOT doing a kernel upgrade, but perhaps something simple like adding NTFS as a module or something. I'm not really looking for best practices on whether to compile as a user or with root either.

(assuming you have been able to get the kernel sources to /usr/src/linux-2.x)

make mrproper (seems like you only have to do this once, ever)
Copy the .config file from /boot/config-xxx to your source dircetory
make oldconfig (seems like you only do this if you did above step)
make xconfig, gconfig, menuconfig take your pick
make dep (unnecessary in 2.6 kernel)
make clean
make
make bzImage
make modules
make modules_install
make install

Mara 12-06-2004 04:56 PM

First it depends which kernel version you're compiling. For 2.4 it's different than in 2.6 (more things are automatic).

make mrproper (seems like you only have to do this once, ever) - I never do it and it still works :)

Copy the .config file from /boot/config-xxx to your source dircetory - OK
make oldconfig (seems like you only do this if you did above step) - nope. It's one of the veriants: oldconfig, xconfig and so on
make xconfig, gconfig, menuconfig take your pick
make dep (unnecessary in 2.6 kernel) - correct
make clean - if you have just unpacked your kernel, you don't need it. Use if you'd like to clean your previous compilation.
make - Yes, in 2.6 it's equal to make bzImage in 2.4, but don't use in 2.4
make bzImage - In 2.4, instaead of make
make modules - In 2.6 it's a part of 'make' if I remember correctly
make modules_install - Yes
make install - Be careful. It overwrites your current kernel. Use ONLY when you're sure your new compilation will work. If you're not sure, copy the kernel manually and add to bootloader menu, so you're able to boot both versions.

ksun 12-06-2004 05:28 PM

So why is recompiling the kernel so darned complicated? Isn't there some solution for automating more of this process that would still allow you to make it fairly flexible?

I am not exactly a newbie, but not advanced enough to take this on yet, but it seems to me that you could write a script which would query the kernel version, look for the sources, bring up the xconfig or gconfig menu and save the changes, make the whole mess, ask to replace or install the new kernel next to the old one, and then update your boot loader based on the previous answer.

Why hasn't anyone done this? And included it in the kernel distribution?


All times are GMT -5. The time now is 04:26 PM.