-   Slackware (
-   -   Kernel compiling guide for newbies... (

DaOne 03-09-2003 10:36 PM

Kernel compiling guide for newbies...
I know how frustrating it can be for slack noobs...everyone tells you that slack is too hard for a newbie and then when you're faced with your first kernel compile...fear rolls in. Relax...slack isn't just makes you learn quicker. Compiling a custom kernel isn't just requires that you pay attention and follow the proper procedures. Once you've successfully installed slackware, then customized your kernel, you are well on your way to unleashing the raw power of linux...under the best (IMO) distro ever made.

Now to the compiling part...

First, we need to edit lilo.conf. Pick your favorite that is easy for newbies (and I still use this from time to time) is pico.

pico /etc/lilo.conf

Add this to your can just copy what is there and add the .old stuff.

image = /boot/vmlinuz.old

root = /dev/hda1

label = slack.old


Note: Replace /dev/hda1 with the correct location of your root partition.

Now we need to edit the Makefile to make sure your new kernel is copied to the appropriate directory.

If you are using 8.1 or later, open /usr/src/linux/Makefile in a text editor, scroll to line 74 and
uncomment the the line #export INSTALL_PATH=/boot.
For 8.0 you must leave this line commented. /usr/src/linux

pico Makefile

scroll to line 74 and
uncomment the the line #export INSTALL_PATH=/boot.
For 8.0 you must leave this line commented.

Now for the fun :)

make menuconfig (make your changes here...when done, save your new configuration)
make dep (sets all the kernel dependencies)
make clean (removes un-needed files)
make bzImage (builds the kernel)
make install (installs, moves and renames all the needed files and updates lilo)
make modules (builds all the kernel modules)
make modules_install (installs the modules)

Note: The 'make install' command is the one that most don't use but it works fine in slackware as long as you have prepared lilo.conf and edited Makefile according to the instructions above.

Now you can reboot using your new kernel!!!

If things did not go completely according to plan you can boot your old (working)
kernel by selecting slack.old at the lilo screen.

This is my bible when it comes to recompiling my kernel, and it has never, ever failed.
Enjoy your new kernel!

Note: All references from
written by one of our own Moderators!

Yorky 03-10-2003 02:54 AM

Good post - I have saved it and will use it when I can gather the strength to try compile my 1st kernel :=))

SLaCk_KiD 03-10-2003 03:13 PM

DaOne helped me get my first compile right, he was understanding of my fustration
and very patient with me. I dont think that i have anything to complain
about at all. Everyone here in the slack forum is always willing to help out
That is what I like about Slack, the people who use it are knowledgable
and always seem to lend a hand when it is needed. Thanks to all of you
who try to help us n00b's out!! hopefully one day when I know
the answers to questions that are asked, i can be as helpful as you guys....thnaks again!

DaOne 03-13-2003 07:19 PM

Glad at least one person got something good out of this. Just a note...all of this still still works through rc2...:)

figadiablo 03-14-2003 07:21 AM

I have compiled kernerls sucesfully before, but my questions is: If I just wanna improve from the current configuration or add something that I left out, some module; do I type make oldconfig or something so that when I do the menuconfig I see my current configuration? Or do I have to do everything from scratch and hope that I dont leave something else out? Am I complicating things out?


DaOne 03-14-2003 11:52 AM

When you type make menuconfig, your current configuration will be used. So no, you do not need to start over each time.

trn 03-14-2003 08:21 PM

a tip also, after make menuconfig you can use the line "make dep && make clean bzImage modules modules_install" then go get a bite to eat or whatever and when you come back everything is all compiled and ready to go. (and yes i stole this from the gentoo install guide.. just a handy tip.)

DaOne 03-14-2003 08:33 PM


"make dep && make clean bzImage modules modules_install"
This can be done if you plan to manually copy bzImage to /boot/vmlinuz, and then update lilo. Otherwise, the new kernel wouldn't be copied to the proper location, which is what make install does for will copy the kernel to the appropriate location, and updates lilo.

figadiablo 03-14-2003 10:38 PM

Ok, maybe I'm a little dumb today, but I wan't to make sure that I get this. For example if Im using the 2.4.18, which I've already recompiled for my likings, and then go and download 2.4.20. When I type make menuconfig, does that means that the computer is going to scan the settings that Im already using and they will appear in the new kernel Im compiling? In other words will I see my curent config with the 2.4.20?

Before I forget, thaks for the earlier response,

DaOne 03-14-2003 11:06 PM

What you'll need to do in that case is copy your current config to the new kernel source is how I like to do this.

Once the new kernel source is in place, cd to that directory...

cd /usr/src/linux-2.4.20
make mrproper

Then copy your 2.4.18 config...

cp /usr/src/linux-2.4.18/.config /usr/src/linux-2.4.20/.config

Then you can run make menuconfig...your current configuration will be in place. There will likely be some new features in the new kernel, so you'll want to make sure you go through the configuration menu and add/remove as necessary. Once you are satisfied, you can save your changes, and continue on to make dep and so on.

figadiablo 03-15-2003 03:06 PM

Thanks for the reply. Something new that I just learn.


Aussie 03-15-2003 08:02 PM

If you plan to use your previous .config you can do "make oldconfig" and it will only prompt for new kernel options.

DaOne 03-15-2003 08:42 PM


If you plan to use your previous .config you can do "make oldconfig" and it will only prompt for new kernel options.
Thanks Aussie...I forgot about that one :)

figadiablo 03-15-2003 09:41 PM

cool yeah!! I knew there was a make oldconfig somewhere. Thanks for the tips guys!


Astro 03-19-2003 02:21 PM

I find that the commands make modules and make modules_install tends to mess up my kernel QUITE a bit.... i use make menuconfig; make dep; make clean; make bzImage; cp arch/i386/bzImage /boot then edit lilo accordingly...if I do the make modules and make install and make modules_install it doesnt always work, in fact it never does even if I have modules to install... not sure why at I use the method I described above and it works every time.

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