Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

don't reflash empty file to M1

  • Loading branch information...
commit 7c48525992a0798caac652e818f8146617823556 1 parent d09543c
authored November 28, 2011

Showing 1 changed file with 22 additions and 15 deletions. Show diff stats Hide diff stats

  1. 37  scripts/reflash_m1.sh
37  scripts/reflash_m1.sh
... ...
@@ -1,7 +1,7 @@
1 1
 #!/bin/bash
2 2
 
3 3
 # version of me
4  
-__VERSION__="2011-10-14"
  4
+__VERSION__="2011-11-28"
5 5
 echo "File name: $0, Version of me: ${__VERSION__}"
6 6
 
7 7
 
@@ -48,18 +48,27 @@ Please report bugs to <devel@lists.milkymist.org>
48 48
 
49 49
 }
50 50
 
  51
+# $1: is the file name you want save
  52
+# $2: is the URL
  53
+call-wget() {
  54
+    wget -O "$1" "$2"
  55
+    if [ "$?" != "0" ]; then
  56
+	rm -f "$1"
  57
+    fi
  58
+}
  59
+
51 60
 call-download() {
52  
-    wget -O "${WORKING_DIR}/${STANDBY}"       "${BASE_URL_HTTP}/${VERSION}/${STANDBY}"
  61
+    call-wget "${WORKING_DIR}/${STANDBY}"       "${BASE_URL_HTTP}/${VERSION}/${STANDBY}"
53 62
 
54  
-    wget -O "${WORKING_DIR}/${SOC_RESCUE}"    "${BASE_URL_HTTP}/${VERSION}/${SOC_RESCUE}"
55  
-    wget -O "${WORKING_DIR}/${BIOS_RESCUE}"   "${BASE_URL_HTTP}/${VERSION}/${BIOS_RESCUE}"
56  
-    wget -O "${WORKING_DIR}/${SPLASH_RESCUE}" "${BASE_URL_HTTP}/${VERSION}/${SPLASH_RESCUE}"
  63
+    call-wget "${WORKING_DIR}/${SOC_RESCUE}"    "${BASE_URL_HTTP}/${VERSION}/${SOC_RESCUE}"
  64
+    call-wget "${WORKING_DIR}/${BIOS_RESCUE}"   "${BASE_URL_HTTP}/${VERSION}/${BIOS_RESCUE}"
  65
+    call-wget "${WORKING_DIR}/${SPLASH_RESCUE}" "${BASE_URL_HTTP}/${VERSION}/${SPLASH_RESCUE}"
57 66
 
58  
-    wget -O "${WORKING_DIR}/${SOC}"           "${BASE_URL_HTTP}/${VERSION}/${SOC}"
59  
-    wget -O "${WORKING_DIR}/${BIOS}"          "${BASE_URL_HTTP}/${VERSION}/${BIOS}"
60  
-    wget -O "${WORKING_DIR}/${SPLASH}"        "${BASE_URL_HTTP}/${VERSION}/${SPLASH}"
  67
+    call-wget "${WORKING_DIR}/${SOC}"           "${BASE_URL_HTTP}/${VERSION}/${SOC}"
  68
+    call-wget "${WORKING_DIR}/${BIOS}"          "${BASE_URL_HTTP}/${VERSION}/${BIOS}"
  69
+    call-wget "${WORKING_DIR}/${SPLASH}"        "${BASE_URL_HTTP}/${VERSION}/${SPLASH}"
61 70
 
62  
-    wget -O "${WORKING_DIR}/${FLICKERNOISE}"  "${BASE_URL_HTTP}/${VERSION}/${FLICKERNOISE}"
  71
+    call-wget "${WORKING_DIR}/${FLICKERNOISE}"  "${BASE_URL_HTTP}/${VERSION}/${FLICKERNOISE}"
63 72
 }
64 73
 
65 74
 call-jtag() {
@@ -68,7 +77,7 @@ call-jtag() {
68 77
     fi
69 78
 
70 79
     if [ ! -f "${FJMEM_PATH}/${FJMEM}" ]; then
71  
-	wget -O "${FJMEM_PATH}/${FJMEM}" http://milkymist.org/updates/2011-07-13/for-rc3/fjmem.bit
  80
+	call-wget "${FJMEM_PATH}/${FJMEM}" http://milkymist.org/updates/2011-07-13/for-rc3/fjmem.bit
72 81
     fi
73 82
 
74 83
     if [ "${BIOS_RESCUE_PATH}" == "" ]; then
@@ -131,8 +140,6 @@ EOF
131 140
     fi
132 141
 
133 142
     if [ "$1" == "--release" ] || [ "$1" == "--snapshot" ]; then
134  
-	echo "eraseflash 0x000000 105" >> ${JTAG_BATCH_FILE}
135  
-
136 143
 	echo "flashmem 0x000000 ${WORKING_DIR}/${STANDBY} ${JTAG_NOVERIFY}" >> ${JTAG_BATCH_FILE}
137 144
 
138 145
 	echo "flashmem 0x0A0000 ${WORKING_DIR}/${SOC_RESCUE} ${JTAG_NOVERIFY}" >> ${JTAG_BATCH_FILE}
@@ -180,7 +187,7 @@ call-create-bios () {
180 187
     mkdir -p ${MAC_DIR}
181 188
 
182 189
     if [ ! -f "${BIOS_RESCUE_WITHOUT_CRC_PATH}/bios-rescue-without-CRC.bin" ]; then
183  
-	wget -O "${BIOS_RESCUE_WITHOUT_CRC_PATH}/bios-rescue-without-CRC.bin" http://milkymist.org/updates/2011-07-13/for-rc3/bios-rescue-without-CRC.bin
  190
+	call-wget "${BIOS_RESCUE_WITHOUT_CRC_PATH}/bios-rescue-without-CRC.bin" http://milkymist.org/updates/2011-07-13/for-rc3/bios-rescue-without-CRC.bin
184 191
     fi
185 192
 
186 193
 
@@ -234,7 +241,7 @@ if [ "$1" == "--release" ]; then
234 241
 	    ${STANDBY} ${SOC_RESCUE} ${BIOS_RESCUE} ${SPLASH_RESCUE} \
235 242
 	    ${SOC} ${BIOS} ${SPLASH} ${FLICKERNOISE} \
236 243
 	    version-app)
237  
-	wget -O ${WORKING_DIR}/version-app ${BASE_URL_HTTP}/${VERSION}/version-app
  244
+	call-wget ${WORKING_DIR}/version-app ${BASE_URL_HTTP}/${VERSION}/version-app
238 245
 	call-download
239 246
     fi
240 247
 
@@ -272,7 +279,7 @@ if [ "$1" == "--snapshot" ]; then
272 279
     else
273 280
 	(cd "${WORKING_DIR}" ; rm -f ${STANDBY} ${SOC_RESCUE} ${BIOS_RESCUE} ${SPLASH_RESCUE} \
274 281
 	   ${SOC} ${BIOS} ${SPLASH} ${FLICKERNOISE} ${DATA})
275  
-	wget -O "${WORKING_DIR}/${DATA}" "${BASE_URL_HTTP}/${VERSION}/${DATA}"
  282
+	call-wget "${WORKING_DIR}/${DATA}" "${BASE_URL_HTTP}/${VERSION}/${DATA}"
276 283
 	call-download
277 284
     fi
278 285
 

0 notes on commit 7c48525

Please sign in to comment.
Something went wrong with that request. Please try again.