|
L i n u x H e l p
: :
: :
: :
: :
|
How to build a kernel
Here are some quick instructions on how to build and install a new kernel. (these instructions are not all inclusive, just a quick reference guide).
The latest stable source can be downloaded via ftp at ftp.kernel.org. Keep in mind that the current source is in the neighborhood of 25MB.
rm -f /usr/src/linux
mv linux-X.X.X.tar.gz /usr/src
cd /usr/src
tar -zxvf linux-X.X.X.tar.gz
mv linux linux-X.X.X
ln -s linux-X.X.X linux
cd linux
Ok. Now we have the kernel source unpacked and placed in the directory /usr/src/linux where we want it. We are ready to start building the kernel now. *The following steps must be executed in the same order that they are listed here. make mrproper; make menuconfig; make dep; make clean; make bzImage; make modules; make modules_install
make mrproper - Removes any old build files. If this is a new source tree, there shouldn't be any, but it doesn't hurt to run this the first time you build a kernel.
make menuconfig (or xconfig if you prefer a gui) - This step is the most difficult one. You need to step through *all* of the kernel options and make sure that you enable everything you need. Keep in mind to also disable options that you don't need, as a smaller kernel runs faster. Using modules is a good way to minimize your kernel. *Pay attention here, take your time and read the help section for the options that you don't understand.
make dep - Builds all of the kernel dependencies
make clean - purges any old builds from the build directory
make bzImage - This step is what actually builds your kernel. When this step completes, you will have a file called /usr/src/linux/arch/i386/boot/bzImage . This is your new kernel!
mv bzImage /boot/vmlinuz-X.X.X-new - put the new kernel into the boot directory, making sure not to over-write any old kernels (we want to save the old in case our new kernel doesn't boot)
If you are using modules, you will need to run the following two commands to build and install your modules.
make modules - builds kernel modules
make modules_install - installs kernel modules in /lib/modules/X.X.X
Now our new kernel is built and in place, all we have to do is add the new kernel to lilo or whatever boot loader you use. I will only cover lilo (LInux LOader) here.
Using your favorite editor (I like vi), add the following lines to /etc/lilo.conf
image=/boot/vmlinuz-X.X.X-new
label=new
root=/dev/hda1
read-only
Now run the command /sbin/lilo to get lilo to reread its config file. It should output something like:
[root@localhost linux]# /sbin/lilo
Added linux *
Added new
Go through and double check to ensure that you haven't missed anything and reboot your box (shutdown -ry now). At the lilo prompt, type 'new' and cross your fingers in hopes that it will boot ;-)
Good Luck!
-Rick
Broaden your knowledge base with one of these great books from Amazon.com.
A>
More information can be found in the linux kernel-HOWTO at http://blah.math.tu-graz.ac.at/~bri/kernel-howto/. Enjoy!
|
|
|
|
|
L i n u x W o r l d N e w s
: :
: :
: :
: :
|
|
|
What in the hell is a KrnlPanic? Well, a KrnlPanic is me! Actually, let's start with "What is a kernel?". The
kernel is the core of your operating system (OS), whether your OS is Linux, Unix or windows. The kernel takes
care of all process management (what program runs and when), memory management (which parts of memory get used for what) and
also, the kernel takes care of interfacing the OS with your computer's hardware (disk drives, sound card, modem, network card, etc).
Now...since the kernel is doing all of these extremely important jobs, it stands to reason
that if it has an error, it will be a Bad Thing(tm).
If you use windows, you know a kernel panic as a "BSOD" or Blue Screen of Death. Or how about "Invalid Page
Fault in KERNEL32.DLL". I'm sure you've probably seen both of those. In Linux, a Kernel Panic is normally plainly stated
so. At boot time is when you will see most linux panics. I have yet to see a linux kernel panic while the system is running.
You may have seen "Kernel Panic: init not found" or "Kernel Panic: VFS unable to mount root fs on 2:00". All of these previously
listed errors are because of something that happened to the kernel that it couldn't handle, whether it was an access to an
invalid memory location or the inability to find the initialization files it requires.
I hope that sufficiently explains things. Oh yeah...KrnlPanic is also my name ;-)
- Rick
|
|
|
|
|
|
S l a s h d o t / F r e s h m e a t
: :
: :
: :
: :
|
Slashdot and Freshmeat Headlines at 1219201070
(Unixtime)
|
|
|
|