Merge branch 'topic/ppc-kvm' into next
[linux-2.6-microblaze.git] / arch / powerpc / boot / install.sh
1 #!/bin/sh
2 #
3 # This file is subject to the terms and conditions of the GNU General Public
4 # License.  See the file "COPYING" in the main directory of this archive
5 # for more details.
6 #
7 # Copyright (C) 1995 by Linus Torvalds
8 #
9 # Blatantly stolen from in arch/i386/boot/install.sh by Dave Hansen 
10 #
11 # "make install" script for ppc64 architecture
12 #
13 # Arguments:
14 #   $1 - kernel version
15 #   $2 - kernel image file
16 #   $3 - kernel map file
17 #   $4 - default install path (blank if root directory)
18 #
19
20 # Bail with error code if anything goes wrong
21 set -e
22
23 verify () {
24         if [ ! -f "$1" ]; then
25                 echo ""                                                   1>&2
26                 echo " *** Missing file: $1"                              1>&2
27                 echo ' *** You need to run "make" before "make install".' 1>&2
28                 echo ""                                                   1>&2
29                 exit 1
30         fi
31 }
32
33 # Make sure the files actually exist
34 verify "$2"
35 verify "$3"
36
37 # User may have a custom install script
38
39 if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi
40 if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi
41
42 # Default install
43
44 # this should work for both the pSeries zImage and the iSeries vmlinux.sm
45 image_name=`basename $2`
46
47 if [ -f $4/$image_name ]; then
48         mv $4/$image_name $4/$image_name.old
49 fi
50
51 if [ -f $4/System.map ]; then
52         mv $4/System.map $4/System.old
53 fi
54
55 cat $2 > $4/$image_name
56 cp $3 $4/System.map