Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

add compile-milkyminer-firmware.sh

  • Loading branch information...
commit 13fbe766c81af522b6e6f31dfd6cce413c17ecec 1 parent 3b228ff
authored April 11, 2012

Showing 1 changed file with 80 additions and 0 deletions. Show diff stats Hide diff stats

  1. 80  scripts/compile-milkyminer-firmware.sh
80  scripts/compile-milkyminer-firmware.sh
... ...
@@ -0,0 +1,80 @@
  1
+#!/bin/bash
  2
+
  3
+DATE_TIME=`date +"%Y%m%d-%H%M"`
  4
+
  5
+
  6
+IMAGES_DIR="/home/xiangfu/building/Milkymist/milkyminer-firmware-${DATE_TIME}"
  7
+DEST_DIR="/home/xiangfu/build-milkymist"
  8
+mkdir -p ${IMAGES_DIR}
  9
+mkdir -p ${DEST_DIR}
  10
+
  11
+
  12
+BUILD_LOG="${IMAGES_DIR}/BUILD_LOG"
  13
+VERSIONS="${IMAGES_DIR}/VERSIONS"
  14
+touch ${BUILD_LOG} ${VERSIONS}
  15
+
  16
+
  17
+MILKYMINER_GIT_DIR=/home/xiangfu/milkymist-firmware/milkyminer
  18
+MD5_BINARIES="soc.fpg"
  19
+
  20
+
  21
+abort() {
  22
+	tail -n 100 ${IMAGES_DIR}/BUILD_LOG > ${IMAGES_DIR}/BUILD_LOG.`date +"%m%d%Y-%H%M"`.last100
  23
+	echo "$1"
  24
+	exit 1
  25
+}
  26
+
  27
+get-feeds-revision() {
  28
+    if [ -d "$1" ]; then
  29
+        cd $1
  30
+        repo=$(git config -l | grep remote.origin.url | cut -d "=" -f 2)
  31
+        rev=$(git log | head -n 1 | cut -b8-)
  32
+        branch=$(git branch | grep "*" | cut -b3-)
  33
+        echo "${repo}  ${branch} ${rev}" >> ${VERSIONS}
  34
+    fi
  35
+}
  36
+
  37
+
  38
+echo "update git ..."
  39
+(cd ${MILKYMINER_GIT_DIR} && git fetch -a && git reset --hard origin/master)
  40
+
  41
+echo "get git versions ..."
  42
+get-feeds-revision ${MILKYMINER_GIT_DIR}
  43
+
  44
+
  45
+VERSIONS_NEW=`cat ${VERSIONS}`
  46
+VERSIONS_OLD=`cat ${IMAGES_DIR}/../milkyminer-VERSIONS`
  47
+if [ "${VERSIONS_NEW}" == "${VERSIONS_OLD}" ]; then
  48
+	echo "No new commit, ignore build"
  49
+	rm -f ${IMAGES_DIR}/*
  50
+	rmdir ${IMAGES_DIR}
  51
+	exit 0
  52
+fi
  53
+cp ${VERSIONS} ${IMAGES_DIR}/../milkyminer-VERSIONS
  54
+
  55
+
  56
+echo "compile tools ..."
  57
+make -C ${MILKYMINER_GIT_DIR}/ clean host >> ${BUILD_LOG} 2>&1
  58
+if [ "$?" != "0" ]; then
  59
+	abort "ERROR: milkyminer/tools"
  60
+fi
  61
+
  62
+
  63
+echo "compile soc ..."
  64
+#the Xilinx libs(libstdc++.so.6) have some conflict
  65
+(source ~/.bashrc && \
  66
+ source /home/Xilinx/13.4/ISE_DS/settings64.sh && \
  67
+ make -C ${MILKYMINER_GIT_DIR}/boards/milkymist-one/flash)  >> ${BUILD_LOG} 2>&1
  68
+if [ "$?" != "0" ]; then
  69
+	abort "ERROR: compile SOC"
  70
+fi
  71
+cp ${MILKYMINER_GIT_DIR}/boards/milkymist-one/flash/soc.fpg ${IMAGES_DIR}
  72
+
  73
+
  74
+echo "generate md5sum ..."
  75
+(cd ${IMAGES_DIR} && md5sum --binary ${MD5_BINARIES} > ${IMAGES_DIR}/md5sums)
  76
+(cd ${IMAGES_DIR} && bzip2 -z BUILD_LOG;)
  77
+
  78
+mv ${IMAGES_DIR} ${DEST_DIR}
  79
+
  80
+echo "DONE!"

0 notes on commit 13fbe76

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