View previous topic :: View next topic |
Author |
Message |
wuya Apprentice
Joined: 16 Apr 2005 Posts: 195
|
Posted: Sat Jan 14, 2006 12:03 pm Post subject: [SOLVED] How do I recompile kernel? |
|
|
I am currently trying to get ALSA to work. I just finished modifying menuconfig and need to recompile the kernel. I am a newbie and the ALSA guide didn't say how to recompile. So how do I?
Last edited by wuya on Sun Jan 15, 2006 12:47 am; edited 1 time in total |
|
Back to top |
|
|
lnxz Guru
Joined: 03 Jul 2005 Posts: 472 Location: Earth
|
Posted: Sat Jan 14, 2006 12:14 pm Post subject: |
|
|
Copy the modified config to somewhere safe, then run make mrproper inside the kernel source tree, move the config back and run
Code: | make && make modules_install |
then copy the necessary files to /boot.
Make sure the kernel entry in grub.conf corresponds with the kernel image. |
|
Back to top |
|
|
wuya Apprentice
Joined: 16 Apr 2005 Posts: 195
|
Posted: Sat Jan 14, 2006 12:20 pm Post subject: |
|
|
Sorry, I didn't understand very well. Would you or someone else please explain it in more details? Again, I am a newbie. This is my first time trying to get ALSA to work.
Quote: | Copy the modified config to somewhere safe, |
Where would be considered "safe"?
Quote: | then run make mrproper inside the kernel source tree, |
Where is this "kernel source tree" and how do I get there?
Quote: | then copy the necessary files to /boot. |
What would the "necessary files" be? |
|
Back to top |
|
|
lnxz Guru
Joined: 03 Jul 2005 Posts: 472 Location: Earth
|
Posted: Sat Jan 14, 2006 1:13 pm Post subject: |
|
|
The kernel source tree is the folder where the kernel sources reside.
Usually /usr/src/linux-<something>.
"Safe" would be outside the kernel source tree, as make mrproper will clean it out (also deleting the config).
Only the kernel image is really necessary (this actually depends on your setup) to copy over to /boot.
or me the kernel image is: /usr/src/<linux-source>/arch/i386/boot/bzImage. |
|
Back to top |
|
|
wuya Apprentice
Joined: 16 Apr 2005 Posts: 195
|
Posted: Sat Jan 14, 2006 9:07 pm Post subject: |
|
|
Okay, let me run this through just to be sure.
After modifying menuconfig.
1. I move /usr/src/linux-<something> to a safe place. My home folder, okay?
2. Then run make mrproper in /usr/src/linux-<something>.
3. Copy /usr/src/<linux-source>/arch/i386/boot/bzImage to /boot.
4. Make sure grub.conf's kernel version matches the bzImage's that I copy over.
5. Reboot.
All correct? |
|
Back to top |
|
|
lnxz Guru
Joined: 03 Jul 2005 Posts: 472 Location: Earth
|
Posted: Sat Jan 14, 2006 9:37 pm Post subject: |
|
|
wuya wrote: | Okay, let me run this through just to be sure.
After modifying menuconfig.
1. I move /usr/src/linux-<something>
|
That would be /usr/src/linux-<something>/.config.
Home folder should be safe enough, and then some.
wuya wrote: |
2. Then run make mrproper in /usr/src/linux-<something>.
|
Yup.
wuya wrote: |
3. Copy /usr/src/<linux-source>/arch/i386/boot/bzImage to /boot.
|
Well, first you'd need to copy back the config and compile the kernel.
The reason for running make mrproper is to clean out old files, ensuring a clean compile.
To compile the kernel, run
Code: | make && make modules_install |
inside the kernel source tree.
I could be wrong about this, but I think there are more steps involved if you're using one of the older kernel series (below 2.6), but I can't remember how far back one has to go for the above set of commands not to work.
wuya wrote: |
4. Make sure grub.conf's kernel version matches the bzImage's that I copy over.
|
Well, you need to be sure that the name of the kernel in grub.conf corresponds with the newly copied kernel image.
Example:
If you do
Code: | cp /usr/src/linux/arch/i386/boot/bzImage /boot/kernel-2.6 |
then the kernel entry in grub.conf would look something like this:
Code: |
title linux-2.6
root (hd0,0)
kernel (hd0,0)/kernel-2.6
|
(the third line is the important one.)
Yes.
Be sure to tell grub to choose the right kernel, though, so you don't end up booting into your old one.
You should probably put the newest kernel's entry above all other entries in grub.conf, so that grub will automaticly choose it (unless you've specified otherwise).
If this doesn't work for some reason, then your system differs from mine in a way that's incompatible with this approach.
In that case I guess you just have to wait for someone more skilled than me.
Using google or reading documentation won't hurt either.
The latter one is advisable no matter the outcome. |
|
Back to top |
|
|
wuya Apprentice
Joined: 16 Apr 2005 Posts: 195
|
Posted: Sat Jan 14, 2006 10:12 pm Post subject: |
|
|
Something went wrong. I tried to open /boot/grub/grub.conf to check, but it was empty. So I looked into the /boot folder, and there was nothing in there! Other than the bzImage I copied there.
Am I in big trouble here? |
|
Back to top |
|
|
lnxz Guru
Joined: 03 Jul 2005 Posts: 472 Location: Earth
|
Posted: Sat Jan 14, 2006 10:18 pm Post subject: |
|
|
Sounds to me you haven't mounted the boot partition.
should do it.
Remember that the bzimage won't be there, as it will be "hidden" under the real boot folder, so you probably want to move it out of /boot before mounting. |
|
Back to top |
|
|
reub2000 Guru
Joined: 31 Jan 2004 Posts: 364
|
Posted: Sat Jan 14, 2006 10:32 pm Post subject: |
|
|
Why does he need to do mrproper? Wouldn't 'make clean' suffice? In fact he probably wouldn't even need to do that if he just added stuff to the kernel. Could probably just do "make bzImage && make modules && make modules_install" to only compile what he added. |
|
Back to top |
|
|
lnxz Guru
Joined: 03 Jul 2005 Posts: 472 Location: Earth
|
Posted: Sat Jan 14, 2006 11:06 pm Post subject: |
|
|
Force of habit on my part.
make clean && make && make modules_install is probably enough.
make bzimage and make modules I think are redudant, at least I've never used them, and I've built several kernels (as I tend to screw things up).
Haven't really timed or played much around with it, but for me mrproper and clean/distclean don't differ much in execution time and they all seem to get the job done.
Cleaning here is probably, as you point out, redundant altogether, though. |
|
Back to top |
|
|
wuya Apprentice
Joined: 16 Apr 2005 Posts: 195
|
Posted: Sun Jan 15, 2006 12:46 am Post subject: |
|
|
ALSA working! Thanks everyone. You been very helpful. |
|
Back to top |
|
|
reub2000 Guru
Joined: 31 Jan 2004 Posts: 364
|
Posted: Sun Jan 15, 2006 1:11 am Post subject: |
|
|
lnxz wrote: | Force of habit on my part.
make clean && make && make modules_install is probably enough.
make bzimage and make modules I think are redudant, at least I've never used them, and I've built several kernels (as I tend to screw things up).
Haven't really timed or played much around with it, but for me mrproper and clean/distclean don't differ much in execution time and they all seem to get the job done.
Cleaning here is probably, as you point out, redundant altogether, though. | So does make by itself do the same thing as 'make bzImage && make modules'? |
|
Back to top |
|
|
lnxz Guru
Joined: 03 Jul 2005 Posts: 472 Location: Earth
|
Posted: Sun Jan 15, 2006 9:09 am Post subject: |
|
|
Yes. |
|
Back to top |
|
|
|