2 ##############################################################################
5 # mkflash -- construct an entire NETtel flash image.
7 # (C) Copyright 1999-2000, Greg Ungerer (gerg@moreton.com.au)
10 ##############################################################################
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.
17 MAC0="\000\320\317\000\001\040"
18 MAC1="\000\320\317\000\001\041"
21 # Define the files to use.
23 FLASH=images/flash.bin
25 IMAGE=images/imagez.bin
27 ##############################################################################
35 ##############################################################################
38 # Check for any args...
46 # Check where to see if we're in a cygwin /w32 environment
47 # if so, use the 'zeros' program, instead of /dev/zero
49 if [ `set | grep -i mach|grep -i -c cygwin` -ge 1 ]
57 # All boards get 2 MAC addresses at first.
65 SIZE=`wc $FLASH | awk '{ print $3}'`
66 PAD=`expr 16384 - $SIZE`
67 echo "BOOT: flash size=$SIZE padding=$PAD"
72 dd if=/dev/zero count=1 bs=$PAD >> $FLASH 2> /dev/null
76 # Command line args next.
78 echo -e "CONSOLE=/dev/null\000\c" >> $FLASH
79 SIZE=`wc $FLASH | awk '{ print $3}'`
80 PAD=`expr 24576 - $SIZE`
81 echo "ARGS: flash size=$SIZE padding=$PAD"
86 dd if=/dev/zero count=1 bs=$PAD >> $FLASH 2> /dev/null
92 echo -e "$MAC0\c" >> $FLASH
93 [ "$DUALETHER" = 1 ] && echo -e "$MAC1\c" >> $FLASH
94 SIZE=`wc $FLASH | awk '{ print $3}'`
95 PAD=`expr 65536 - $SIZE`
96 echo "MAC: flash size=$SIZE padding=$PAD"
101 dd if=/dev/zero count=1 bs=$PAD >> $FLASH 2> /dev/null
105 # Leave space for the file system.
109 echo "CFS: flash size=$SIZE padding=$PAD"
112 zeros $SIZE >> $FLASH
114 dd if=/dev/zero count=1 bs=$SIZE >> $FLASH 2> /dev/null
118 # Linux and file-system image.
121 SIZE=`wc $FLASH | awk '{ print $3}'`
122 PAD=`expr 2097152 - $SIZE`
123 #####PAD=`expr 1048576 - $SIZE`
124 echo "IMG: flash size=$SIZE padding=$PAD"
129 dd if=/dev/zero count=1 bs=$PAD >> $FLASH 2> /dev/null