File: glantank-update-kernel

package info (click to toggle)
glantank 1.4
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 304 kB
  • ctags: 3
  • sloc: sh: 73; makefile: 29
file content (48 lines) | stat: -rwxr-xr-x 888 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/sh

# Copyright (C) 2006  Martin Michlmayr <tbm@cyrius.com>

# This code is covered by the GNU General Public License.

set -e

error() {
	echo "$@" >&2
	exit 1
}

if [ -n "$1" ]; then
	kvers="$1"
	kfile=/boot/vmlinuz-$kvers
	ifile=/boot/initrd.img-$kvers
else
	if [ -e /vmlinuz ]; then
		kfile=/vmlinuz
		ifile=/initrd.img
	elif [ -e /boot/vmlinuz ]; then
		kfile=/boot/vmlinuz
		ifile=/boot/initrd.img
	else
		error "Cannot find a default kernel in /vmlinuz or /boot/vmlinuz"
	fi
fi

if [ ! -e $kfile ] || [ ! -e $ifile ]; then
	error "Can't find $kfile and $ifile"
fi

machine=$(grep "^Hardware" /proc/cpuinfo | sed 's/Hardware\s*:\s*//')
case "$machine" in
	"GLAN Tank")
		rm -f /boot/initrd /boot/zImage
		ln -s $(basename $ifile) /boot/initrd
		(
			devio 'wl 0xe3a01c04,4' 'wl 0xe381104c,4'
			cat $kfile
		) > /boot/zImage
	;;
	*)
		error "Unsupported platform."
	;;
esac