Vanstechelman.eu
   

Copy a new kernel to /boot

I wrote this little script to update my kernel in the boot partition when I recompiled a new one. It copies the old kernel and the old configuration so that you can reuse it later if something would be wrong with the new one.
The script assumes that you have a separate boot partition.
#!/bin/sh

echo "Identify kernel name"
KERNEL=$(uname -r)
echo "Kernel is: $KERNEL"

echo "Mounting boot-partition"
mount /boot/

echo "Backup old kernel and System.map"
cp /boot/kernel-$KERNEL /boot/kernel-$KERNEL.old
cp /boot/System.map-$KERNEL /boot/System.map-$KERNEL.old
cp /boot/config-$KERNEL /boot/config-$KERNEL.old

echo "Copy new kernel and System.map"
cp /usr/src/linux/arch/i386/boot/bzImage /boot/kernel-$KERNEL
cp /usr/src/linux/System.map /boot/System.map-$KERNEL
cp /usr/src/linux/.config /boot/config-$KERNEL

echo "Umounting boot-partition"
umount /boot/