OSDN Git Service

2013.10.24
[uclinux-h8/uClinux-dist.git] / bin / mkflashboot
1 #!/bin/bash
2 ##############################################################################
3
4 #
5 #       mkboot -- construct an boot flash image.
6 #
7 #       (C) Copyright 2001, Roman Wagner (rw@feith.de)
8 #
9
10 #
11 #       The starting index figure... 0x5aa5ff00
12 #       This strings is in octal below, ugh...
13 #
14 INDEX="\132\245\377\000"
15
16 ##############################################################################
17 #
18 #       Define the files to use.
19 #
20 FLASH=images/flashboot.bin
21 FPGA=boot/fpga.hex
22 BMP=boot/img_c2.dat
23
24 ##############################################################################
25
26 usage()
27 {
28         echo "usage: mkflashboot fpga-file bmp-file name"
29         exit 1
30 }
31
32 ##############################################################################
33
34 #
35 #       Check for any args...
36 #
37 if [ $# -ne 3 ]
38 then
39         usage
40 fi
41
42 FPGA=$1
43 BMP=$2
44 echo
45 echo "Bootflash config:" $3
46 echo
47
48 rm -f $FLASH
49 #
50 #       Index figure first.
51 #
52 echo -e "$INDEX\c" > $FLASH
53 SIZE=`wc $FLASH | awk '{ print $3}'`
54 echo "INDEX:  flash size=$SIZE"
55
56 #
57 #       Bitmapt next.
58 #
59 cat $BMP >> $FLASH
60 SIZE=`wc $FLASH | awk '{ print $3}'`
61 echo "BMP: flash size=$SIZE"
62
63 #
64 #       Fpga next.
65 #
66 cat $FPGA >> $FLASH
67 SIZE=`wc $FLASH | awk '{ print $3}'`
68 PAD=`expr 524288 - $SIZE`
69 echo "FPGA: flash size=$SIZE padding=$PAD"
70 dd if=/dev/zero count=1 bs=$PAD >> $FLASH 2> /dev/null
71
72
73 cp $FLASH /tftpboot
74 echo
75 echo "netflash -n -r /dev/rom10 xxx.xxx.xxx.xxx flashboot.bin"
76 exit 0