LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 02-26-2005, 06:23 AM   #1
nazib
LQ Newbie
 
Registered: Nov 2004
Location: bangladesh
Distribution: Redhat 9
Posts: 23

Rep: Reputation: 15
how i compile a source code?


hi ,

After modifying the kernel source code how i compile it and run it??
is compilation and execution is same for all distro?

Thanks.
Nazib
 
Old 02-26-2005, 07:55 AM   #2
oneandoneis2
Senior Member
 
Registered: Nov 2003
Location: London, England
Distribution: Ubuntu
Posts: 1,460

Rep: Reputation: 48
Assuming it's a 2.6 kernel, my usual steps are:

Copy the current kernel, /boot/vmlinuz, to a backup - say, /boot/vmlinuzold

cd /usr/src/linux

make menuconfig


Change the setup appropriately

make

make modules_install

cp arch/i386/boot/bzImage /boot/vmlinuz

cp System.map /boot/System.map


Then reboot. If the new kernel doesn't work, use the old one you cleverly backup up earlier.
 
Old 02-26-2005, 08:42 AM   #3
harken
Member
 
Registered: Jan 2005
Location: Between the chair and the desk
Distribution: Debian Sarge, kernel 2.6.13
Posts: 666

Rep: Reputation: 30
Isn't there something missing?
Quote:
make menuconfig
Change the setup appropriately
make
make modules_install
cp arch/i386/boot/bzImage /boot/vmlinuz
cp System.map /boot/System.map
Shouldn't it be:
Code:
make menuconfig
make bzImage
make modules
make modules_install
cp arch/i386/boot/bzImage /boot/bzImage-version
cp System.map /boot/System.map-version
and, if necessary
mkinitrd /boot/initrd-version version
I thought this were the steps.
 
Old 02-26-2005, 08:44 AM   #4
amosf
Senior Member
 
Registered: Jun 2004
Location: Australia
Distribution: Mandriva/Slack - KDE
Posts: 1,672

Rep: Reputation: 46
bad move to change the old kernel name too... Never ever touch the old kernel...

leave the old kernel and lilo entry in place, compile the new kernel, copy to /boot and add a lilo entry for that. This way if the new kernel won't boot you can still boot with the old kernel...

Last edited by amosf; 02-26-2005 at 08:46 AM.
 
Old 02-27-2005, 05:09 AM   #5
/bin/bash
Senior Member
 
Registered: Jul 2003
Location: Indiana
Distribution: Mandrake Slackware-current QNX4.25
Posts: 1,802

Rep: Reputation: 47
With the 2.6 kernel make or make all will combine several steps so you don't need to do separate make bzImage make modules anymore.
 
Old 02-27-2005, 10:13 AM   #6
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233

Rep: Reputation: 406Reputation: 406Reputation: 406Reputation: 406Reputation: 406
Quote:
Originally posted by amosf
bad move to change the old kernel name too... Never ever touch the old kernel...

leave the old kernel and lilo entry in place, compile the new kernel, copy to /boot and add a lilo entry for that. This way if the new kernel won't boot you can still boot with the old kernel...
precicely... if the old kernel is not accessible from the boot loader and the new kernel FUBaRs then your SOL, but if the old kernel can be accessed, then you can still boot from it and rebuild the new kernel and try agin.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
First Post! Unable to compile source code J--Lew Linux - Newbie 5 08-16-2005 04:17 PM
Why can't FreeBSD compile anything from source code? mortal *BSD 5 03-21-2005 08:49 PM
how to compile redhat 9.0 source code. wood Linux - General 5 09-16-2003 11:05 AM
Can't compile source code in Slackware 9.0 kernel 2.4.20) GrandTheft Slackware 2 04-29-2003 11:52 AM
How to compile source code... Grim Reaper Linux - Newbie 3 04-26-2002 12:28 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:12 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
Open Source Consulting | Domain Registration