Note: You are viewing an old version of this page. View the current version.

Plugin RawHtml disabled. Raw HTML is only allowed in locked pages.
<?plugin RawHtml
<pre class="brush: bash;">
#!/bin/sh
#
# Copyright (C) 1995 - 1998, Ian A. Murdock <imurdock@debian.org>
# Copyright (C) 1998, 1999, Guy Maor
# Copyright (C) 2002, Matthew Wilcox
# Copyright (C) 2002, 2004, 2005, 2007, Clint Adams
#
# Install the kernel on a Debian Linux system.
#
# This script is called from /usr/src/linux/arch/i386/boot/install.sh.
# If you install it as /sbin/installkernel, you can do a "make install"
# from a generic kernel source tree, and the image will be installed to
# the proper place for Debian GNU/Linux.

set -e

if [ $# -eq 3 ] || [ $# -eq 4 ] ; then
  img="$2"
  map="$3"
  ver="$1"
  if [ $# -eq 4 ] && [ -n "$4" ] ; then
      dir="$4"
  else
      dir="/boot"
  fi
else
  echo "Usage: installkernel <version> <image> <System.map> <directory>"
  exit 1
fi

updatever () {
  if [ -f "$dir/kernel/$1-$ver" ] ; then
    mv "$dir/kernel/$1-$ver" "$dir/kernel/$1-$ver.old"
  fi

  cat "$2" > "$dir/kernel/$1-$ver"

  if test -f "$dir/kernel/$1" ; then
    if test -L "$dir/kernel/$1" &&
       [ "$(readlink -f ${dir}/kernel/${1})" = "${dir}/kernel/${1}-${ver}" ]; then
      ln -sf "$1-$ver.old" "$dir/kernel/$1.old"
    else
      mv "$dir/kernel/$1" "$dir/kernel/$1.old"
    fi
  fi

  ln -sf "$1-$ver" "$dir/kernel/$1"
}

if [ "$(basename $img)" = "vmlinux" ] ; then
  updatever vmlinux "$img"
else
  updatever kernel "$img"
fi
updatever System.map "$map"

config=$(dirname "$map")
config="${config}/.config"
if [ -f "$config" ] ; then
  updatever config "$config"
fi

#if [ "$(basename $img)" = "vmlinux" ] && [ "$(id -u)" = "0" ] ; then
#  mkboot -i ${dir}/vmlinux-${ver}
#else
#  mkboot -i ${dir}/vmlinuz-${ver}
#fi
</pre>
?>