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: f721e37
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: c8b2482
Choose a head ref
  • 3 commits
  • 3 files changed
  • 1 contributor

Commits on Sep 9, 2011

  1. compile-flickernoise: add build boot.crc.bin

    Xiangfu Liu committed Sep 9, 2011
    Copy the full SHA
    4f0eaea View commit details
  2. compile-milkymist-firmware.sh update

    Xiangfu Liu committed Sep 9, 2011
    Copy the full SHA
    424820a View commit details
  3. add compile-openwrt-milkymist.sh

    Xiangfu Liu committed Sep 9, 2011
    Copy the full SHA
    c8b2482 View commit details
Showing with 155 additions and 35 deletions.
  1. +8 −3 compile-flickernoise/Makefile
  2. +56 −32 scripts/compile-milkymist-firmware.sh
  3. +91 −0 scripts/compile-openwrt-milkymist.sh
11 changes: 8 additions & 3 deletions compile-flickernoise/Makefile
Original file line number Diff line number Diff line change
@@ -234,10 +234,15 @@ flickernoise-pdf.fbiz: flickernoise.fbi
(cd $(MILKYMIST_GIT_DIR)/flickernoise.git/src && make clean && WITH_PDF=1 make bin/flickernoise.fbiz)
cp $(MILKYMIST_GIT_DIR)/flickernoise.git/src/bin/flickernoise.fbiz ./$@

autotest-m1-boot.bin:
(cd $(MILKYMIST_GIT_DIR)/autotest-m1.git/src && MMDIR=$(MILKYMIST_GIT_DIR)/milkymist.git make)
boot.bin:
MMDIR=$(MILKYMIST_GIT_DIR)/milkymist.git make -C $(MILKYMIST_GIT_DIR)/autotest-m1.git/src
cp $(MILKYMIST_GIT_DIR)/autotest-m1.git/src/boot.bin ./$@

boot.crc.bin:
MMDIR=$(MILKYMIST_GIT_DIR)/milkymist.git IMAGES_DIR=$(IMAGES_DIR) \
make -C $(MILKYMIST_GIT_DIR)/autotest-m1.git/src boot.crc.bin
cp $(MILKYMIST_GIT_DIR)/autotest-m1.git/src/boot.crc.*.bin ./

####
$(DL)/$(LIBPNG).ok:
mkdir -p dl
@@ -287,7 +292,7 @@ $(DL)/$(EXPAT).ok:
http://download.sourceforge.net/project/expat/expat/$(EXPAT_VERSION)/expat-$(EXPAT_VERSION).tar.gz
touch $@

.PHONY: clean clean-rtems
.PHONY: clean clean-rtems boot.crc.bin

clean:
rm -rf build_dir/*
88 changes: 56 additions & 32 deletions scripts/compile-milkymist-firmware.sh
Original file line number Diff line number Diff line change
@@ -4,19 +4,29 @@ DATE=$(date "+%Y-%m-%d")
TIME=$(date "+%H-%M-%S")
DATE_TIME=`date +"%m%d%Y-%H%M"`

CURR_DIR="`pwd`"
IMAGE_DIR="${HOME}/.qi/milkymist/milkymist-firmware/${DATE_TIME}/"
mkdir -p ${IMAGE_DIR}

BUILD_LOG="${IMAGE_DIR}/BUILD_LOG"
VERSIONS="${IMAGE_DIR}/VERSIONS"
IMAGES_DIR="/home/xiangfu/build-milkymist/milkymist-firmware-${DATE_TIME}/"
mkdir -p ${IMAGES_DIR}


BUILD_LOG="${IMAGES_DIR}/BUILD_LOG"
VERSIONS="${IMAGES_DIR}/VERSIONS"
touch ${BUILD_LOG} ${VERSIONS}

MILKYMIST_GIT_DIR="../../milkymist"
SCRIPTS_GIT_DIR=".."

MILKYMIST_GIT_DIR=/home/xiangfu/milkymist-firmware/milkymist/
SCRIPTS_GIT_DIR=/home/xiangfu/milkymist-firmware/scripts.git


MD5_BINARIES="bios.bin bios-rescue.bin boot.bin data.flash5.bin flickernoise flickernoise.bin flickernoise.fbi flickernoise.ralf soc.fpg soc-rescue.fpg splash.raw splash-rescue.raw standby.fpg"


abort() {
tail -n 100 ${IMAGES_DIR}/BUILD_LOG > ${IMAGES_DIR}/BUILD_LOG.`date +"%m%d%Y-%H%M"`.last100
echo "$1"
exit 1
}

get-feeds-revision() {
if [ -d "$1" ]; then
cd $1
@@ -25,20 +35,22 @@ get-feeds-revision() {
branch=$(git branch | grep "*" | cut -b3-)
echo "${repo} ${branch} ${rev}" >> ${VERSIONS}
fi
cd ${CURR_DIR}
}


RTEMS_MAKEFILE_PATH=/opt/rtems-4.11/lm32-rtems4.11/milkymist
export RTEMS_MAKEFILE_PATH

PATH=/opt/rtems-4.11/bin:${PATH}
export PATH


echo "update git ..."
(cd ${SCRIPTS_GIT_DIR} && git fetch -a && git reset --hard origin/master)
#make -C ${SCRIPTS_GIT_DIR}/compile-flickernoise/ milkymist-git-clone #no needs every build
MILKYMIST_GIT_DIR=${MILKYMIST_GIT_DIR} make -C ${SCRIPTS_GIT_DIR}/compile-flickernoise/ milkymist-git-update
if [ "$?" != "0" ]; then
echo "ERROR: milkymist-git-update"
echo -e "\
say #milkymist ERROR: milkymist-git-update \
see log here: http://fidelio.qi-hardware.com/~xiangfu/build-milkymist/milkymist-firmware-${DATE_TIME}/ \nclose" \
| nc turandot.qi-hardware.com 3858
abort "ERROR: milkymist-git-update"
fi


@@ -57,36 +69,29 @@ echo "compile toolchain ..."
rm -rf /opt/rtems-4.11/
make -C ${SCRIPTS_GIT_DIR}/compile-lm32-rtems clean all >> ${BUILD_LOG} 2>&1
if [ "$?" != "0" ]; then
echo "ERROR: compile-lm32-rtems toolchain "
abort "ERROR: compile-lm32-rtems toolchain "
fi


echo "compile tools ..."
(cd ${MILKYMIST_GIT_DIR}/milkymist.git && ./clean_all.sh)
make -C ${MILKYMIST_GIT_DIR}/milkymist.git/tools >> ${BUILD_LOG} 2>&1
if [ "$?" != "0" ]; then
echo "ERROR: milkymist.git/tools"
abort "ERROR: milkymist.git/tools"
fi


echo "compile soc ..."
#the Xilinx libs(libstdc++.so.6) have some conflict
(source /home/Xilinx/13.2/ISE_DS/settings64.sh && \
(source ~/.bashrc && \
source /home/Xilinx/13.2/ISE_DS/settings64.sh && \
make -C ${MILKYMIST_GIT_DIR}/milkymist.git/boards/milkymist-one/flash) >> ${BUILD_LOG} 2>&1
if [ "$?" != "0" ]; then
echo "ERROR: compile SOC"
abort "ERROR: compile SOC"
fi


echo "compile flickernoise ..."
export PATH=${MILKYMIST_GIT_DIR}/milkymist.git/tools:$PATH
MILKYMIST_GIT_DIR=${MILKYMIST_GIT_DIR} make -C ${SCRIPTS_GIT_DIR}/compile-flickernoise \
clean flickernoise.fbi autotest-m1-boot.bin >> ${BUILD_LOG} 2>&1
if [ "$?" != "0" ]; then
echo "ERROR: compile flickernoise"
fi


echo "copy images to bin/ ..."
echo "copy soc to bin/ ..."
cp ${MILKYMIST_GIT_DIR}/milkymist.git/boards/milkymist-one/flash/standby.fpg ${IMAGES_DIR}
cp ${MILKYMIST_GIT_DIR}/milkymist.git/boards/milkymist-one/flash/soc.fpg ${IMAGES_DIR}
cp ${MILKYMIST_GIT_DIR}/milkymist.git/boards/milkymist-one/flash/bios.bin ${IMAGES_DIR}
@@ -95,22 +100,41 @@ cp ${MILKYMIST_GIT_DIR}/milkymist.git/boards/milkymist-one/flash/soc-rescue.fpg
cp ${MILKYMIST_GIT_DIR}/milkymist.git/boards/milkymist-one/flash/bios-rescue.bin ${IMAGES_DIR}
cp ${MILKYMIST_GIT_DIR}/milkymist.git/boards/milkymist-one/flash/splash-rescue.raw ${IMAGES_DIR}

BIOS_LEN=`ls -l ${IMAGES_DIR}/bios-rescue.bin | awk '{printf "%d\n",$5-4}'`
dd if=${IMAGES_DIR}/bios-rescue.bin of=${IMAGES_DIR}/bios-rescue-without-CRC.bin bs=1 count=${BIOS_LEN}

echo "compile flickernoise ..."
export PATH=${MILKYMIST_GIT_DIR}/milkymist.git/tools:$PATH
export PATH=/home/xiangfu/openwrt-xburst.full_system/staging_dir/host/bin:$PATH #for autoconf 2.68
MILKYMIST_GIT_DIR=${MILKYMIST_GIT_DIR} IMAGES_DIR=${IMAGES_DIR} \
make -C ${SCRIPTS_GIT_DIR}/compile-flickernoise \
clean flickernoise.fbi boot.bin boot.crc.bin >> ${BUILD_LOG} 2>&1
if [ "$?" != "0" ]; then
abort "ERROR: compile flickernoise"
fi


echo "copy flickernoise to bin/ ..."
cp ${MILKYMIST_GIT_DIR}/flickernoise.git/src/bin/* ${IMAGES_DIR}/
cp ${MILKYMIST_GIT_DIR}/autotest-m1.git/src/boot.bin ${IMAGES_DIR}/
cp ${MILKYMIST_GIT_DIR}/autotest-m1.git/src/boot*.bin ${IMAGES_DIR}/


echo "build data patitions ..."
mkdir -p ${IMAGE_DIR}/data.flash5/patchpool
find ${MILKYMIST_GIT_DIR}/flickernoise.git/patches -name "*.fnp" -exec cp {} ${IMAGE_DIR}/data.flash5/patchpool \;
mkdir -p ${IMAGES_DIR}/data.flash5/patchpool
find ${MILKYMIST_GIT_DIR}/flickernoise.git/patches -name "*.fnp" -exec cp {} ${IMAGES_DIR}/data.flash5/patchpool \;

make -C ${MILKYMIST_GIT_DIR}/rtems-yaffs2.git/utils mm-mkyaffs2image
${MILKYMIST_GIT_DIR}/rtems-yaffs2.git/utils/mm-mkyaffs2image ${IMAGE_DIR}/data.flash5 ${IMAGES_DIR}/data.flash5.bin convert >> ${BUILD_LOG} 2>&1
${MILKYMIST_GIT_DIR}/rtems-yaffs2.git/utils/mm-mkyaffs2image \
${IMAGES_DIR}/data.flash5 ${IMAGES_DIR}/data.flash5.bin convert >> ${BUILD_LOG} 2>&1
chmod 644 ${IMAGES_DIR}/data.flash5.bin


echo "generate md5sum ..."
(cd ${IMAGES_DIR} && md5sum --binary * > ${IMAGES_DIR}/md5sums)
(cd ${IMAGES_DIR} && md5sum --binary ${MD5_BINARIES} > ${IMAGES_DIR}/md5sums)


echo "create SDK ..."
(cd /opt/ && tar cjvf ${IMAGES_DIR}/Flickernoise-lm32-rtems-4.11-SDK-for-Linux-x86_64.tar.bz2 rtems-4.11/)


echo "DONE!"
91 changes: 91 additions & 0 deletions scripts/compile-openwrt-milkymist.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
#!/bin/bash

OPENWRT_DIR_NAME="openwrt-milkymist."$1
OPENWRT_DIR="/home/xiangfu/${OPENWRT_DIR_NAME}/"
CONFIG_FILE_TYPE="config."$1

MAKE_VARS=" V=99 IGNORE_ERRORS=m -j4 "

########################################################################
DATE=$(date "+%Y-%m-%d")
TIME=$(date "+%H-%M-%S")
DATE_TIME=`date +"%m%d%Y-%H%M"`

GET_FEEDS_VERSION_SH="/home/xiangfu/bin/get-feeds-revision.sh"
PATCH_OPENWRT_SH="/home/xiangfu/bin/patch-openwrt.sh"

IMAGES_DIR="/home/xiangfu/build-milkymist/milkymist-openwrt.$1-${DATE_TIME}/"
mkdir -p ${IMAGES_DIR}

BUILD_LOG="${IMAGES_DIR}/BUILD_LOG"
VERSIONS_FILE="${IMAGES_DIR}/VERSIONS"


########################################################################
cd ${OPENWRT_DIR}

echo "make distclean ..."
make distclean


echo "updating git repo..."
git fetch -a
git reset --hard origin/master
if [ "$?" != "0" ]; then
echo "ERROR: updating openwrt failed"
exit 1
fi


echo "update and install feeds..."
./scripts/feeds update -a && ./scripts/feeds install -a
if [ "$?" != "0" ]; then
echo "ERROR: update and install feeds failed"
exit 1
fi
cp feeds/qipackages/milkymist-files/data/m1/conf/${CONFIG_FILE_TYPE} .config
sed -i '/CONFIG_ALL/s/.*/CONFIG_ALL=y/' .config
yes "" | make oldconfig > /dev/null


echo "copy files, create VERSION, copy dl folder, last prepare..."
rm -f dl && ln -s ~/dl


echo "patch openwrt "
${PATCH_OPENWRT_SH} ${OPENWRT_DIR}


echo "starting compiling - this may take several hours..."
time make ${MAKE_VARS} > ${IMAGES_DIR}/BUILD_LOG 2>&1
if [ "$?" != "0" ]; then
echo "ERROR: Build failed! Please refer to the log file"
tail -n 100 ${IMAGES_DIR}/BUILD_LOG > ${IMAGES_DIR}/BUILD_LOG.`date +"%m%d%Y-%H%M"`.last100
echo -e "\
say #milkymist The build has FAILED, \
see log here: http://fidelio.qi-hardware.com/~xiangfu/build-milkymist/milkymist-openwrt.$1-${DATE_TIME}/\nclose" \
| nc turandot.qi-hardware.com 3858
else
echo -e "\
say #milkymist The build was successfull, \
see images here: http://fidelio.qi-hardware.com/~xiangfu/build-milkymist/milkymist-openwrt.$1-${DATE_TIME}/\nclose" \
| nc turandot.qi-hardware.com 3858
fi


echo "getting version numbers of used repositories..."
${GET_FEEDS_VERSION_SH} ${OPENWRT_DIR} > ${VERSIONS_FILE}


echo "copy all files to IMAGES_DIR..."
cp .config ${IMAGES_DIR}/config
cp build_dir/linux-lm32/linux-3.0/.config ${IMAGES_DIR}/kernel.config
cp feeds.conf ${IMAGES_DIR}/
cp -a bin/lm32/* ${IMAGES_DIR} 2>/dev/null

(cd ${IMAGES_DIR}; \
grep -E "ERROR:\ package.*failed to build" BUILD_LOG | grep -v "package/kernel" > failed_packages.txt; \
bzip2 -z BUILD_LOG; \
)

echo "DONE :)"