Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[FAQF] KC: Kernel Compilation
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2  
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
yokem55
Guru
Guru


Joined: 18 Apr 2002
Posts: 360
Location: Oregon

PostPosted: Mon Mar 03, 2003 9:04 am    Post subject: Reply with quote

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
View user's profile Send private message
yokem55
Guru
Guru


Joined: 18 Apr 2002
Posts: 360
Location: Oregon

PostPosted: Mon Mar 03, 2003 9:42 am    Post subject: Reply with quote

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:
Code:
#make menuconfig
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
View user's profile Send private message
ebichu
Apprentice
Apprentice


Joined: 03 Jul 2002
Posts: 231
Location: Manchester, England

PostPosted: Mon Mar 03, 2003 3:44 pm    Post subject: Reply with quote

_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
View user's profile Send private message
BlueEar
Tux's lil' helper
Tux's lil' helper


Joined: 06 Oct 2002
Posts: 143
Location: Mountain View, CA

PostPosted: Wed Jul 02, 2003 5:25 am    Post subject: emerge with mutliple kernels Reply with quote

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
View user's profile Send private message
RedBeard0531
Guru
Guru


Joined: 21 Sep 2002
Posts: 415
Location: maryland

PostPosted: Wed Jul 02, 2003 1:00 pm    Post subject: Reply with quote

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
View user's profile Send private message
torque2k3
n00b
n00b


Joined: 09 Oct 2003
Posts: 10
Location: Grand Rapids, MI

PostPosted: Thu Oct 09, 2003 8:00 pm    Post subject: Compiling with "genkernel"... Reply with quote

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... :oops:
Thanks for the great FAQs, though! I love KC8!!!
Back to top
View user's profile Send private message
dangerweasel
n00b
n00b


Joined: 15 Aug 2002
Posts: 47
Location: Outer Rim

PostPosted: Fri Nov 21, 2003 6:54 am    Post subject: Reply with quote

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
View user's profile Send private message
mhermanns
n00b
n00b


Joined: 03 Nov 2003
Posts: 33

PostPosted: Wed Dec 03, 2003 10:08 am    Post subject: Reply with quote

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
View user's profile Send private message
TheCoop
Veteran
Veteran


Joined: 15 Jun 2002
Posts: 1814
Location: Where you least expect it

PostPosted: Wed Dec 03, 2003 4:08 pm    Post subject: Reply with quote

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
View user's profile Send private message
mhermanns
n00b
n00b


Joined: 03 Nov 2003
Posts: 33

PostPosted: Thu Dec 04, 2003 7:21 pm    Post subject: Reply with quote

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
View user's profile Send private message
ferret
n00b
n00b


Joined: 30 Jul 2003
Posts: 22
Location: Oxford UK

PostPosted: Tue Dec 09, 2003 6:11 am    Post subject: Reply with quote

Try

Code:
emerge -pC =mm-sources-2.6.0_beta9-r1
Back to top
View user's profile Send private message
FastTurtle
Guru
Guru


Joined: 03 Sep 2002
Posts: 413
Location: Shake & Bake

PostPosted: Sun Jan 25, 2004 12:54 am    Post subject: Q9 Reply with quote

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
View user's profile Send private message
EvilFurby
n00b
n00b


Joined: 13 Aug 2004
Posts: 28
Location: Derbyshire, UK

PostPosted: Sun Sep 19, 2004 4:15 pm    Post subject: KC8 - Kernel-save script date error Reply with quote

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
View user's profile Send private message
Bob P
Advocate
Advocate


Joined: 20 Oct 2004
Posts: 3355
Location: Jackass! Development Labs

PostPosted: Wed Nov 17, 2004 7:01 am    Post subject: Reply with quote

over a year has passed with no answer -- question removed.
_________________
.
Stage 1/3 | Jackass! | Rockhopper! | Thanks | Google Sucks
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum