LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Using a custom kernel (https://www.linuxquestions.org/questions/linux-general-1/using-a-custom-kernel-570275/)

der_11 07-17-2007 10:23 PM

Using a custom kernel
 
I have just compiled a custom kernel for my personal use and so far I have it running from the /boot directory in my Xubuntu root partition.

I have partitioned my system as so:

/dev/hda1 swap 1Gb
/dev/hda2 ext2 30Gb (Xubuntu)
/dev/hda3 ext2 15Gb (Debian)
/dev/hda4 ext2 15Gb (Slackware)

The problem is they all run off of a different kernel. What I would like is to have each distro run off the kernel I compiled. I just have no idea on how to accomplish this.

I'm using the grub boot loader. If that makes a difference.

Thanks in advance.

gilead 07-17-2007 10:35 PM

IIRC a kernel knows what the root filesystem is from the environment that it was compiled in so you probably can't use the same kernel file to boot each distro. You should be able to take the .config file and use it to build a kernel in each of the distros that you have installed. Then you just need to add the entries to grub so they can be booted.

jschiwal 07-17-2007 11:32 PM

It would be easier to do that if you had a common /boot partition. However, you could alter your menu.lst file for the other distro's so that they use the same kernel and initrd file.

Change the entries from something like this:
Code:

title openSUSE 10.2 - 2.6.18.8-0.5
    root (hd0,4)
    kernel /boot/vmlinuz-2.6.18.8-0.5-default root=/dev/hda5 vga=791 nolapic resume=/dev/hda2 splash=silent showopts elevator=
    initrd /boot/initrd-2.6.18.8-0.5-default

To something like this:
Code:

title openSUSE 10.2 - 2.6.18.8-0.5
    root (hd0,4)
    kernel (hd0,2)/boot/vmlinuz-2.6.18.8-0.5-default root=/dev/hda5 vga=791 nolapic resume=/dev/hda2 splash=silent showopts elevator=
    initrd (hd0,2)/boot/initrd-2.6.18.8-0.5-default

That way, the kernel will be loaded from the partition on /dev/hda3 even though the root directory is on /dev/hda5 (in this hypothetical example). If the boot directory is mounted on its own partition, then the entries would look more like:
Code:

title openSUSE 10.2 - 2.6.18.8-0.5
    root (hd0,4)
    kernel (hd0,2)/vmlinuz-2.6.18.8-0.5-default root=/dev/hda5 vga=791 nolapic resume=/dev/hda2 splash=silent showopts elevator=
    initrd (hd0,4)/initrd-2.6.18.8-0.5-default

Also, only run grub-config when using the same distro. That way you don't keep changing the MBR and using a different menu.lst file. You can cut & paste the menu.lst sections you need from the other disto's to the /boot/grub/menu.lst file that you use, and then edit the kernel & initrd entries.


All times are GMT -5. The time now is 04:27 AM.