Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 3 commits
  • 1 file changed
  • 0 comments
  • 1 contributor

Showing 1 changed file with 44 additions and 21 deletions. Show diff stats Hide diff stats

  1. 65  scripts/reflash_m1.sh
65  scripts/reflash_m1.sh
... ...
@@ -1,11 +1,10 @@
1 1
 #!/bin/bash
2 2
 
3 3
 # version of me
4  
-__VERSION__="2011-11-28"
  4
+__VERSION__="2011-12-13"
5 5
 echo "File name: $0, Version of me: ${__VERSION__}"
6 6
 
7 7
 
8  
-FJMEM="fjmem.bit"
9 8
 STANDBY="standby.fpg"
10 9
 SOC_RESCUE="soc-rescue.fpg"
11 10
 BIOS_RESCUE="bios-rescue.bin"
@@ -16,9 +15,10 @@ SPLASH="splash.raw"
16 15
 FLICKERNOISE="flickernoise.fbi"
17 16
 DATA="data.flash5.bin"
18 17
 
  18
+FJMEM="${HOME}/.qi/milkymist/fjmem/fjmem.bit"
  19
+BIOS_RESCUE_WITHOUT_CRC="${HOME}/.qi/milkymist/bios-crc/bios-rescue-without-CRC.bin"
19 20
 MAC_DIR="${HOME}/.qi/milkymist/bios-mac/tmp"
20 21
 
21  
-
22 22
 # Functions ###########################################################
23 23
 call-help() {
24 24
 	echo "
@@ -72,12 +72,10 @@ call-download() {
72 72
 }
73 73
 
74 74
 call-jtag() {
75  
-    if [ "${FJMEM_PATH}" == "" ]; then
76  
-	FJMEM_PATH=${WORKING_DIR}
77  
-    fi
78  
-
79  
-    if [ ! -f "${FJMEM_PATH}/${FJMEM}" ]; then
80  
-	call-wget "${FJMEM_PATH}/${FJMEM}" http://milkymist.org/updates/2011-07-13/for-rc3/fjmem.bit
  75
+    if [ ! -f "${FJMEM}" ]; then
  76
+	mkdir -p `dirname ${FJMEM}`
  77
+	call-wget "${FJMEM}.bz2" http://milkymist.org/updates/fjmem.bit.bz2
  78
+	bunzip2 "${FJMEM}.bz2"
81 79
     fi
82 80
 
83 81
     if [ "${BIOS_RESCUE_PATH}" == "" ]; then
@@ -102,7 +100,7 @@ cable milkymist
102 100
 detect
103 101
 instruction CFG_OUT 000100 BYPASS
104 102
 instruction CFG_IN 000101 BYPASS
105  
-pld load ${FJMEM_PATH}/${FJMEM}
  103
+pld load ${FJMEM}
106 104
 initbus fjmem opcode=000010
107 105
 frequency 6000000
108 106
 detectflash 0
@@ -186,13 +184,14 @@ call-create-bios () {
186 184
 
187 185
     mkdir -p ${MAC_DIR}
188 186
 
189  
-    if [ ! -f "${BIOS_RESCUE_WITHOUT_CRC_PATH}/bios-rescue-without-CRC.bin" ]; then
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
  187
+    if [ ! -f "${BIOS_RESCUE_WITHOUT_CRC}" ]; then
  188
+	mkdir -p `dirname ${BIOS_RESCUE_WITHOUT_CRC}`
  189
+	call-wget "${BIOS_RESCUE_WITHOUT_CRC}" http://milkymist.org/updates/2011-11-29/for-rc3/bios-rescue-without-CRC.bin
191 190
     fi
192 191
 
193 192
 
194  
-    dd if="${BIOS_RESCUE_WITHOUT_CRC_PATH}/bios-rescue-without-CRC.bin"  of=${MAC_DIR}/${HEAD_TMP}   bs=8 count=28
195  
-    dd if="${BIOS_RESCUE_WITHOUT_CRC_PATH}/bios-rescue-without-CRC.bin"  of=${MAC_DIR}/${REMAIN_TMP} bs=8  skip=29
  193
+    dd if="${BIOS_RESCUE_WITHOUT_CRC}"  of=${MAC_DIR}/${HEAD_TMP}   bs=8 count=28
  194
+    dd if="${BIOS_RESCUE_WITHOUT_CRC}"  of=${MAC_DIR}/${REMAIN_TMP} bs=8  skip=29
196 195
 
197 196
     printf "\\x$(printf "%x" 0x10)" >  ${MAC_DIR}/${MAC_TMP}
198 197
     printf "\\x$(printf "%x" 0xe2)" >> ${MAC_DIR}/${MAC_TMP}
@@ -308,7 +307,6 @@ fi
308 307
 if [ "$1" == "--read-flash" ]; then
309 308
     DATE_TIME=`date +"%Y%m%d-%H%M"`
310 309
     WORKING_DIR="${HOME}/.qi/milkymist/read-flash/${DATE_TIME}"
311  
-    FJMEM_PATH=${WORKING_DIR}/..
312 310
 
313 311
     mkdir -p ${WORKING_DIR}
314 312
     call-jtag $1
@@ -326,13 +324,11 @@ if [ "$1" == "--bios-mac" ]; then
326 324
     fi
327 325
 
328 326
     BIOS_RESCUE_MAC="bios.$2$3.bin"
329  
-    BIOS_RESCUE_WITHOUT_CRC_PATH="${MAC_DIR}/.."
330 327
 
331 328
     call-create-bios "${MAC_DIR}/${BIOS_RESCUE_MAC}" "$2" "$3"
332 329
 
333 330
     BIOS_RESCUE_PATH=${MAC_DIR}
334 331
     BIOS_RESCUE=${BIOS_RESCUE_MAC}
335  
-    FJMEM_PATH="${MAC_DIR}/.."
336 332
 
337 333
     call-jtag "--bios-mac"
338 334
 
@@ -346,16 +342,43 @@ if [ "$1" == "--rc3" ]; then
346 342
     fi
347 343
 
348 344
     BIOS_RESCUE_MAC="bios.$2$3.bin"
349  
-    BIOS_RESCUE_WITHOUT_CRC_PATH="."
350 345
 
351 346
     call-create-bios "${MAC_DIR}/${BIOS_RESCUE_MAC}" "$2" "$3"
352 347
 
353 348
     BIOS_RESCUE_PATH=${MAC_DIR}
354 349
     BIOS_RESCUE=${BIOS_RESCUE_MAC}
355  
-    FJMEM_PATH="."
356  
-    WORKING_DIR=".."
357 350
 
358  
-    call-jtag "--release" "${DATA}"
  351
+
  352
+    BASE_URL_HTTP="http://milkymist.org/updates"
  353
+    VERSION="2011-11-29"
  354
+
  355
+    MD5SUMS_SERVER=$(\
  356
+      wget -O - "${BASE_URL_HTTP}/${VERSION}/for-rc3/md5sums" 2> /dev/null |\
  357
+      grep -E "(${STANDBY}|${SOC_RESCUE}|${SPLASH_RESCUE}|${SOC}|${BIOS}|${SPLASH}|${FLICKERNOISE}|${DATA})" | sort)
  358
+    if [ "${MD5SUMS_SERVER}" == "" ]; then
  359
+	echo "ERROR: can't fetch files ${BASE_URL_HTTP}/${VERSION}/for-rc3/md5sums"
  360
+	exit 1
  361
+    fi
  362
+
  363
+    WORKING_DIR="${HOME}/.qi/milkymist/for-rc3"
  364
+    mkdir -p ${WORKING_DIR}
  365
+
  366
+    MD5SUMS_LOCAL=$( (cd "${WORKING_DIR}" ; \
  367
+	md5sum --binary ${STANDBY} ${SOC_RESCUE} ${SPLASH_RESCUE} \
  368
+	${SOC} ${BIOS} ${SPLASH} ${FLICKERNOISE} ${DATA} 2> /dev/null) | sort )
  369
+
  370
+    if [ "${MD5SUMS_SERVER}" == "${MD5SUMS_LOCAL}" ]; then
  371
+	echo "present files are identical to the ones on the server - do not download them again"
  372
+    else
  373
+	(cd "${WORKING_DIR}" ; rm -f ${STANDBY} ${SOC_RESCUE} ${SPLASH_RESCUE} \
  374
+	   ${SOC} ${BIOS} ${SPLASH} ${FLICKERNOISE} ${DATA})
  375
+	call-download
  376
+	call-wget "${WORKING_DIR}/${SPLASH_RESCUE}" "${BASE_URL_HTTP}/${VERSION}/for-rc3/${SPLASH_RESCUE}"
  377
+	call-wget "${WORKING_DIR}/${SPLASH}"        "${BASE_URL_HTTP}/${VERSION}/for-rc3/${SPLASH}"
  378
+	call-wget "${WORKING_DIR}/${DATA}"          "${BASE_URL_HTTP}/${VERSION}/for-rc3/${DATA}"
  379
+    fi
  380
+
  381
+    call-jtag "--release" "${WORKING_DIR}/${DATA}"
359 382
 
360 383
     exit 0
361 384
 fi

No commit comments for this range

Something went wrong with that request. Please try again.