blob: 344444d8cc76470d007823c70e0a840c3bfbd87e (
plain)
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
49
50
51
52
53
54
55
56
|
#!/bin/sh -e
DVHTOOL=/usr/sbin/dvhtool
ARCBOOT_IMG=/usr/lib/arcboot/arcboot.ip22
ARCBOOT_CONF=/etc/arcboot.conf
# system type : RM200-C40
SYSTYPE=`sed -ne '/^system type/ { s/.*: //; p; }' </proc/cpuinfo`
case "$SYSTYPE" in
SGI\ IP32*|SGI\ O2*)
ARCBOOT_IMG=/usr/lib/arcboot/arcboot.ip32
VHNAME=arcboot
;;
RM*)
# We make it aboot as the SNI RM environment in the prom is
# limited to very little chars so we need to make it shorter
ARCBOOT_IMG=/usr/lib/arcboot/arcboot.snirm
VHNAME=aboot
;;
*)
ARCBOOT_IMG=/usr/lib/arcboot/arcboot.ip22
VHNAME=arcboot
esac
if [ ! -r $ARCBOOT_CONF ]; then
echo "No $ARCBOOT_CONF - giving up!"
exit 1
fi
if [ ! -x $DVHTOOL ]; then
echo "Can't find dvhtool - giving up!"
exit 1
fi
if [ -z "$1" ]; then
echo "Usage: arcboot <name_of_disk>"
exit 1
fi
echo -n "Putting `basename $ARCBOOT_IMG` into the volume header of $1 as $VHNAME ..."
$DVHTOOL -d $1 --unix-to-vh $ARCBOOT_IMG $VHNAME
echo "done."
# check if the "image=" lines in $ARCBOOT_IMG refer to valid ELF images
for i in `grep "^[[:space:]]*image=" $ARCBOOT_CONF`; do
IMAGE=`echo $i | cut -d'=' -f2`;
if [ -L $IMAGE ]; then # if it's a symlink, follow it
IMAGE=`dirname $IMAGE`/`readlink $IMAGE`
fi
if [ "$(dd if=$IMAGE bs=4 count=1 2>/dev/null)" != "$(printf '\177ELF')" ]; then
echo "Warning: $IMAGE is not an ELF image. Booting it will fail!"
fi
done
# TODO: better sanity checking of $ARCBOOT_CONF
|