summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern B. Brandenburg <bbb@cs.unc.edu>2010-11-01 17:11:42 -0400
committerBjoern B. Brandenburg <bbb@cs.unc.edu>2010-11-01 17:11:42 -0400
commit2b67e23c9482cf31a2968240364a826fb600b974 (patch)
tree716f14ad4f4252fca786beb151b4d2cfc97d3749
parentac8a3c832addc68ee4ad01337a17f63bdb4138ab (diff)
add install script for District10
This currently assumes installing from Ludwig to Jupiter via NFS.
-rwxr-xr-xinstall_kernel.district10118
1 files changed, 118 insertions, 0 deletions
diff --git a/install_kernel.district10 b/install_kernel.district10
new file mode 100755
index 0000000..00eb7c6
--- /dev/null
+++ b/install_kernel.district10
@@ -0,0 +1,118 @@
1#!/bin/bash
2
3TFTP_DIR=/home/nfsroot/tftp-boot
4BOOT_LINK=uImage
5
6USER_TAG=$USER
7if [ ! -z "$SUDO_USER" ]
8then
9 USER_TAG=$SUDO_USER
10fi
11
12MAKE_ACTIVE=
13
14function die()
15{
16 echo " (EE) $1"
17 exit 1
18}
19
20function info()
21{
22 echo " (II) $1"
23}
24
25function silent()
26{
27 OUTPUT=`$*`
28 if [ "$?" != "0" ]; then
29 echo $OUTPUT
30 die "$* failed!"
31 fi
32}
33
34function usage()
35{
36 cat <<EOF
37Usage: install_kernel.district10 [--activate]
38
39Options:
40 --activate Point uImage symlink to newly installed kernel.
41
42Note: must be invoked in kernel src directory.
43EOF
44}
45
46while [ ! -z "$1" ]
47do
48 case $1 in
49 --activate)
50 shift
51 MAKE_ACTIVE=yes
52 ;;
53 --help|-h)
54 usage
55 exit 0
56 ;;
57 *) # unknown argument
58 echo "Unknown argument $1"
59 usage
60 exit 1
61 ;;
62 esac
63done
64
65
66if [ ! -f "./.config" ]; then
67 CURDIR=`pwd`
68 die "No kernel .config exists in $CURDIR!"
69fi
70
71if [ ! -f "./Makefile" ]; then
72 die "No Makefile present!"
73fi
74
75NAME=`cat include/config/kernel.release`
76NAME=${NAME/%\+/} # remove trailing '+' (if any)
77
78if [ -z "$NAME" ]
79then
80 die "Could not determine kernel version!"
81fi
82
83info "Detected kernel version $NAME"
84
85if [ $UID != "0" ]; then
86 die "Must be root to install kernel!"
87fi
88
89if [ ! -d "$TFTP_DIR" ]
90then
91 die "TFTP directory $TFTP_DIR does not exist. Is the NFS root mounted?"
92fi
93
94KERNEL="uimage-${USER_TAG}-${NAME}"
95UIMAGE="${TFTP_DIR}/$KERNEL"
96CONFIG="${UIMAGE}.config"
97SYSMAP="${UIMAGE}.System.map"
98
99# (1) Copy kernel
100info "Copy uImage to $UIMAGE"
101silent cp -v arch/arm/boot/uImage "$UIMAGE"
102
103# (2) .config
104info "Copy .config to $CONFIG"
105silent cp -v .config "$CONFIG"
106
107# (3) System.map
108info "Copy System.map to $SYSMAP"
109silent cp -v System.map "$SYSMAP"
110
111if [ -n "$MAKE_ACTIVE" ]
112then
113 info "Pointing kernel symlink $BOOT_LINK to $KERNEL"
114 cd "$TFTP_DIR"
115 [ -L "$BOOT_LINK" ] || die "expected $BOOT_LINK in $TFTP_DIR to be a symbolic link."
116 silent rm "$BOOT_LINK"
117 silent ln -s "$KERNEL" "$BOOT_LINK"
118fi