Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/scripts
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 33f5b11
Choose a base ref
...
head repository: m-labs/scripts
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 99cb54d
Choose a head ref
  • 3 commits
  • 1 file changed
  • 1 contributor

Commits on Dec 13, 2011

  1. reflash_m1.sh use only one fjmem, cleanup

    Xiangfu Liu committed Dec 13, 2011
    Copy the full SHA
    8458824 View commit details
  2. reflash_m1.sh update to latest release for rc3

    Xiangfu Liu committed Dec 13, 2011
    Copy the full SHA
    c517b74 View commit details
  3. reflash_m1.sh bump version

    Xiangfu Liu committed Dec 13, 2011
    Copy the full SHA
    99cb54d View commit details
Showing with 44 additions and 21 deletions.
  1. +44 −21 scripts/reflash_m1.sh
65 changes: 44 additions & 21 deletions scripts/reflash_m1.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#!/bin/bash

# version of me
__VERSION__="2011-11-28"
__VERSION__="2011-12-13"
echo "File name: $0, Version of me: ${__VERSION__}"


FJMEM="fjmem.bit"
STANDBY="standby.fpg"
SOC_RESCUE="soc-rescue.fpg"
BIOS_RESCUE="bios-rescue.bin"
@@ -16,9 +15,10 @@ SPLASH="splash.raw"
FLICKERNOISE="flickernoise.fbi"
DATA="data.flash5.bin"

FJMEM="${HOME}/.qi/milkymist/fjmem/fjmem.bit"
BIOS_RESCUE_WITHOUT_CRC="${HOME}/.qi/milkymist/bios-crc/bios-rescue-without-CRC.bin"
MAC_DIR="${HOME}/.qi/milkymist/bios-mac/tmp"


# Functions ###########################################################
call-help() {
echo "
@@ -72,12 +72,10 @@ call-download() {
}

call-jtag() {
if [ "${FJMEM_PATH}" == "" ]; then
FJMEM_PATH=${WORKING_DIR}
fi

if [ ! -f "${FJMEM_PATH}/${FJMEM}" ]; then
call-wget "${FJMEM_PATH}/${FJMEM}" http://milkymist.org/updates/2011-07-13/for-rc3/fjmem.bit
if [ ! -f "${FJMEM}" ]; then
mkdir -p `dirname ${FJMEM}`
call-wget "${FJMEM}.bz2" http://milkymist.org/updates/fjmem.bit.bz2
bunzip2 "${FJMEM}.bz2"
fi

if [ "${BIOS_RESCUE_PATH}" == "" ]; then
@@ -102,7 +100,7 @@ cable milkymist
detect
instruction CFG_OUT 000100 BYPASS
instruction CFG_IN 000101 BYPASS
pld load ${FJMEM_PATH}/${FJMEM}
pld load ${FJMEM}
initbus fjmem opcode=000010
frequency 6000000
detectflash 0
@@ -186,13 +184,14 @@ call-create-bios () {

mkdir -p ${MAC_DIR}

if [ ! -f "${BIOS_RESCUE_WITHOUT_CRC_PATH}/bios-rescue-without-CRC.bin" ]; then
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
if [ ! -f "${BIOS_RESCUE_WITHOUT_CRC}" ]; then
mkdir -p `dirname ${BIOS_RESCUE_WITHOUT_CRC}`
call-wget "${BIOS_RESCUE_WITHOUT_CRC}" http://milkymist.org/updates/2011-11-29/for-rc3/bios-rescue-without-CRC.bin
fi


dd if="${BIOS_RESCUE_WITHOUT_CRC_PATH}/bios-rescue-without-CRC.bin" of=${MAC_DIR}/${HEAD_TMP} bs=8 count=28
dd if="${BIOS_RESCUE_WITHOUT_CRC_PATH}/bios-rescue-without-CRC.bin" of=${MAC_DIR}/${REMAIN_TMP} bs=8 skip=29
dd if="${BIOS_RESCUE_WITHOUT_CRC}" of=${MAC_DIR}/${HEAD_TMP} bs=8 count=28
dd if="${BIOS_RESCUE_WITHOUT_CRC}" of=${MAC_DIR}/${REMAIN_TMP} bs=8 skip=29

printf "\\x$(printf "%x" 0x10)" > ${MAC_DIR}/${MAC_TMP}
printf "\\x$(printf "%x" 0xe2)" >> ${MAC_DIR}/${MAC_TMP}
@@ -308,7 +307,6 @@ fi
if [ "$1" == "--read-flash" ]; then
DATE_TIME=`date +"%Y%m%d-%H%M"`
WORKING_DIR="${HOME}/.qi/milkymist/read-flash/${DATE_TIME}"
FJMEM_PATH=${WORKING_DIR}/..

mkdir -p ${WORKING_DIR}
call-jtag $1
@@ -326,13 +324,11 @@ if [ "$1" == "--bios-mac" ]; then
fi

BIOS_RESCUE_MAC="bios.$2$3.bin"
BIOS_RESCUE_WITHOUT_CRC_PATH="${MAC_DIR}/.."

call-create-bios "${MAC_DIR}/${BIOS_RESCUE_MAC}" "$2" "$3"

BIOS_RESCUE_PATH=${MAC_DIR}
BIOS_RESCUE=${BIOS_RESCUE_MAC}
FJMEM_PATH="${MAC_DIR}/.."

call-jtag "--bios-mac"

@@ -346,16 +342,43 @@ if [ "$1" == "--rc3" ]; then
fi

BIOS_RESCUE_MAC="bios.$2$3.bin"
BIOS_RESCUE_WITHOUT_CRC_PATH="."

call-create-bios "${MAC_DIR}/${BIOS_RESCUE_MAC}" "$2" "$3"

BIOS_RESCUE_PATH=${MAC_DIR}
BIOS_RESCUE=${BIOS_RESCUE_MAC}
FJMEM_PATH="."
WORKING_DIR=".."

call-jtag "--release" "${DATA}"

BASE_URL_HTTP="http://milkymist.org/updates"
VERSION="2011-11-29"

MD5SUMS_SERVER=$(\
wget -O - "${BASE_URL_HTTP}/${VERSION}/for-rc3/md5sums" 2> /dev/null |\
grep -E "(${STANDBY}|${SOC_RESCUE}|${SPLASH_RESCUE}|${SOC}|${BIOS}|${SPLASH}|${FLICKERNOISE}|${DATA})" | sort)
if [ "${MD5SUMS_SERVER}" == "" ]; then
echo "ERROR: can't fetch files ${BASE_URL_HTTP}/${VERSION}/for-rc3/md5sums"
exit 1
fi

WORKING_DIR="${HOME}/.qi/milkymist/for-rc3"
mkdir -p ${WORKING_DIR}

MD5SUMS_LOCAL=$( (cd "${WORKING_DIR}" ; \
md5sum --binary ${STANDBY} ${SOC_RESCUE} ${SPLASH_RESCUE} \
${SOC} ${BIOS} ${SPLASH} ${FLICKERNOISE} ${DATA} 2> /dev/null) | sort )

if [ "${MD5SUMS_SERVER}" == "${MD5SUMS_LOCAL}" ]; then
echo "present files are identical to the ones on the server - do not download them again"
else
(cd "${WORKING_DIR}" ; rm -f ${STANDBY} ${SOC_RESCUE} ${SPLASH_RESCUE} \
${SOC} ${BIOS} ${SPLASH} ${FLICKERNOISE} ${DATA})
call-download
call-wget "${WORKING_DIR}/${SPLASH_RESCUE}" "${BASE_URL_HTTP}/${VERSION}/for-rc3/${SPLASH_RESCUE}"
call-wget "${WORKING_DIR}/${SPLASH}" "${BASE_URL_HTTP}/${VERSION}/for-rc3/${SPLASH}"
call-wget "${WORKING_DIR}/${DATA}" "${BASE_URL_HTTP}/${VERSION}/for-rc3/${DATA}"
fi

call-jtag "--release" "${WORKING_DIR}/${DATA}"

exit 0
fi