View previous topic :: View next topic |
Author |
Message |
yokem55 Guru
Joined: 18 Apr 2002 Posts: 360 Location: Oregon
|
Posted: Mon Mar 03, 2003 9:04 am Post subject: |
|
|
Q11. I've never compiled a kernel before and I'm totally lost. Are there any good guides? How do I get information about what all these options mean?
First of all, don't be worried about feeling lost. Building your own kernel is a challenging experience, but fortunately there are a lot of resources available to help you through the process.
Probably the definitive guide to getting started with building your own kernel is the Linux Documentation Project's Linux Kernel HOWTO located here. Alternatively, Linux Planet has a good guide for building a kernel located here.
If you are looking for information on what all of the options mean, you can find a brief description of each option in the kernel menuconfig screen by selecting an option and then then pressing the "h" key. Many times these brief descriptions will refer to documents outside of the kernel configuration screen which can be found in your /usr/src/linux/Documentation folder. |
|
Back to top |
|
|
yokem55 Guru
Joined: 18 Apr 2002 Posts: 360 Location: Oregon
|
Posted: Mon Mar 03, 2003 9:42 am Post subject: |
|
|
Q13. I just installed a new kernel and now I'm getting a panic at boot time trying to mount the root partition. How do I fix this?
This is a fairly common problem that is caused by the kernel not having the necessary drivers built into the kernel for using the disk controller, recognizing your hard drive itself, and accessing the filesystem on the root partion.
To fix this, first follow the directions in Kernel Compilation FAQ 1 on booting your system when your default kernel doesn't work. Once your system is up and running again, enter the base directory of your kernel tree at /usr/src/linux.
Type: as usual to bring up the kernel configuration menu.
If your root partition is on an ide drive, you will need to make sure you have support for your ide controller built into the kernel. To do this select the "ATA/IDE/MFM/RLL support --->" menu and press enter. Then select "<*> ATA/IDE/MFM/RLL support" and say yes. Then, select yes to the following options:
<*> Enhanced IDE/MFM/RLL disk/cdrom/tape/floppy support
<*> Include IDE/ATA-2 DISK support
[*] Use multi-mode by default
[*] Generic PCI IDE chipset support
[*] Sharing PCI IDE interrupts support
[*] Generic PCI bus-master DMA support
You will then also need to say yes to whichever ide disk controller support option applies to the disk controller that is running the hard drive with your root partition on it. If you are in doubt about which controller support to choose, you can simply say yes to all of the disk controller support options. If any of the bugfix/support options apply to your system, be sure to say yes to those options as well. None of these options should be built as modules. The options specific to cdrom support, can however be built as modules.
If your root partion is on a SCSI device, from the root menuconfig menu select "SCSI support --->" and say yes "<*>" to "SCSI support". Then say yes to "<*> SCSI disk support (NEW)". Then under the "SCSI low-level drivers --->" menu select the scsi controller driver that applies to your scsi controller and say yes to that option.
Now, we need to make sure you have support for your root filesystem built into the kernel. From the menuconfig root menu, select the "File systems --->" menu. Then, select yes to the filesystem that you formated your root partition with. Most recent kernels should have full support for ext2, ext3, reiserfs, and jfs. If you need xfs filesystem support you will need to make sure that you have a kernel installed with xfs support. Your best bet for an xfs supporting filesystem is the xfs-sources kernel.
Now, make any other changes the kernel you might have been wanting to make, and select exit and save your new kernel configuration. Then make and install your new kernel as usual. |
|
Back to top |
|
|
ebichu Apprentice
Joined: 03 Jul 2002 Posts: 231 Location: Manchester, England
|
Posted: Mon Mar 03, 2003 3:44 pm Post subject: |
|
|
_SkeLeToN_ wrote: | Is there a way when you select the the kernel you want at boot to change the symlink for /usr/src/linux with the one you choose on boot ?? |
I do it during system boot. I add the following to /etc/conf.d/local.start:
Code: | echo "Setting /usr/src/linux link"
/usr/local/bin/ln_linux |
This is the /usr/local/bin/ln_linux script run by the above:
Code: | #! /bin/bash
rel="`uname -r`"
buildlink="/lib/modules/$rel/build"
link="/usr/src/linux"
linkdir="`dirname $link`"
linkname="`basename $link`"
if [ ! -L "$link" ]; then
echo "$link: not a symlink, so cannot change it" 1>&2
exit 1
fi
if [ ! -L "$buildlink" ]; then
echo "$buildlink: not a symlink, so cannot use it" 1>&2
exit 1
fi
if cd "$buildlink"; then
builddir="`/bin/pwd`"
else
err=$?
echo "Cannot cd to \"$buildlink\", so giving up" 1>&2
exit $err
fi
linkto=`echo "$builddir" | sed "s|^$linkdir/||"`
cd "$linkdir" || exit $?
rm -f "$linkname" || exit $?
ln -s "$linkto" "$linkname" || exit $?
echo "$link -> $linkto"
exit 0
|
The script relies on the /lib/modules/`uname -r`/build symlink pointing to the directory which was used to build the kernel. This symlink is set by make modules_install, at least for 2.4 series kernels and upwards. _________________ Ebichu wa chiizu ga daisuki dechu! |
|
Back to top |
|
|
BlueEar Tux's lil' helper
Joined: 06 Oct 2002 Posts: 143 Location: Mountain View, CA
|
Posted: Wed Jul 02, 2003 5:25 am Post subject: emerge with mutliple kernels |
|
|
Previous posts mention how to install multiple kernels and the need to update modules, such as nvidia, for the new sources. However when I run emerge nvidia-kernel nvidia-glx emu10k1 with new sources, it deletes them from old sources (In my case it installed them in 2.4.21-ac4 and removed them from 2.4.20). As I have xdm added to the default runlevel this makes booting back to 2.4.20 very painful ... after failing to load emu10k1 and struggling with X11 it finally falls back to a console. Is there a way of emerging nvidia, emu10k1, i2c, lm-sensors and all such extras so that they stay in both previous version of the kernel (say /lib/modules/2.4.20) and current version of the kernel (say, 2.4.21-ac4)? |
|
Back to top |
|
|
RedBeard0531 Guru
Joined: 21 Sep 2002 Posts: 415 Location: maryland
|
Posted: Wed Jul 02, 2003 1:00 pm Post subject: |
|
|
There is a much easier way. Add this to the end of your local.start:
Code: | rm /usr/src/linux
ln -s /usr/src/linux-`uname -r` /usr/src/linux
|
This set /usr/src/linux to whatever the current kernel is. I use it on all my boxen as i follow the mm-sources, so I change kernels frequently. I think that this should be added to the faq.
ebichu wrote: |
I do it during system boot. I add the following to /etc/conf.d/local.start:
Code: | echo "Setting /usr/src/linux link"
/usr/local/bin/ln_linux |
This is the /usr/local/bin/ln_linux script run by the above:
Code: | #! /bin/bash
rel="`uname -r`"
buildlink="/lib/modules/$rel/build"
link="/usr/src/linux"
linkdir="`dirname $link`"
linkname="`basename $link`"
if [ ! -L "$link" ]; then
echo "$link: not a symlink, so cannot change it" 1>&2
exit 1
fi
if [ ! -L "$buildlink" ]; then
echo "$buildlink: not a symlink, so cannot use it" 1>&2
exit 1
fi
if cd "$buildlink"; then
builddir="`/bin/pwd`"
else
err=$?
echo "Cannot cd to \"$buildlink\", so giving up" 1>&2
exit $err
fi
linkto=`echo "$builddir" | sed "s|^$linkdir/||"`
cd "$linkdir" || exit $?
rm -f "$linkname" || exit $?
ln -s "$linkto" "$linkname" || exit $?
echo "$link -> $linkto"
exit 0
|
The script relies on the /lib/modules/`uname -r`/build symlink pointing to the directory which was used to build the kernel. This symlink is set by make modules_install, at least for 2.4 series kernels and upwards. |
_________________ OH MY GOD! Kenny just killed Kenny!
That Basterd! |
|
Back to top |
|
|
torque2k3 n00b
Joined: 09 Oct 2003 Posts: 10 Location: Grand Rapids, MI
|
Posted: Thu Oct 09, 2003 8:00 pm Post subject: Compiling with "genkernel"... |
|
|
Is there anything others need to know about "genkernel"? I accidently found out about the --config option in a thread (giving genkernel a "make menuconfig" option) but there are literally NO docs (man, info or --help) I can find on this...
Now that 1.4 Final docs are pushing this as an alternative for newbies (and even seasoned Gentoo-ists), can someone add a FAQ item here for it?
Specifically, I asked a similar set of questions in this thread:
https://forums.gentoo.org/viewtopic.php?t=94339&highlight= so I won't bother re-asking here. It seems as though genkernel is a great way to get up-and-running, but there needs to be more info, especially info on switching from genkernel back to the standard sequence of kernel building (ie: what to change in grub.conf, can we get rid of initrd-2.4.xxxxx).
Sorry if this isn't the place to ask...
Thanks for the great FAQs, though! I love KC8!!! |
|
Back to top |
|
|
dangerweasel n00b
Joined: 15 Aug 2002 Posts: 47 Location: Outer Rim
|
Posted: Fri Nov 21, 2003 6:54 am Post subject: |
|
|
RedBeard0531 wrote: | There is a much easier way. Add this to the end of your local.start:
Code: | rm /usr/src/linux
ln -s /usr/src/linux-`uname -r` /usr/src/linux
|
This set /usr/src/linux to whatever the current kernel is. I use it on all my boxen as i follow the mm-sources, so I change kernels frequently. I think that this should be added to the faq.
|
I used your solution, as it was the easiest, IMO, and the most straight forward. I ran into a problem, however. 'uname -r' returns 2.6.0-gentoo when I am using the newest dev-sources (2.6.0-test9), but the directory of the sources is actually 2.6.0-test9-gentoo. This leads to a problem finding the sources. Any suggestions? |
|
Back to top |
|
|
mhermanns n00b
Joined: 03 Nov 2003 Posts: 33
|
Posted: Wed Dec 03, 2003 10:08 am Post subject: |
|
|
There are some questions about kernels that I have and that I have not found in the FAQ. I add them here since they may be interesting for the FAQ in case they are relevant. In other case, could somebody give me the answer to them?
1) After updating a given kernel source package (in my case mm-sources), compiling it, installing it and testing it, how do I delete the old version? Is it as simple as removing the directories /usr/src/linux-oldblabla and /lib/modules/oldblabla and the corresponding kernel image and System.map from the /boot directory?
2) When is System.map required and for what is it?
3) Why do some kernel source packages create the /usr/src/linux-beta link instead of the /usr/src/linux one, if the latter one is required while the former one is never used?
Thanks in advance |
|
Back to top |
|
|
TheCoop Veteran
Joined: 15 Jun 2002 Posts: 1814 Location: Where you least expect it
|
Posted: Wed Dec 03, 2003 4:08 pm Post subject: |
|
|
1. Code: | emerge -pC <old kernel emerge name>
rm -rf /usr/src/<old linux source>
rm -rf /lib/modules/<old linux modules>
rm /boot/[bzImage.old,System.map.old]
nano /boot/grub/grub.conf to remove the old entry |
2. Dunno. Grub doesnt need or use it, and i dont know anything about lilo
3. Probably to tell you that it is a beta and not a stable source, but ask the ebuild authors. it serves no purpose and i always delete it afterwards _________________ 95% of all computer errors occur between chair and keyboard (TM)
"One World, One web, One program" - Microsoft Promo ad.
"Ein Volk, Ein Reich, Ein Führer" - Adolf Hitler
Change the world - move a rock |
|
Back to top |
|
|
mhermanns n00b
Joined: 03 Nov 2003 Posts: 33
|
Posted: Thu Dec 04, 2003 7:21 pm Post subject: |
|
|
Code: | emerge -pC <old kernel emerge name> |
Interesting...but you cannot just use the emerge name since then both kernels are deleted. Instead, for example mm-sources-2.6.0_beta9-r1 deletes my old one and ommits the newer one. That would be interesting to include in the kernel howto or faq, since it is not obvious.
Thanks for the answers. |
|
Back to top |
|
|
ferret n00b
Joined: 30 Jul 2003 Posts: 22 Location: Oxford UK
|
Posted: Tue Dec 09, 2003 6:11 am Post subject: |
|
|
Try
Code: | emerge -pC =mm-sources-2.6.0_beta9-r1 |
|
|
Back to top |
|
|
FastTurtle Guru
Joined: 03 Sep 2002 Posts: 477 Location: Flakey Shake & Bake Caliornia, USA
|
Posted: Sun Jan 25, 2004 12:54 am Post subject: Q9 |
|
|
You list Grub but there is no information for those of us who are bitten by the Grub Bug and restricted to using Lilo.
Please add Lilo Information. |
|
Back to top |
|
|
EvilFurby n00b
Joined: 13 Aug 2004 Posts: 28 Location: Derbyshire, UK
|
Posted: Sun Sep 19, 2004 4:15 pm Post subject: KC8 - Kernel-save script date error |
|
|
I have input the script into my system. It works fine apart from outputing the date to the file name. I get for example System.map-date +%y%m%d-2.6.8-gentoo-r1
Is there a typo in KC8 on the following line?
WHEN='date +%y%m%d' |
|
Back to top |
|
|
Bob P Advocate
Joined: 20 Oct 2004 Posts: 3355 Location: Jackass! Development Labs
|
|
Back to top |
|
|
|