Last active
November 13, 2015 07:10
-
-
Save zakkak/5897199eff460453cf3b to your computer and use it in GitHub Desktop.
installkernel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Arguments: | |
# $1 - kernel version | |
# $2 - kernel image file | |
# $3 - kernel map file | |
# $4 - default install path (blank if root directory) | |
# define input variables | |
# | |
# assume default install path is /boot | |
if [ -z $4 ]; then | |
install_path=$4; | |
else | |
install_path=/boot; | |
fi | |
kver=$1 | |
kimg=$2 | |
kmap=$3 | |
vmlinuz=$install_path/vmlinuz-$kver | |
sysmap=$install_path/System.map-$kver | |
kconfig=$install_path/kconfig-$kver | |
initramfs=$install_path/initramfs-$kver.img | |
# | |
# check for previous versions | |
# | |
if [ -f $vmlinuz ]; then cp $vmlinuz $vmlinuz.old; fi | |
if [ -f $initramfs ]; then cp $initramfs $initramfs.old; fi | |
# if [ -f $sysmap ]; then cp $sysmap $sysmap.old; fi | |
# if [ -f $kconfig ]; then cp $kconfig $kconfig.old; fi | |
# | |
# install the image and map files | |
# | |
cat $kimg > $vmlinuz | |
# cp $kmap $sysmap | |
# cp $(dirname "$kmap")/.config $kconfig | |
# | |
# install the initramfs | |
# | |
mkinitcpio -k $vmlinuz -c /etc/mkinitcpio.conf -g $initramfs | |
# | |
# Check for grub, then lilo | |
# | |
# In the Grub menu you can use two menu entries, one pointing to | |
# kernel-newest and one to kernel-previous. | |
if [ -d $install_path/grub ]; then | |
# mv $install_path/kernel-newest $install_path/kernel-previous | |
# cp $vmlinuz $install_path/kernel-newest | |
update-grub | |
elif [ -x /sbin/lilo ]; then | |
/sbin/lilo -v | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment