2
# TILO - Trivial Image LOader
4
# by Jan Vondrak (C) 1998
6
# This is just a simple wrapper for maketilo...
9
echo "Usage: tilo [ -o output ] <kernel images> <root image>"
21
trap "rm -f $to_remove" 0 1 2 3 7 10 13 15
24
[ $# = 1 -a -n "$1" ] || exit
27
sun4u_init=`nm $KERNEL | awk '/t sun4u_init$/{print$1}'`
28
[ "$?" = 0 ] || exit 2
29
if [ -n "$sun4u_init" ]; then
30
if [ -n "$sun4u" ]; then
31
echo "Multiple sun4u kernels"
37
if [ -n "$sun4c" ]; then
38
echo "Multiple sun4cdm kernels"
44
echo "Converting $KERNEL ($tag) to a.out:"
45
elftoaout $KERNEL -o $KERNEL.out
46
tail --bytes +33 $KERNEL.out > $KERNEL.raw
48
echo Compressing $KERNEL.raw:
49
gzip -c9v $KERNEL.raw > $KERNEL.gz
50
to_remove="$to_remove $KERNEL.gz"
51
PSIZE=`ls -l $KERNEL.gz | awk '{print$5}'`
52
SIZE=`ls -l $KERNEL.raw | awk '{print$5}'`
53
ROOTA=`nm $KERNEL | awk '/A _end$/{print$1}'`
56
echo " raw size = $SIZE"
57
echo " packed size = $PSIZE"
58
echo " root address = $ROOTA"
59
if [ -n "$sun4u" ]; then
60
tilo_args="$tilo_args sun4u=$KERNEL.gz size4u=$SIZE root4u=$ROOTA"
62
tilo_args="$tilo_args sun4c=$KERNEL.gz size4c=$SIZE root4c=$ROOTA"
67
[ $# = 1 -a -n "$1" ] || exit
68
if [ -n "$rootimg" ]; then
69
echo "Multiple root images?"
73
if file $rootimg | grep -q "gzip compressed data"; then
76
echo Compressing $rootimg:
77
gzip -c9v $rootimg > $rootimg.gz
78
to_remove="$to_remove $rootimg.gz"
81
ROOT_SIZE=`ls -l $rootimg | awk '{print$5}'`
82
echo Root image packed size = $ROOT_SIZE
83
tilo_args="$tilo_args root=$rootimg"
89
-o) shift; output="$1" ;;
90
-*) echo $"$0: Unrecognised option: $1" >&2
93
if [ ! -f "$1" ]; then
94
echo "$1 does not exist"
97
if file $1 | grep -q "MSB executable"; then
100
# Suspect it is a root.bin
108
test -z "$output" && output=tftpboot.img
110
if [ -z "$sun4u" -a -z "$sun4c" ]; then
111
echo "No images provided"
115
`echo $0 | sed 's/tilo$/maketilo/'` $tilo_args out=$output
119
TILO_SIZE=`ls -l $output | awk '{print$5}'`
120
echo TILO size = $TILO_SIZE