LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 04-30-2014, 06:25 PM   #1
sfzombie13
Member
 
Registered: Dec 2003
Location: wv
Distribution: suse, ubuntu, fedora
Posts: 105

Rep: Reputation: 15
compiling kernel 3.14.2 with slackware 14.1


i thought i was getting the hang of this compiling kernel thing, but apparently i was mistaken. my 3d attempt ended with me booting into it and when it got to the part where the words scrolling usually get smaller after the screen resolution changes, it went black. no backlight or nothing, but the power was on. i waited for a few and went back in with the working one,lesson learned the hard way, to check the logs to see what was happening. i shut down, waited 10 minutes then booted, did a hard shutdown after three minutes, then waited 10 minutes and rebooted. that way, there was a clear gap in the logs so that i could quickly find the non boot. thing is, there was a 25 minute gap, no logs at all from the no boot.

what i did was download the tarball into the /usr/src directory, rename the symlink so i could get in, untar the kernel, cd into the directory, ran clean and make mrproper, then ran xconfig and disabled a bunch of junk i didn't think i needed (like amateur radio support and stuff for hardware i don't have and amd processors (i have an intel)), then ran make, and make install. then i created a new symlink to the new directory, and opened the lilo.config and added a new entry and pointed it to the new directory. when i tried to copy the vmlinuz to the boot directory, it had three in there from before; one was called vmlinuz-generic-3.10.17, another is vmlinuz-huge-3.10.17, another is vmlinuz1. when i tried to copy the one from the new 3.14.2 directory, it said i would overwrite the system generated one, so i thought it was put there when i hit install, so i didn't copy it.

maybe i missed a step? and i thought i had compiled the 3.14.1 last week, but when i checked, i am still booting into 3.10.17. i guess i haven't done one yet, but am getting closer, at least i can still get into my system and i did get the wifi working with this kernel. is there a way i can look at logs somewhere to see what went wrong? i have been wading through makefiles and they are huge, makes my head spin after a few minutes trying to find something. i am not going to give up until i get this done. is there a list anywhere of the absolute essentials not to disable on a kernel? not much information i could find on that. thanx for all the help.
 
Old 04-30-2014, 07:05 PM   #2
sfzombie13
Member
 
Registered: Dec 2003
Location: wv
Distribution: suse, ubuntu, fedora
Posts: 105

Original Poster
Rep: Reputation: 15
ok, solving this one. i missed a step or two in there. sometimes you gotta step back and take a look at the big picture and see your mistakes. trying again now, should be booting in a half hour.

thought i had it, but i have to work on it. it did the exact same thing as last time, so i guess the original questions still apply. and for the record, i used this tutorial,
Code:
4.2 Selecting a Kernel

The kernel is the part of the operating system that provides hardware access, process control, and overall system control. The kernel contains support for your hardware devices, so picking one for your system is an important setup step.

Slackware provides more than a dozen precompiled kernels that you can pick from, each with a standard set of drivers and additional specific drivers. You can run one of the precompiled kernels or you can build your own kernel from source. Either way, you need to make sure that your kernel has the hardware support your system needs.
4.2.1 The /kernels Directory on the Slackware CD-ROM

The precompiled Slackware kernels are available in the /kernels directory on the Slackware CD-ROM or on the FTP site in the main Slackware directory. The available kernels change as new releases are made, so the documentation in that directory is always the authoritative source. The /kernels directory has subdirectories for each kernel available. The subdirectories have the same name as their accompanying boot disk. In each subdirectory you will find the following files:
File 	Purpose
System.map 	The system map file for this kernel
bzImage 	The actual kernel image
config 	The source configuration file for this kernel

To use a kernel, copy the System.map and config files to your /boot directory and copy the kernel image to /boot/vmlinuz. Run /sbin/lilo(8) to install LILO for the new kernel, and then reboot your system. That's all there is to installing a new kernel.

The kernels that end with a .i are IDE kernels. That is, they include no SCSI support in the base kernel. The kernels that end with .s are SCSI kernels. They include all the IDE support in .i kernels, plus SCSI support.
4.2.2 Compiling a Kernel from Source

The question “Should I compile a kernel for my system?” is often asked by new users. The answer is a definite maybe. There are few instances where you will need to compile a kernel specific to your system. Most users can use a precompiled kernel and the loadable kernel modules to achieve a fully working system. You will want to compile a kernel for your system if you are upgrading kernel versions to one that we do not currently offer in Slackware, or if you have patched the kernel source to get special device support that is not in the native kernel source. Anyone with an SMP system will definitely want to compile a kernel with SMP support. Also, many users find a custom compiled kernel runs much faster on their machine. You may find it useful to compile the kernel with optimizations for the specific processor in your machine.

Building your own kernel is not that hard. The first step is to make sure you have the kernel source installed on your system. Make sure that you installed the packages from the K series during the installation. You will also want to make sure you have the D series installed, specifically the C compiler, GNU make, and GNU binutils. In general, it's a good idea to have the entire D series installed if you plan on doing any kind of development. You can also download the latest kernel source from http://www.kernel.org/mirrors.
4.2.2.1 Linux Kernel version 2.4.x Compilation

% su -
Password:
# cd /usr/src/linux

The first step is to bring the kernel source into its base state. We issue this command to do that (note, you may wish to back-up the .config file as this command will delete it without warning):

# make mrproper

Now you can configure the kernel for your system. The current kernel offers three ways of doing this. The first is the original text-based question and answer system. It asks a bunch of questions and then builds a configuration file. The problem with this method is that if you mess up, you must start over. The method that most people prefer is the menu driven one. Lastly, there is an X-based kernel configuration tool. Pick the one you want and issue the appropriate command:

# make config           (text-based Q&A version)
# make menuconfig       (menu driven, text-based version)
# make xconfig          (X-based version, make sure you are in X first)

Figure 4-1. Kernel Configuration Menu

New users will probably find menuconfig to be the easiest to use. Help screens are provided that explain the various parts of the kernel. After configuring your kernel, exit the configuration program. It will write the necessary configuration files. Now we can prepare the source tree for a build:

# make dep
# make clean

The next step is to compile the kernel. First try issuing the bzImage command below.

# make bzImage

This may take a while, depending on your CPU speed. During the build process, you will see the compiler messages. After building the kernel image, you will want to build any parts of the kernel that you flagged as modular.

# make modules

We can now install the kernel and modules that you compiled. To install the kernel on a Slackware system, these commands should be issued:

# mv /boot/vmlinuz /boot/vmlinuz.old
# cat arch/i386/boot/bzImage > /vmlinuz
# mv /boot/System.map /boot/System.map.old
# cp System.map /boot/System.map
# make modules_install

You will want to edit /etc/lilo.conf and add a section to boot your old kernel in case your new one does not work. After doing that, run /sbin/lilo to install the new boot block. You can now reboot with your new kernel.
4.2.2.2 Linux Kernel Version 2.6.x

The compilation of a 2.6 kernel is only slightly different from a 2.4 or a 2.2 kernel, but it is important that you understand the differences before delving in. It's no longer necessary to run make dep and make clean. Also, the kernel compilation process is not as verbose in the 2.6 kernel series. This results in a build process that is easier to understand, but has some short comings as well. If you have trouble building the kernel, it's highly recommended that you turn verbosity back up. You do this simply by appending V=1 to the build. This allows you to log more information that could help a kernel developer or other friendly geek aid you in resolving the issue.

# make bzImage V=1

4.2.3 Using Kernel Modules

Kernel modules are another name for device drivers that can be inserted into a running kernel. They allow you to extend the hardware supported by your kernel without needing to pick another kernel or compile one yourself.

Modules can also be loaded and unloaded at any time, even when the system is running. This makes upgrading specific drivers easy for system administrators. A new module can be compiled, the old one removed, and the new one loaded, all without rebooting the machine.

Modules are stored in the /lib/modules/kernel version directory on your system. They can be loaded at boot time through the rc.modules file. This file is very well commented and offers examples for major hardware components. To see a list of modules that are currently active, use the lsmod(1) command:

# lsmod
Module                  Size  Used by
parport_pc              7220   0 
parport                 7844   0  [parport_pc]

You can see here that I only have the parallel port module loaded. To remove a module, you use the rmmod(1) command. Modules can be loaded by the modprobe(1) or insmod(1) command. modprobe is usually safer because it will load any modules that the one you're trying to load depends on.

A lot of users never have to load or unload modules by hand. They use the kernel autoloader for module management. By default, Slackware includes kmod in its kernels. kmod is a kernel option that enables the kernel to automatically load modules as they are requested. For more information on kmod and how it is configured, see /usr/src/linux/Documentation/kmod.txt. You'll have needed to have the kernel source package, or downloaded kernel source from http://kernel.org.

More information can be found in the man pages for each of these commands, plus the rc.modules file.
the last time, i re read the steps and found that i didn't hit the make modules or move the system.map. i re did the whole thing and ran it all again and nothing. i need to look at some logs, so i enabled verbose logging this time, or something like that.

Last edited by sfzombie13; 04-30-2014 at 07:33 PM.
 
Old 04-30-2014, 08:09 PM   #3
fogpipe
Member
 
Registered: Mar 2011
Distribution: Slackware 64 Current
Posts: 327

Rep: Reputation: 77
You might want to start with the .config file from the stock huge kernel as a baseline. When i compile a new kernel i always start with a known good .config.
Also dont copy over an existing vmlinuz, im not sure what you are using to install kernel images in boot but imo its best to copy the vmlinuz directly from the source directory to /boot and name it the same as what ever local version name you specified in the configuration phase. Also copy the System.map file and name it accordingly.
For instance, my current kernel image is named "vmlinuz-3.10.30lowfat" the modules directory is named 3.10.30lowfat and this is the lilo entry.


image = /boot/vmlinuz-3.10.30lowfat
root = /dev/sda5
label = 3.10.30lowfat
append = "raid=noautodetect"
read-only

Always back up your modules directory, lilo.conf and /boot directory before you start, so that you can boot from a cd or something to restore everything in case you bork it.

Last edited by fogpipe; 04-30-2014 at 08:17 PM.
 
Old 05-01-2014, 07:06 AM   #4
sfzombie13
Member
 
Registered: Dec 2003
Location: wv
Distribution: suse, ubuntu, fedora
Posts: 105

Original Poster
Rep: Reputation: 15
thanx. i renamed everything and left it in the directory, then updated lilo to point to the new names, so now i have four boot options, but i can get back in anytime i need to like now.
when i hit make, it made the new vmlinuz appear in the directory, everything else i copied like the guide said. i am getting pretty good at backing things up before i start anything now.
right now it is a slack64 14.1 build, full install, 3.10.17 kernel. the original reason to build a new one was to get wifi support for my laptop, but i got that figured out. now i just want to build for knowledge of how to do it and to strip the junk.
i tried looking at the old config, but it had so many things installed that i can't get a feel for what the minimum essentials are. i have been looking for days and can't find a list of anything like that, i must not be searching right. i have found a lot of great information though, so it was time well spent.
 
Old 05-01-2014, 09:26 AM   #5
Didier Spaier
Senior Member
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slackware{,64}-{14.1,current} on a Lenovo Thinkpad T61 6457-4XG
Posts: 4,025

Rep: Reputation: 966Reputation: 966Reputation: 966Reputation: 966Reputation: 966Reputation: 966Reputation: 966Reputation: 966
You know that stripping down your kernel is usually useless, do you?

Nevertheless, doing useless things is not forbidden by law. So, here is a simple recipe:
  1. If not already done, install the -generic kernel shipped with Slackware (of course you'll need to use an initrd for that). Keep the huge one and a lilo stanza for it, just in case.
  2. Boot on your -generic kernel
  3. Plug in (one at a time a few seconds then remove, else you won't have enough USB slots) all the removable devices that you have (USB hard disks, USB sticks, USB cameras, SD cards, whatever), so that all needed kernel modules be loaded. Else you'll loose support for these devices in the new kernel.
  4. Run "zcat /proc/config.gz > <path_to_your_kernel_tree>/.config to copy your currently in use config file in your kernel tree, named .config
  5. Run "make oldconfig" just to make sure you start next step from a clean workable basis.
  6. Run "make localmodconfig" in your kernel tree. This is the important step. The new kernel will be modular and the kernel modules built will be only those currently loaded.
  7. Run "make xconfig" or "make menuconfig" in your kernel tree just to set "Local version -append to kernel release" in the "General Setup" menu. "strip" could be a good "Local version" name. This will allow you to distinguish the new kernel and modules from existing ones.
  8. Compile and install the new kernel and modules as usual.
  9. Make an initrd for your new kernel, with a specific name.
  10. Write a lilo stanza in /etc/lilo.conf for your new kernel, referencing it as well as the new initrd.
  11. Run "lilo -t -v" then if all goes well "lilo".
  12. Cross fingers (this step is optional).
  13. Reboot with your new kernel.
PS there are 13 steps, but only for superstitious people. This is intentional.

Last edited by Didier Spaier; 05-01-2014 at 09:56 AM. Reason: s/intended/intentional/
 
Old 05-01-2014, 03:20 PM   #6
fogpipe
Member
 
Registered: Mar 2011
Distribution: Slackware 64 Current
Posts: 327

Rep: Reputation: 77
Quote:
Originally Posted by Didier Spaier View Post
You know that stripping down your kernel is usually useless, do you?


I disagree I find it fun, interesting and educational to read about the various options and parameters and it seems to me that there are various memory, timing and debugging options that one can fiddle with that make things perceptibly faster.
Also, my main desktop is a Pentium D, so its nice to be able to compile a kernel that takes that into account. Configuring and compiling a kernel with maybe a nice pot of tea, some Boccherini and a good pipeful of strong tobacco is a great way to while away a sunday afternoon imo.
 
Old 05-01-2014, 05:14 PM   #7
sfzombie13
Member
 
Registered: Dec 2003
Location: wv
Distribution: suse, ubuntu, fedora
Posts: 105

Original Poster
Rep: Reputation: 15
i would have to say that it is not useless, as the whole purpose of me continuing on with it is actually learning the os thoroughly. and thank you for the 13 steps, it is exactly what i need at this point. now, i understand all of the steps, but do have one important question, does it hurt to have all of these different kernels installed at the same time, or does the make install command just create the vmlinuz and other files in the directory and nothing happens until i boot from an image? i a leaning this way, but need to make sure i am not clogging up my system with useless crap.

and i have also heard that it can significantly increase speed and performance when stripping the kernel down. it is just taking me a bit to learn where to stop stripping. i, too, love a good pipe.
 
Old 05-01-2014, 05:27 PM   #8
Didier Spaier
Senior Member
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slackware{,64}-{14.1,current} on a Lenovo Thinkpad T61 6457-4XG
Posts: 4,025

Rep: Reputation: 966Reputation: 966Reputation: 966Reputation: 966Reputation: 966Reputation: 966Reputation: 966Reputation: 966
You can have as many kernels as you want as long as you have enough space on the disk partition that hosts the /boot directory. Of course you can only boot one at a time.

I suggest that you measure yourself the increase in speed and performance. Stop stripping when you observe no more performance increase, or when you miss something you just removed.

Last edited by Didier Spaier; 05-01-2014 at 05:32 PM.
 
Old 05-02-2014, 04:52 AM   #9
enorbet
Member
 
Registered: Jun 2003
Location: Virginia
Distribution: Slackware 14 is Main OpSys on Main PC, 2ndary are OpenSuSe 13 and SolydK
Posts: 674

Rep: Reputation: 268Reputation: 268Reputation: 268
Greetings
I prefer Alien Bob's tutorial even though I'm an old hand at compiling kernels. It is found - H E R E -. I tend to skim it before I start to remind myself of what I need to do to get a realtime, low-latency kernel with NO initrd.

Regarding "uselessness" - There was a time when paring down to as close to an embedded system as possible gave speed advantage. This is no longer true to any notable degree. It also means that if you add or replace some hardware you might need to rebuild that kernel. That said, being a creature of habit, I do turn off support for ancient hardware I know I will never use or, as OP mentioned, AMD stuff on an Intel box, and vice versa. One advantage of using "make xconfig" is that with a 3-window display, you can see all the help files. Many will say "If you don't know what this is, you probably don't need it" or "This is safe to say "yes' even if you don't need it." Obviously they often explain what brands/models a module supports and if it is new or deprecated, or close to it.

I have to agree that learning to compile and use kernels is not only a "rite of passage" (rapidly becoming extinct) but is incredibly useful to give a base understanding of what is possible and how your machine works in Linux. Timings and other tweaks are also useful, and even required for some types of work.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
compiling kernel 2.6.38.6 on Slackware 13.37 dimm0k Slackware 15 05-12-2011 01:44 PM
slackware 10.2 compiling kernel sharathg786 Slackware 3 07-31-2006 04:08 PM
Errors Compiling Kernel 2.6 on Slackware 10.2 - Old kernel headers required? Dave S. Slackware 8 03-04-2006 12:15 AM
Compiling new kernel with Slackware 10 madhatter2 Linux - Newbie 2 07-29-2004 04:08 PM
Compiling kernel 2.6.4 on Slackware 9.1 ProtoformX Linux - General 1 03-13-2004 10:41 AM


All times are GMT -5. The time now is 06:32 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration