LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Slackware Linux Essentials question - Selecting a Kernel... (http://www.linuxquestions.org/questions/slackware-14/slackware-linux-essentials-question-selecting-a-kernel-856086/)

Robert.Thompson 01-13-2011 10:01 AM

Slackware Linux Essentials question - Selecting a Kernel...
 
Hello:

Slackware 13.1 is installed using the installer defaults and I have do nothing else, that I know of, other than installing wireless. (wicd)

(I originally installed lilo to the MBR which did not include LMDE in the menu so I re-installed LMDE and Grub included Windows, Slackware and LMDE in the boot menu, as I wanted.)

The book, in section 4.2 talks about 'Selecting a Kernel'

I don't understand the 'why' of this section. Slackware is working, right? 'It talks about compiling a Kernal from source' - do I need to do this? Why?

Thanks for any guidance,

sycamorex 01-13-2011 10:06 AM

At the beginning of the installation you can choose a kernel. Unless you've got some specific reason to do so, you don't need to choose any other kernel or recompile it. The default kernel is fine for the majority of users.

tronayne 01-13-2011 10:13 AM

The default kernel will be just fine; no, you do not need to compile it (or any other kernel). However, you can, if you want or need to, compile a stripped-down kernel customized for your hardware. As it is, the default is built with modules that load as required but otherwise don't bother you and you'll be able to use it without worrying about it.

The can is so you can learn how (it's not trivial but it's not rocket science either). The basic concept of Linux is that you can do whatever you want to with it; want to learn how to compile a custom kernel? Go for it.

So, essentially, leave it alone and enjoy it until the time comes that you really want to dig in and find out what's what and why's why.

Hope this helps some.

Robert.Thompson 01-13-2011 10:13 AM

1 Attachment(s)
Quote:

Originally Posted by sycamorex (Post 4222964)
At the beginning of the installation you can choose a kernel. Unless you've got some specific reason to do so, you don't need to choose any other kernel or recompile it. The default kernel is fine for the majority of users.

I believe I choose the 'huge' kernel. A screen shot of my boot directory is attached (I think) - is it OK?

TSquaredF 01-13-2011 10:13 AM

I used to think that compiling a kernel was a "good thing", & maybe when I started out, it was. But I no longer feel that way. The generic kernel works fine for me, at the slight added cost of making an initrd. I do not use any special hardware (RAID, etc) to boot, so just following the README.initrd in the /boot folder is sufficient. If you do need a bit fancier initrd, Slackware includes Eric's program "/usr/share/mkinitrd/mkinitrd_command_generator.sh", which will produce the proper command line to build a custom initrd.
Edit: I was really outgunned this time. However, using the "huge" kernel is not recommended. You really should switch over to the generic kernel & an initrd. See the "Changes And Hints.TXT" in the root of your install media for the reasons for this.
Regards,
Bill

sycamorex 01-13-2011 10:18 AM

Quote:

Originally Posted by Robert.Thompson (Post 4222980)
I believe I choose the 'huge' kernel. A screen shot of my boot directory is attached (I think) - is it OK?

The output of:

Code:

ls -l /boot
would be better in this case as it'll show us more information, but AFAIK the huge one is the default one. That's good. There's less chance that some hardware won't work because some module is not loaded.

2handband 01-13-2011 10:21 AM

You shouldn't need to compile a kernel unless you want to. You should, however, switch to the generic kernel as Bill already mentioned. I included instructions for this procedure in the following Slackware configuration tutorial:

http://genek.net/LinuxAdventures/ins...ackconfig.html

Gene

Robert.Thompson 01-13-2011 10:25 AM

Quote:

Originally Posted by sycamorex (Post 4222987)
The output of:

Code:

ls -l /boot
would be better in this case as it'll show us more information, but AFAIK the huge one is the default one. That's good. There's less chance that some hardware won't work because some module is not loaded.

Here it is:

Code:

bash-4.1# ls -l /boot
total 22644
lrwxrwxrwx 1 root root      37 2011-01-06 07:57 README.initrd -> /usr/doc/mkinitrd-1.4.5/README.initrd
lrwxrwxrwx 1 root root      32 2011-01-06 07:56 System.map -> System.map-huge-smp-2.6.33.4-smp
-rw-r--r-- 1 root root 1282716 2010-05-13 01:00 System.map-generic-2.6.33.4
-rw-r--r-- 1 root root 1322225 2010-05-12 22:41 System.map-generic-smp-2.6.33.4-smp
-rw-r--r-- 1 root root 2041855 2010-05-13 01:28 System.map-huge-2.6.33.4
-rw-r--r-- 1 root root 2086543 2010-05-12 23:48 System.map-huge-smp-2.6.33.4-smp
-rw-r--r-- 1 root root    512 2011-01-06 08:14 boot.0800
-rw-r--r-- 1 root root    512 2011-01-06 08:14 boot.0810
-rw-r--r-- 1 root root    209 2011-01-06 08:14 boot_message.txt
lrwxrwxrwx 1 root root      28 2011-01-06 07:56 config -> config-huge-smp-2.6.33.4-smp
-rw-r--r-- 1 root root  108261 2010-05-13 01:00 config-generic-2.6.33.4
-rw-r--r-- 1 root root  108627 2010-05-12 22:41 config-generic-smp-2.6.33.4-smp
-rw-r--r-- 1 root root  108235 2010-05-13 01:28 config-huge-2.6.33.4
-rw-r--r-- 1 root root  108601 2010-05-12 23:48 config-huge-smp-2.6.33.4-smp
-rw-r--r-- 1 root root    5040 2010-02-16 15:44 diag1.img
-rw------- 1 root root  86016 2011-01-06 08:14 map
-rw-r--r-- 1 root root  14174 2010-02-14 20:57 slack.bmp
lrwxrwxrwx 1 root root      29 2011-01-06 07:56 vmlinuz -> vmlinuz-huge-smp-2.6.33.4-smp
-rw-r--r-- 1 root root 2545840 2010-05-13 01:00 vmlinuz-generic-2.6.33.4
-rw-r--r-- 1 root root 2662400 2010-05-12 22:41 vmlinuz-generic-smp-2.6.33.4-smp
-rw-r--r-- 1 root root 5243760 2010-05-13 01:28 vmlinuz-huge-2.6.33.4
-rw-r--r-- 1 root root 5421536 2010-05-12 23:48 vmlinuz-huge-smp-2.6.33.4-smp
bash-4.1#


sycamorex 01-13-2011 10:31 AM

Yes, as you can see:

Code:

lrwxrwxrwx 1 root root      32 2011-01-06 07:56 System.map -> System.map-huge-smp-2.6.33.4-smp
...
lrwxrwxrwx 1 root root      28 2011-01-06 07:56 config -> config-huge-smp-2.6.33.4-smp
...
lrwxrwxrwx 1 root root      29 2011-01-06 07:56 vmlinuz -> vmlinuz-huge-smp-2.6.33.4-smp


System.map, config and vmlinuz are symbolic links to the files belonging to the huge kernel.

Once you've installed the system and are happy with it, you can, if you want, switch to the generic one, as suggested by others.

Robert.Thompson 01-13-2011 03:27 PM

Quote:

Originally Posted by sycamorex (Post 4223008)
Yes, as you can see:

Code:

lrwxrwxrwx 1 root root      32 2011-01-06 07:56 System.map -> System.map-huge-smp-2.6.33.4-smp
...
lrwxrwxrwx 1 root root      28 2011-01-06 07:56 config -> config-huge-smp-2.6.33.4-smp
...
lrwxrwxrwx 1 root root      29 2011-01-06 07:56 vmlinuz -> vmlinuz-huge-smp-2.6.33.4-smp


System.map, config and vmlinuz are symbolic links to the files belonging to the huge kernel.

Once you've installed the system and are happy with it, you can, if you want, switch to the generic one, as suggested by others.

I followed Gene's tutorial and now I have this:

Code:

bash-4.1# ls -l /boot
total 24316
lrwxrwxrwx  1 root root      37 2011-01-06 07:57 README.initrd -> /usr/doc/mkinitrd-1.4.5/README.initrd
lrwxrwxrwx  1 root root      32 2011-01-06 07:56 System.map -> System.map-huge-smp-2.6.33.4-smp
-rw-r--r--  1 root root 1282716 2010-05-13 01:00 System.map-generic-2.6.33.4
-rw-r--r--  1 root root 1322225 2010-05-12 22:41 System.map-generic-smp-2.6.33.4-smp
-rw-r--r--  1 root root 2041855 2010-05-13 01:28 System.map-huge-2.6.33.4
-rw-r--r--  1 root root 2086543 2010-05-12 23:48 System.map-huge-smp-2.6.33.4-smp
-rw-r--r--  1 root root    512 2011-01-06 08:14 boot.0800
-rw-r--r--  1 root root    512 2011-01-06 08:14 boot.0810
-rw-r--r--  1 root root    209 2011-01-06 08:14 boot_message.txt
lrwxrwxrwx  1 root root      28 2011-01-06 07:56 config -> config-huge-smp-2.6.33.4-smp
-rw-r--r--  1 root root  108261 2010-05-13 01:00 config-generic-2.6.33.4
-rw-r--r--  1 root root  108627 2010-05-12 22:41 config-generic-smp-2.6.33.4-smp
-rw-r--r--  1 root root  108235 2010-05-13 01:28 config-huge-2.6.33.4
-rw-r--r--  1 root root  108601 2010-05-12 23:48 config-huge-smp-2.6.33.4-smp
-rw-r--r--  1 root root    5040 2010-02-16 15:44 diag1.img
drwxr-xr-x 11 root root    4096 2011-01-13 14:59 initrd-tree
-rw-r--r--  1 root root 1707397 2011-01-13 14:59 initrd.gz
-rw-------  1 root root  86016 2011-01-06 08:14 map
-rw-r--r--  1 root root  14174 2010-02-14 20:57 slack.bmp
lrwxrwxrwx  1 root root      29 2011-01-06 07:56 vmlinuz -> vmlinuz-huge-smp-2.6.33.4-smp
-rw-r--r--  1 root root 2545840 2010-05-13 01:00 vmlinuz-generic-2.6.33.4
-rw-r--r--  1 root root 2662400 2010-05-12 22:41 vmlinuz-generic-smp-2.6.33.4-smp
-rw-r--r--  1 root root 5243760 2010-05-13 01:28 vmlinuz-huge-2.6.33.4
-rw-r--r--  1 root root 5421536 2010-05-12 23:48 vmlinuz-huge-smp-2.6.33.4-smp
bash-4.1#

The only problem is that I cannot tell whether I am still HUGE or if I have become GENERIC - can you tell me how to know?

Oops! I didn't run lilo because that instruction is included in the "While We're at it, Let's Ditch the Boot Prompt (not for dual-booters)" section.

Now that I have re-booted, is it safe to run lilo now?

Thanks,

2handband 01-13-2011 03:46 PM

Yeah, go ahead and run lilo. Always run lilo after doing anything at all to lilo.conf.

Robert.Thompson 01-13-2011 03:56 PM

Quote:

Originally Posted by 2handband (Post 4223382)
Yeah, go ahead and run lilo. Always run lilo after doing anything at all to lilo.conf.

I got some msg's:

Code:

bash-4.1# lilo
Warning: LBA32 addressing assumed
Warning: Unable to determine video adapter in use in the present system.
Warning: Video adapter does not support VESA BIOS extensions needed for
  display of 256 colors.  Boot loader will fall back to TEXT only operation.
Added Windows *
Added Linux_G
Added Linux
3 warnings were issued.
bash-4.1#

Should I still re-boot or have I screwed something up?

If it matters, I am using a Lenovo X61 laptop.

Thanks,

Robert.Thompson 01-13-2011 04:26 PM

I forgot that I was waiting for some advice and re-boot and selected Linux_G; here is what I see now:
Code:

bash-4.1# ls -l /boot
total 24360
lrwxrwxrwx  1 root root      37 2011-01-06 07:57 README.initrd -> /usr/doc/mkinitrd-1.4.5/README.initrd
lrwxrwxrwx  1 root root      32 2011-01-06 07:56 System.map -> System.map-huge-smp-2.6.33.4-smp
-rw-r--r--  1 root root 1282716 2010-05-13 01:00 System.map-generic-2.6.33.4
-rw-r--r--  1 root root 1322225 2010-05-12 22:41 System.map-generic-smp-2.6.33.4-smp
-rw-r--r--  1 root root 2041855 2010-05-13 01:28 System.map-huge-2.6.33.4
-rw-r--r--  1 root root 2086543 2010-05-12 23:48 System.map-huge-smp-2.6.33.4-smp
-rw-r--r--  1 root root    512 2011-01-06 08:14 boot.0800
-rw-r--r--  1 root root    512 2011-01-06 08:14 boot.0810
-rw-r--r--  1 root root    209 2011-01-06 08:14 boot_message.txt
lrwxrwxrwx  1 root root      28 2011-01-06 07:56 config -> config-huge-smp-2.6.33.4-smp
-rw-r--r--  1 root root  108261 2010-05-13 01:00 config-generic-2.6.33.4
-rw-r--r--  1 root root  108627 2010-05-12 22:41 config-generic-smp-2.6.33.4-smp
-rw-r--r--  1 root root  108235 2010-05-13 01:28 config-huge-2.6.33.4
-rw-r--r--  1 root root  108601 2010-05-12 23:48 config-huge-smp-2.6.33.4-smp
-rw-r--r--  1 root root    5040 2010-02-16 15:44 diag1.img
drwxr-xr-x 11 root root    4096 2011-01-13 14:59 initrd-tree
-rw-r--r--  1 root root 1707397 2011-01-13 14:59 initrd.gz
-rw-------  1 root root  131072 2011-01-13 15:53 map
-rw-r--r--  1 root root  14174 2010-02-14 20:57 slack.bmp
lrwxrwxrwx  1 root root      29 2011-01-06 07:56 vmlinuz -> vmlinuz-huge-smp-2.6.33.4-smp
-rw-r--r--  1 root root 2545840 2010-05-13 01:00 vmlinuz-generic-2.6.33.4
-rw-r--r--  1 root root 2662400 2010-05-12 22:41 vmlinuz-generic-smp-2.6.33.4-smp
-rw-r--r--  1 root root 5243760 2010-05-13 01:28 vmlinuz-huge-2.6.33.4
-rw-r--r--  1 root root 5421536 2010-05-12 23:48 vmlinuz-huge-smp-2.6.33.4-smp
bash-4.1#

Am I GENERIC or HUGE and how do I know?

Thanks,

gezley 01-13-2011 04:31 PM

Quote:

Originally Posted by Robert.Thompson (Post 4222959)
The book, in section 4.2 talks about 'Selecting a Kernel'

I don't understand the 'why' of this section. Slackware is working, right? 'It talks about compiling a Kernal from source' - do I need to do this? Why?

Thanks for any guidance,

Hi Robert:

when I started with Linux I hadn't a clue what all this was about. Debian didn't help because the developers had already done the work for me. Only when I moved to Slackware did I begin to understand.

Here's one way to understand it:

let's say you have a Windows XP partition and a Slackware partition on your computer. If your Linux kernel hasn't been compiled with NTFS file system support then Slackware won't "see" or mount the Windows partition, meaning you won't be able to copy stuff from your Windows folders to your /home directory. So NTFS file system support must be compiled into the kernel if that's what you want to do. The huge kernel has NTFS compiled in, but the huge kernel has *everything* compiled in, just in case, including support for hardware devices you're unlikely to ever use. Compiling a kernel allows you to trim the huge kernel to your own needs. A generic kernel is usually a kernel where the trimming has been done for you and support for hardware and filesystems and suchlike is compiled in as modules, meaning it's not hard-coded into the kernel but compiled in in such a way that if the hardware is there the driver is loaded and if the hardware is not there then the driver is not loaded.

Here's what I do with kernels. I download the vanilla 2.6.37 kernel from kernel.org and extract it to /home/user/build as an ordinary user (it's a good idea to check the integrity of the download first but that's for another thread). Download the kernel (bz2) first and then in a terminal do the following:

Code:

mv linux-2.6.37.tar.bz2 /home/user/build
cd /home/user/build
tar -xjvf linux-2.6.37.tar.bz2

For ease of use I then symlink (shortcut, in Windows-speak) the new linux-2.6.37 directory that has just been created:

Code:

ln -s linux-2.6.37 linux
Now I change into the new linux directory:

Code:

cd linux
I then get my hands on a config file for the generic kernel. Use your browser to go to the following address:

Code:

http://mirrors.kernel.org/slackware/slackware-13.1/source/k/
The generic-smp config will do nicely. What this means is that I now have a configuration file for a generic linux-2.6.33.4 kernel which means most of the guesswork has already been done for me. I want to use that as a template to help me configure the newer 2.6.37 kernel.

Now I copy that config into the linux directory I created earlier:

Code:

cp /home/user/config-generic-smp-2.6.33.4-smp /home/user/build/linux/.config
Make sure you copy it as .config - the dot is important.

Now I start compiling my new kernel. I already have a 2.6.33.4 kernel config so I can *make oldconfig* to bring my config up to 2.6.37:

Code:

make oldconfig
It's safe to accept the default answers here - there will be quite a lot so just keep pressing Enter as this is your first go.

Once that's finished you can go through the kernel config to see if it's to your liking. Make sure you're still doing all of this as a normal user, not as root:

Code:

make menuconfig
Now you get a tree where you can make your changes - don't go too mad here but just have a look through it to see what's going on. Have a look at file systems for example and see if NTFS is compiled in. If it's hard-coded into the kernel it will have a star and if it's compiled in as a module it will have the letter M. A module is fine because your Slackware only needs NTFS on-demand. Your Slackware root filesystem is a different matter - if it is formatted as ext4 then you MUST compile the ext4 filesystem into your kernel so that the system boots. In other words, a star, not the letter M, beside ext4. If it's ext3, then a star beside ext3. If you don't know what your root filesystem is, go to another terminal and type this:

Code:

mount
You will see what your / directory is mounted as. Make sure filesystem support for this and other partitions is compiled in - if in doubt, put a star beside ext4, ext3, xfs, and jfs. But you're intelligent enough to know by now what's going on eh?

As I say, don't go mad changing things here - look around and get comfortable with it first. One thing you can safely do is change your processor family under "Processor type and features" - Core 2/Xeon here. Take your pick. Use the spacebar to select. Now you will get the benefit of a kernel that understands all the intricacies of your processor. Beforehand you just had a kernel with generic processor support.

OK that's enough for now. Exit and save your new config.

Now you can *make* the new kernel. If you have a multicore CPU you can speed the *make* up a bit with the -j switch.

Code:

make -j7
This will take a while.

When it's finished you need to *su* to root so that you can install your modules and then your kernel:

Code:

su
make modules_install
make install

The last step will update your lilo so that the new kernel will be selected automatically at boot. The more experienced users here will probably tell me this is a bad way to go about kernel configuration because it leaves me with no backup if things go wrong, so it's important not to make any radical changes until you know what you're doing when you're configuring.

Now if you reboot you have a spanking new kernel, with support for your specific processor compiled in. It might not make a huge difference, but it will make a difference, so it's worth doing. Type the following in a terminal to make sure you've booted up with the new kernel:

Code:

uname -a
Voila. You're good to go. Hope this helps.

2handband 01-13-2011 04:38 PM

You're running the generic kernel now.


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