Building Kernels

OK, lets say you have found the kernel source and configured the kernel in the manner you find most agreeable. Now you actually want to build the thing. Do this:

	cd /usr/src/linux
	make dep
	make bzImage
If you are building the kernel on an SMP machine, consider:
	make -j 4 bzImage

If you want a log of the whole process, the following will work.

	make bzImage >make.log 2>&1
If you have a clean source tree and have never before built a kernel on this machine, building a kernel could take a while. Actually on todays machines it is no big deal. When this is done you will be wondering where in the heck the kernel image is. Don't be fooled by the vmlinux you see in /usr/src/linux, what you want is:
	/usr/src/linux/arch/i386/boot/bzImage
This is the compressed kernel image which you are going to copy to /boot/vmlinuz (or the moral equivalent thereof). Apparently, once upon a time, linux was small enough to boot without any compression monkey-business. Then compressed zImages were invented, and sometime later big zImages came along, hence the bzImage that seems ubiquitous today.

If you meet all the prerequisites, you could just type:

	make bzlilo
And voila, it puts vmlinuz into /boot for you, (it may even run /sbin/lilo as well -- maybe this would be a good idea!) If you are old fashioned like me, do this:
	cd /usr/src/linux/arch/i386/boot
	cp bzImage /boot/vmlinuz
	/sbin/lilo

And, while you are at it, put an up to date copy of System.map into /boot:

	cd /usr/src/linux
	cp System.map /boot/System.map-2.2.16-3smp
	cd /boot
	rm -f System.map
	ln -s System.map-2.2.16-3smp System.map

If you are using modules, you will also need to do this: (see my notes on modules for more information.)

	make modules
	make modules_install
Now you should be ready to reboot. If you are smart, you have kept an old kernel you can select via lilo to boot up, just in case things go sour.