LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 10-07-2005, 12:22 PM   #1
g_trueblood
LQ Newbie
 
Registered: Sep 2005
Location: Portland, ME
Distribution: Ubuntu 9.04
Posts: 16

Rep: Reputation: 0
Compiling a kernel


I'm in the process of trying to recompile the kernel for my linux class but I have incomplete notes on how to do that. Appearently, the prof. decided to keep on talking while the rest of us were on break. I know how to accouplish the changes by using make menuconfig while in /usr/src/linux-2.4.29. I save the file. Then I run make dep, make clean, make bzlilo but this is where my notes have a gap. I know that you have to save a file named vmliuz tovmlinuz-ide-2.4.29 but I don't know when to do that of if I have to do anything else after that. Anyone got a cheat cheat on how do do this kind of thing?
 
Old 10-07-2005, 12:54 PM   #2
jong357
Senior Member
 
Registered: May 2003
Location: Columbus, OH
Distribution: DIYSlackware
Posts: 1,914

Rep: Reputation: 52
Funny. Prof's like to do that. I don't know about "make bzlilo". There are multiple ways to do it.... "make bzlilo" could very well be a command designed to work with the bootloader lilo, I don't know. Tell him it's flawed because you can't be assured lilo is always going to be the bootloader... ;-)
Code:
make dep
make clean
make bzImage
make modules
make modules_install
Then copy your bzImage to /boot:
Code:
cp arch/i386/boot/bzImage /boot
Rename your bzImage:
Code:
mv /boot/bzImage /boot/vmlinuz-ide-2.4.29
Make a symlink:
Code:
ln -sf /boot/vmlinuz-ide-2.4.29 /boot/vmlinuz
Copy your System.map
Code:
cp System.map /boot/System.map-2.4.29
Symlink it:
Code:
ln -sf /boot/System.map-2.4.29 /boot/System.map
You could also copy your config file to boot for safe keeping as well:
Code:
cp .config /boot/config-ide-2.4.29
And symlink it if you want:
Code:
ln -sf /boot/config-ide-2.4.29 /boot/config
Make sure your bootloader config file has all the necessary information correctly entered or make another entry for it. That would be /etc/lilo.conf or /boot/grub/menu.lst

Last edited by jong357; 10-07-2005 at 01:30 PM.
 
Old 10-07-2005, 01:23 PM   #3
jong357
Senior Member
 
Registered: May 2003
Location: Columbus, OH
Distribution: DIYSlackware
Posts: 1,914

Rep: Reputation: 52
I just ran "make bzlilo" out of curiostiy... Pretty nifty command IF you use lilo. Heres the very end of it:
Code:
if [ -f /boot/vmlinuz ]; then mv /boot/vmlinuz /boot/vmlinuz.old; fi
if [ -f /boot/System.map ]; then mv /boot/System.map /boot/System.old; fi
cat arch/i386/boot/bzImage > /boot/vmlinuz
cp System.map /boot/
if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi
/etc/lilo.conf: No such file or directory
make[1]: *** [zlilo] Error 1
make: *** [bzlilo] Error 2
As you can see, it automatically copies your vmlinuz and system map for you then tries to run /sbin/lilo to update your bootloader. I'm thinking that had it found an /etc/lilo.conf on my system, it might have even made an entry for me as well.

In my opinon, it's a bad idea to teach like that. If he isn't showing you the more "generic" way to compile a kernel then shame on him. I don't use lilo, thus that command isn't a good one for me to use. So his notes would probably have been:

make dep
make clean
make bzlilo

And well.... that's it probably. Next time, don't take so long on your break...

I did all this on a 2.6.13.2 kernel. I'm not seeing anywhere in the output where it made any modules. So, I would have to say you would also need to run "make modules" and "make modules_install" too. So it might have been something like:

make dep
make clean
make bzlilo
make modules
make modules_install

Find a cute girl or guy in your class and ask them for what you missed... Also, be aware that "make dep" is an obsolete command with regards to a 2.6.xx kernel.

Last edited by jong357; 10-07-2005 at 01:37 PM.
 
Old 10-07-2005, 06:33 PM   #4
Bruce Hill
HCL Maintainer
 
Registered: Jun 2003
Location: McCalla, AL, USA
Distribution: Arch, Gentoo
Posts: 6,940

Rep: Reputation: 129Reputation: 129
IMO this is the best Kernel Rebuild Guide on the net ...

Linus Torvalds also has great instructions in the kernel sources always in the
./linux-2.x.y.z/README file.

And on the 2.6.x.y kernels, you only need "make" and "make modules_install"
because "make" builds the modules.
 
Old 10-08-2005, 03:59 AM   #5
aikempshall
Member
 
Registered: Nov 2003
Location: Bristol, Britain
Distribution: Slackware
Posts: 900

Rep: Reputation: 153Reputation: 153
For what it's worth I have these three scripts. They seem to work for me. But beware.

here follows a script called /usr/bin/aik_kernel_compile. Note that it recompiles alsa towards the end and takes a copy of the .config file.

#!/bin/bash

destdir=/home/alex/slackware/`ls -l /usr/src/linux/../linux | cut -f11 -d" "`
creationtime=`ls -l /usr/src/linux/.config | cut -f8 -d" "`
creationdate=`ls -l /usr/src/linux/.config | cut -f7 -d" "`
if [[ ! -d "$destdir" ]]
then
mkdir $destdir
fi
cp /usr/src/linux/.config "$destdir/config{$creationdate.$creationtime}"

make dep;THIS__RESULT=$?
if [ $THIS__RESULT -ne 0 ]
then echo "abend in dep"
exit 2
fi

make clean;THIS__RESULT=$?
if [ $THIS__RESULT -ne 0 ]
then echo "abend in clean"
exit 2
fi

make bzImage;THIS__RESULT=$?
if [ $THIS__RESULT -ne 0 ]
then echo "abend in bzimage"
exit 2
fi

make modules;THIS__RESULT=$?
if [ $THIS__RESULT -ne 0 ]
then echo "abend in modules"
exit 2
fi

make modules_install;THIS__RESULT=$?
if [ $THIS__RESULT -ne 0 ]
then echo "abend in modules_install"
exit 2
fi

aik_alsa_compile

make install;THIS__RESULT=$?
if [ $THIS__RESULT -ne 0 ]
then echo "abend in install"
exit 2
fi


here follows a script called /usr/bin/aik_alsa_compile which completely removes the contents of alsa_driver, alsa_lib and alsa_utils and then recreates them from source, to ensure that the source doesn't become tainted I store it in my home directory. I never install the alsa modules that come with slackware. Can't remember the logic behind this other that whenever I installed a new kernel or recompiled alsa went pear shaped. When installin a new kernel I always have to recompile.

#!/bin/bash

/bin/rm -R /usr/lib/alsa-driver*
/bin/rm -R /usr/lib/alsa-lib*
/bin/rm -R /usr/lib/alsa-utils*

cp /home/alex/slackware/ALSA/alsa* /usr/lib

cd /usr/lib
bunzip2 alsa-driver*
tar -xf alsa-driver*
cd /usr/lib/alsa-driver*
./configure --with-cards=intel8x0 --with-sequencer=yes;make;make install

./snddevices

cd /usr/lib
bunzip2 alsa-lib*
tar -xf alsa-lib*
cd /usr/lib/alsa-lib*
./configure;make;make install

cd /usr/lib
bunzip2 alsa-utils*
tar -xf alsa-utils*
cd /usr/lib/alsa-utils*
./configure;make;make install

amixer set 'PCM' 60 unmute
amixer set 'Master Digital' 60 unmute
alsactl store

if [ -x /etc/rc.d/rc.alsa ]; then exec /etc/rc.d/rc.alsa start; fi



here follows a script called /usr/bin/aik_kernel_install. It will always overwrite that supplied by slackware if the same linux version number is supplied. Note it takes a copy of the config but not in the same place as the one from the compile above. Therefore I hav a history of configs that I compile against and a copy of the one I've installed.

#!/bin/bash

if [ "$1" = "" ]; then
echo must enter the linux version number
exit -1
fi

cd /usr/src/linux

/bin/cp arch/i386/boot/bzImage /boot/vmlinuz-ide-$1
/bin/cp /usr/src/linux/.config /boot/config-ide-$1
/bin/cp /usr/src/linux/.config /home/alex/slackware/config-ide-$1
/bin/cp /usr/src/linux/System.map /boot/System.map-ide-$1

best of luck
 
  


Reply



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 = kernel panic Tons of Fun Debian 5 07-02-2005 01:59 PM
Compiling kernel module for linux kernel 2.4 in 2.6 guam Linux - Software 0 01-13-2005 02:02 AM
Where Is Kernel Directory In Rh9(kernel 2.4.20-8), For Compiling HSP56 MR(pctel) Mode rudy3107 Linux - Software 1 07-25-2004 04:17 AM
Help! Everything seems to be compiling into kernel! KuRe Slackware 18 12-17-2003 08:04 PM
Kernel compiling and module compiling tarballed Linux - General 1 12-22-2002 05:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 03:08 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration