2 ##############################################################################
5 # mkflash -- construct an entire CanCam flash image.
7 # (C) Copyright 1999-2003, Roman Wagner (rw@feith.de)
10 ##############################################################################
13 # The starting MAC address... 00-0C-6B-80-XX-XX
14 # This strings is in octal below, ugh...
15 # If setting up 2 ethernet devices then set MAC1 as well.
17 MAC0="\000\014\153\200\000\000"
18 MAC1="\000\014\153\200\000\001"
20 # Define the files to use.
22 FLASH=images/flash.bin
23 BOOT=vendors/Feith/boot/CanCam/boot.bin
24 IMAGE=images/imagez.bin
26 ##############################################################################
30 echo "usage: mkflashcancam"
34 ##############################################################################
37 # Check for any args...
45 # All boards get 2 MAC addresses at first.
53 SIZE=`wc $FLASH | awk '{ print $3}'`
54 PAD=`expr 65536 - $SIZE`
55 echo "BOOT: flash size=$SIZE padding=$PAD"
56 dd if=/dev/zero count=1 bs=$PAD >> $FLASH 2> /dev/null
59 # Command line args next.
61 echo -e "CONSOLE=/dev/ttyS0\000\c" >> $FLASH
62 SIZE=`wc $FLASH | awk '{ print $3}'`
63 PAD=`expr 131072 - $SIZE`
64 echo "ARGS: flash size=$SIZE padding=$PAD"
65 dd if=/dev/zero count=1 bs=$PAD >> $FLASH 2> /dev/null
70 echo -e "$MAC0\c" >> $FLASH
71 [ "$DUALETHER" = 1 ] && echo -e "$MAC1\c" >> $FLASH
72 SIZE=`wc $FLASH | awk '{ print $3}'`
73 PAD=`expr 196608 - $SIZE`
74 echo "MAC: flash size=$SIZE padding=$PAD"
75 dd if=/dev/zero count=1 bs=$PAD >> $FLASH 2> /dev/null
78 # Leave space for the file system.
82 echo "CFS: flash size=$SIZE padding=$PAD"
83 dd if=/dev/zero count=1 bs=$SIZE >> $FLASH 2> /dev/null
86 # Linux and file-system image.
89 SIZE=`wc $FLASH | awk '{ print $3}'`
90 PAD=`expr 1769472 - $SIZE`
91 echo "IMG: flash size=$SIZE padding=$PAD"
92 #dd if=/dev/zero count=1 bs=$PAD >> $FLASH 2> /dev/null