Since you said:
Quote:
|
Not for a specific purpose, but for gain some experience.
|
Here is the way I have been building vanilla kernels from kernel.org. Every unique new kernel build results in a system that is over 1/2 GB larger. The kernel build takes 1-2 hours on my PIII 800.
This is a script I called KMAKE which I put in /root/ which is root's home directory.
Note: replace linux-X.X.X with the real name, e.g., linux-2.6.21
Must manually do the steps up to and including:
make menuconfig
Then, from /usr/src/linux-X.X.X, I either do:
~/KMAKE
or do the steps manually one by one.
The lines beginning with # are comments and are steps that I run before/after the compilation steps.
Code:
# Here, I violate everybody else's idea, but it works for me (I don't fear root)
#Download vanilla sources from www.kernel.org (get the .bz2 -- more compressed)
#Become root with:
#su -
#Copy the downloaded linux-X.X.X.tar.bz2 to /usr/src/
#cd /usr/src/
#tar -xjf linux-X.X.X.tar.bz2
#cd linux-X.X.X
#NOTE: Not use the exact name of "/usr/src/linux" because that historically conflicts
#copy in a .config from a working kernel
#make menuconfig
#compile and make modules with this command (to avoid waiting on each step)
date > World.log && make bzImage >> World.log 2>&1 \
&& make modules >> World.log 2>&1 \
&& make modules_install >> World.log 2>&1 && date >> World.log
#... check progress now and then from another terminal with tail -f World.log
if [ -f arch/i386/boot/bzImage ]
then
VERSION=$(grep "Linux kernel version:" .config | sed "s/^[^0-9]*//")
read -p "VERSION: [$VERSION]" VERSION_Q
if [ -n "$VERSION_Q" ]
then
VERSION=$VERSION_Q
fi
echo "VERSION: $VERSION"
read -p "OK? " ubok
if [ "$ubok" = "y" ]
then
#I have seen other people say 'make install' instead of these next steps,
# but I haven't tried that.
mkinitrd -f /boot/initrd-${VERSION}.img $VERSION
cp arch/i386/boot/bzImage /boot/vmlinuz-$VERSION
cp System.map /boot/System.map-$VERSION
ls -lt /boot | sed 4q 2>&1 >> World.log
fi
fi
#Remove 1+- GB of interim work files that will never again be used:
#cd /usr/src/linux-X.X.X
#make clean
Now, one more step is to edit grub to put the new kernel as an option.
Then, after booting into the new kernel, if there are any custom modules you have made, they must be recompiled to the new kernel to use them.
2 examples of modules I have to remake are the martian modem driver and the kqemu module for qemu virtualizaion.