18c2ecf20Sopenharmony_ci#!/bin/sh
28c2ecf20Sopenharmony_ci#
38c2ecf20Sopenharmony_ci# arch/arm/boot/install.sh
48c2ecf20Sopenharmony_ci#
58c2ecf20Sopenharmony_ci# This file is subject to the terms and conditions of the GNU General Public
68c2ecf20Sopenharmony_ci# License.  See the file "COPYING" in the main directory of this archive
78c2ecf20Sopenharmony_ci# for more details.
88c2ecf20Sopenharmony_ci#
98c2ecf20Sopenharmony_ci# Copyright (C) 1995 by Linus Torvalds
108c2ecf20Sopenharmony_ci#
118c2ecf20Sopenharmony_ci# Adapted from code in arch/i386/boot/Makefile by H. Peter Anvin
128c2ecf20Sopenharmony_ci# Adapted from code in arch/i386/boot/install.sh by Russell King
138c2ecf20Sopenharmony_ci#
148c2ecf20Sopenharmony_ci# "make install" script for arm architecture
158c2ecf20Sopenharmony_ci#
168c2ecf20Sopenharmony_ci# Arguments:
178c2ecf20Sopenharmony_ci#   $1 - kernel version
188c2ecf20Sopenharmony_ci#   $2 - kernel image file
198c2ecf20Sopenharmony_ci#   $3 - kernel map file
208c2ecf20Sopenharmony_ci#   $4 - default install path (blank if root directory)
218c2ecf20Sopenharmony_ci#
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_civerify () {
248c2ecf20Sopenharmony_ci	if [ ! -f "$1" ]; then
258c2ecf20Sopenharmony_ci		echo ""                                                   1>&2
268c2ecf20Sopenharmony_ci		echo " *** Missing file: $1"                              1>&2
278c2ecf20Sopenharmony_ci		echo ' *** You need to run "make" before "make install".' 1>&2
288c2ecf20Sopenharmony_ci		echo ""                                                   1>&2
298c2ecf20Sopenharmony_ci		exit 1
308c2ecf20Sopenharmony_ci	fi
318c2ecf20Sopenharmony_ci}
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci# Make sure the files actually exist
348c2ecf20Sopenharmony_civerify "$2"
358c2ecf20Sopenharmony_civerify "$3"
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci# User may have a custom install script
388c2ecf20Sopenharmony_ciif [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi
398c2ecf20Sopenharmony_ciif [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ciif [ "$(basename $2)" = "zImage" ]; then
428c2ecf20Sopenharmony_ci# Compressed install
438c2ecf20Sopenharmony_ci  echo "Installing compressed kernel"
448c2ecf20Sopenharmony_ci  base=vmlinuz
458c2ecf20Sopenharmony_cielse
468c2ecf20Sopenharmony_ci# Normal install
478c2ecf20Sopenharmony_ci  echo "Installing normal kernel"
488c2ecf20Sopenharmony_ci  base=vmlinux
498c2ecf20Sopenharmony_cifi
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ciif [ -f $4/$base-$1 ]; then
528c2ecf20Sopenharmony_ci  mv $4/$base-$1 $4/$base-$1.old
538c2ecf20Sopenharmony_cifi
548c2ecf20Sopenharmony_cicat $2 > $4/$base-$1
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci# Install system map file
578c2ecf20Sopenharmony_ciif [ -f $4/System.map-$1 ]; then
588c2ecf20Sopenharmony_ci  mv $4/System.map-$1 $4/System.map-$1.old
598c2ecf20Sopenharmony_cifi
608c2ecf20Sopenharmony_cicp $3 $4/System.map-$1
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ciif [ -x /sbin/loadmap ]; then
638c2ecf20Sopenharmony_ci  /sbin/loadmap
648c2ecf20Sopenharmony_cielse
658c2ecf20Sopenharmony_ci  echo "You have to install it yourself"
668c2ecf20Sopenharmony_cifi
67