LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-08-2004, 02:36 PM   #1
minm
Member
 
Registered: Jun 2003
Location: Canada
Distribution: suse 9.2
Posts: 582

Rep: Reputation: 30
Compiling kernel


Hey, i think i'm ready to compile my first kernel

The main reason i want to compile it is to get lm_sensors to work...

Anyways i went through yast and downloaded an upgraded kernel.. the path to it is /usr/src/linux-2.6.5-7.111

Now i was wondering what do i do next?
 
Old 11-08-2004, 03:27 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 66
Take a look at this:
http://wiki.linuxquestions.org/wiki/Compiling_a_kernel

Just a side note but 2.6.9 is the latest available vanila release:
http://www.kernel.org
 
Old 11-08-2004, 08:09 PM   #3
jev-bird
Member
 
Registered: Jul 2004
Location: USofA
Distribution: Whatever runs accordingly.
Posts: 200

Rep: Reputation: 30
Another quick and dirty for 2.6.x kernels

rm /etc/localtime ; cp /usr/share/zoneinfo/yourtimezone /etc/localtime

cd /usr/src/ ; ls

ln -s /usr/src/linux-2.6.5-7.111 linux

cd linux ; make menuconfig

make bzImage && make modules && make modules_install

After that the kernel should be ready. There are many avenues to take in regard to how you want to go about installing the kernel. Generally they consist of copying bzImage, System.map and .config over to boot. Then you simply edit whatever bootloader your using and specify the correct path to your new kernel.

There is an abundance of material at your disposal to help you do that. However, I think the readme at kernel.org is a bit outdated or maybe not? Good luck.
 
Old 11-08-2004, 08:19 PM   #4
OrphanedLand
LQ Newbie
 
Registered: Dec 2003
Distribution: Slackware
Posts: 26

Rep: Reputation: 15
# cd /usr/src/linux-2.6.x
# make menuconfig
# make
# make modules_install
# cp arch/i386/boot/bzImage /boot/vmlinuz-2.6.x
# cp System.map /boot/System.map-2.6.x
# cp .config /boot/config-2.6.x

'make bzImage' and 'make modules' no longer needed since they are part of the 'make' command. And dont forget to make a link in your bootloader for your new kernel.

Enjoy with your new kernel
 
Old 11-08-2004, 08:41 PM   #5
egag
Senior Member
 
Registered: Jul 2004
Location: Netherlands
Distribution: Slackware
Posts: 2,721

Rep: Reputation: 52
hi,

quote/ ( jev-bird )
rm /etc/localtime ; cp /usr/share/zoneinfo/yourtimezone /etc/localtime

cd /usr/src/ ; ls

ln -s /usr/src/linux-2.6.5-7.111 linux
/endquote

what is the use of the first command regarding the timezone ?
furthermore you don't need to set the link.
i think OrphanedLand posted the shortest way to build/install a kernel & modules.

egag
 
Old 11-08-2004, 08:53 PM   #6
jev-bird
Member
 
Registered: Jul 2004
Location: USofA
Distribution: Whatever runs accordingly.
Posts: 200

Rep: Reputation: 30
Quote:
Originally posted by egag
hi,

quote/ ( jev-bird )
rm /etc/localtime ; cp /usr/share/zoneinfo/yourtimezone /etc/localtime

cd /usr/src/ ; ls

ln -s /usr/src/linux-2.6.5-7.111 linux
/endquote

what is the use of the first command regarding the timezone ?
furthermore you don't need to set the link.
i think OrphanedLand posted the shortest way to build/install a kernel & modules.

egag
My post was based on the way I have built my kernels in the past. Not based on a tutorial site. Don't get me wrong, thoose resources are quite useful but once you compiled a kernel several times you pretty much get a feel for the way "you" do it and not the way a third party stipulates for it to be done. The reason for that is that there are many distros and the method basically varies.

For the time zone sometimes mine gets screwed up when I compile a kernel. That generally has only happened to me on Gentoo but it's a safe way to go about it. And when I don't set a link as I did my Nvidia drivers fail to install unless that link is there. So what may work for me may not be sensible or even pertain for that matter to you and your kernel.

@ OrphanedLand -- thank you for informing me about the make command. I'll take that into consideration the next time I build. Also I seem to recall that 'make install' will copy the bzImage, system.map and .config over to boot for you, once again I guess that depends on the distro.
 
Old 11-08-2004, 09:10 PM   #7
egag
Senior Member
 
Registered: Jul 2004
Location: Netherlands
Distribution: Slackware
Posts: 2,721

Rep: Reputation: 52
thanks for clearing things up about the timezone-thing. i really have never heard or read about that,
but maybe in the future i'll meet that prob.....

and to let " make install " do all the copying for you, you have to edit the make-file in the /usr/src/linux-2.x.x dir. change/set the install_path to /boot.
( somewhere around line 247 ) thats from memory, i always copy things with the keyb-commands.

egag
 
Old 11-08-2004, 09:19 PM   #8
jev-bird
Member
 
Registered: Jul 2004
Location: USofA
Distribution: Whatever runs accordingly.
Posts: 200

Rep: Reputation: 30
Quote:
Originally posted by egag
thanks for clearing things up about the timezone-thing. i really have never heard or read about that,
but maybe in the future i'll meet that prob.....

and to let " make install " do all the copying for you, you have to edit the make-file in the /usr/src/linux-2.x.x dir. change/set the install_path to /boot.
( somewhere around line 247 ) thats from memory, i always copy things with the keyb-commands.

egag
No prob and actually made small booboo it should be linked not copied.

ln -sf /usr/share/zoneinfo/GMT /etc/localtime

according to gentoo's documentation.



Also when I ran make install before on "slackware" and a 2.6.8.1 kernel I did not have to edit the makefile, it just copied them all to boot. Oh well the last kernel I compiled was on a FreeBSD box and that practically took the life out of me. Between that and trying to track stable I almost loss my sense of linuxism. Still trying to recooperate.
 
Old 11-08-2004, 09:36 PM   #9
egag
Senior Member
 
Registered: Jul 2004
Location: Netherlands
Distribution: Slackware
Posts: 2,721

Rep: Reputation: 52
jev-bird,

are you really running linspire ?
( i read it on the side of your posts, but maybe it's old ....( i hope ... )

regards

egag
 
Old 11-08-2004, 09:44 PM   #10
jev-bird
Member
 
Registered: Jul 2004
Location: USofA
Distribution: Whatever runs accordingly.
Posts: 200

Rep: Reputation: 30
Quote:
Originally posted by egag
jev-bird,

are you really running linspire ?
( i read it on the side of your posts, but maybe it's old ....( i hope ... )

regards

egag

I've never ran linspire or Lindows, at least I think their the same company........not sure. The truth is I run so many distros that it's just impossible for me to keep updating my profile with the flavor I currently run. Right now Im using Ubuntu, and yesterday it was FreeBSD, before that it was NetBSD and so on and so forth. I just play with all. Tons a fun.
 
Old 11-08-2004, 10:43 PM   #11
minm
Member
 
Registered: Jun 2003
Location: Canada
Distribution: suse 9.2
Posts: 582

Original Poster
Rep: Reputation: 30
well im doing it and i get this

INSTALL sound/usb/snd-usb-lib.ko
if [ -r System.map ]; then /sbin/depmod -ae -F System.map 2.6.9; fi
WARNING: /lib/modules/2.6.9/kernel/drivers/mtd/maps/scx200_docflash.ko needs unknown symbol del_mtd_partitions
WARNING: /lib/modules/2.6.9/kernel/drivers/mtd/maps/scx200_docflash.ko needs unknown symbol add_mtd_partitions

when i do make modules_install

is this normal?

even when i do make modules i get this error

MODPOST
*** Warning: "del_mtd_partitions" [drivers/mtd/maps/scx200_docflash.ko] undefined!
*** Warning: "add_mtd_partitions" [drivers/mtd/maps/scx200_docflash.ko] undefined!
user379:/usr/src/linux #

Last edited by minm; 11-08-2004 at 10:45 PM.
 
Old 11-09-2004, 12:16 AM   #12
jev-bird
Member
 
Registered: Jul 2004
Location: USofA
Distribution: Whatever runs accordingly.
Posts: 200

Rep: Reputation: 30
Quote:
Originally posted by minm
well im doing it and i get this

INSTALL sound/usb/snd-usb-lib.ko
if [ -r System.map ]; then /sbin/depmod -ae -F System.map 2.6.9; fi
WARNING: /lib/modules/2.6.9/kernel/drivers/mtd/maps/scx200_docflash.ko needs unknown symbol del_mtd_partitions
WARNING: /lib/modules/2.6.9/kernel/drivers/mtd/maps/scx200_docflash.ko needs unknown symbol add_mtd_partitions

when i do make modules_install

is this normal?

even when i do make modules i get this error

MODPOST
*** Warning: "del_mtd_partitions" [drivers/mtd/maps/scx200_docflash.ko] undefined!
*** Warning: "add_mtd_partitions" [drivers/mtd/maps/scx200_docflash.ko] undefined!
user379:/usr/src/linux #
The important thing to remember when compiling your own kernel is to disable or omit everything you do not need. Even if your compiling it as a module what it comes down to is will you even end up having to load that module. The less options you include the lighter, faster, and more efficient your kernel will be.

So run lsmod or lspci and see what you already have and go from there. Your bound to get warnings and errors. To prevent that deselect what you don't have or don't want in menuconfig.

You don't have to make menuconfig. Depending on what libraries you have installed you can, for instance make gconfig (gtk required) or make xconfig (qt required). make xconfig and gconfig are very helpful. They provide explanations as to what a specific option does or will do if it is built as a module or compiled in the kernel. After that do as OrphanedLand said and:

make ; make modules_install
etc

Last edited by jev-bird; 11-09-2004 at 12:17 AM.
 
  


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 = kernel panic Tons of Fun Debian 5 07-02-2005 02:59 PM
Compiling kernel module for linux kernel 2.4 in 2.6 guam Linux - Software 0 01-13-2005 03: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 05:17 AM
Compiling new kernel joseph Linux - Software 2 10-14-2003 08:26 AM
Kernel compiling and module compiling tarballed Linux - General 1 12-22-2002 06:31 PM


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

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration