LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   how i compile a source code? (https://www.linuxquestions.org/questions/linux-general-1/how-i-compile-a-source-code-295056/)

nazib 02-26-2005 05:23 AM

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

oneandoneis2 02-26-2005 06:55 AM

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.

harken 02-26-2005 07:42 AM

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.

amosf 02-26-2005 07:44 AM

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...

/bin/bash 02-27-2005 04:09 AM

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.

frieza 02-27-2005 09:13 AM

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.


All times are GMT -5. The time now is 09:40 PM.