OSDN Git Service

Add MS7619SE
[uclinux-h8/uClinux-dist.git] / bin / mkflashcleo
1 #!/bin/bash
2 ##############################################################################
3
4 #
5 #       mkflash -- construct an entire CLEOPATRA 1 flash image.
6 #
7 #       (C) Copyright 1999-2001, Roman Wagner (rw@feith.de)
8 #
9
10 ##############################################################################
11
12 #
13 #       The starting MAC address... 00-D0-CF-XX-XX-XX
14 #       This strings is in octal below, ugh...
15 #       If setting up 2 ethernet devices then set MAC1 as well.
16 #
17 MAC0="\000\320\317\000\001\040"
18 MAC1="\000\320\317\000\001\041"
19
20 #
21 #       Define the files to use.
22 #
23 FLASH=images/flash.bin
24 BOOT=boot/boot.bin
25 IMAGE=images/imagez.bin
26
27 ##############################################################################
28
29 usage()
30 {
31         echo "usage: mkflashcleo boot-file name mem"
32         exit 1
33 }
34
35 ##############################################################################
36
37 #
38 #       Check for any args...
39 #
40 if [ $# -ne 3 ]
41 then
42         usage
43 fi
44
45 BOOT=$1
46 echo
47 echo "Flash config:" $2 $3
48 echo
49
50 #
51 #       All boards get 2 MAC addresses at first.
52 #
53 DUALETHER=1
54
55 #
56 #       Boot loader first.
57 #
58 cat $BOOT > $FLASH
59 SIZE=`wc $FLASH | awk '{ print $3}'`
60 PAD=`expr 16384 - $SIZE`
61 echo "BOOT: flash size=$SIZE padding=$PAD"
62 dd if=/dev/zero count=1 bs=$PAD >> $FLASH 2> /dev/null
63
64 #
65 #       Command line args next.
66 #
67 echo -e "CONSOLE=/dev/ttyS0\000\c" >> $FLASH
68 SIZE=`wc $FLASH | awk '{ print $3}'`
69 PAD=`expr 24576 - $SIZE`
70 echo "ARGS: flash size=$SIZE padding=$PAD"
71 dd if=/dev/zero count=1 bs=$PAD >> $FLASH 2> /dev/null
72
73 #
74 #       MAC address next.
75 #
76 echo -e "$MAC0\c" >> $FLASH
77 [ "$DUALETHER" = 1 ] && echo -e "$MAC1\c" >> $FLASH
78 SIZE=`wc $FLASH | awk '{ print $3}'`
79 PAD=`expr 65536 - $SIZE`
80 echo "MAC:  flash size=$SIZE padding=$PAD"
81 dd if=/dev/zero count=1 bs=$PAD >> $FLASH 2> /dev/null
82
83 #
84 #       Leave space for the file system.
85 #
86 SIZE=65536
87 PAD=0
88 echo "CFS:  flash size=$SIZE padding=$PAD"
89 dd if=/dev/zero count=1 bs=$SIZE >> $FLASH 2> /dev/null
90
91 #
92 #       Linux and file-system image.
93 #
94 cat $IMAGE >> $FLASH
95 SIZE=`wc $FLASH | awk '{ print $3}'`
96 PAD=`expr 1966080 - $SIZE`
97 #####PAD=`expr 1048576 - $SIZE`
98 echo "IMG:  flash size=$SIZE padding=$PAD"
99 #dd if=/dev/zero count=1 bs=$PAD >> $FLASH 2> /dev/null
100
101 #
102 #       application config
103 #
104 #SIZE=131072
105 #PAD=0
106 #echo "ACFS:  flash size=$SIZE padding=$PAD"
107 #dd if=/dev/zero count=1 bs=$SIZE >> $FLASH 2> /dev/null
108
109 cp $FLASH /tftpboot
110 exit 0