install-kernel -- A program to help automate installing a vanilla kernel
I just recently finished writing a program that will help automate the task of compiling a kernel, with some help from dylunio and Cabhan in the "Linux Programming & Scripting" section of this forum.
How you would run the program:
kernel-version is the version of the kernel you'd like to install, without "linux-" in front of it. so, if you'd like to install 184.108.40.206 (the newest), you would type: "220.127.116.11" where kernel-version is.
install-kernel <kernel-version> <grub/lilo> <boot mount point> <root mount point>
grub/lilo is where you type what your bootloader is, between the choices of grub and lilo. if left blank, grub will be chosen automatically.
boot mount point is where you specify where "/boot" is mounted, if necessary. if none is specified than it will use your root mount point "/", which is explained next.
root mount point is where you specify where your root partition is...where your operating system is.
if both boot and root mount points aren't specified, than hda1 will be automatically set for both.
other things you can do:
...will show you the following information...
install-kernel -s (--show)
1) the kernel currently in use (using "uname -r")
2) the current kernel version symlinked to /usr/src/linux (using "ls -s /usr/src/linux")
3) the current kernel sources found in /usr/src (using "ls /usr/src")
will show a summary of what i've explained above
install-kernel -h (--help)
Who can use it to its full potential:
any grub/lilo users and any 2.4 or 2.6 kernel users who wish to use stable releases of vanilla kernels
What this program actually does when installing a kernel (in detail):
1. It first shows you what version kernel it's looking for (2.4 or 2.6), it states boot is mounted, and it states where root is mounted....before doing anything else
2. It checks to make sure that /usr/src/linux exists and, if it does, it uses the .config file found in /usr/src/linux
3. It downloads the kernel you specify from the vanilla kernel sources website, whether it's a 2.4 kernel or a 2.6 kernel
4. It removes any other instances of a kernel with the same version as the one you're currently downloading (it prevents potential problems from arising later in the install)
5. It unpacks the kernel source to /usr/src
6. It makes sure the kernel unpacked ok
7. It removes the symlink /usr/src/linux
8. It symlinks your new kernel to /usr/src/linux and copies the .config file (kernel settings from previous kernel) so the new kernel can use it
9. It compiles it according to your kernel version (2.4 or 2.6)
10. It copies bzImage and .config to your /boot directory for use by the bootloader
11. It creates an entry for this kernel in your bootloader's screen (grub or lilo) at the bottom of the list
In short: It does everything necessary to upgrade a kernel for you, and everything but choose your kernel options when installing a new kernel :D
For those interested, LINK TO DOWNLOAD
It comes out to a little under 13kb :D
To install the program:
(/usr/sbin/ may be /sbin/ on some distributions)
mv /dir/to/file /usr/sbin/
(once again, this may be /sbin/ instead)
chmod a=w+r+x /usr/sbin/install-kernel
Please leave a message here or send me an e-mail with any comments, suggestions, or bug info.
My e-mail address is email@example.com
I'm especially interested in responses from those who run a v2.4 kernel, who run lilo as their bootloader, or those who don't have a separate /boot partition. I was unable to test those (I don't have my system set up for these options). I checked the code several times more than that of the grub and v2.6 sections for accuracy and making sure it's written correctly, and as far as I can tell it looks perfect. The v2.6 and grub sections definitely work, though, as I installed a few kernels on my machine to test the program :D