Root/nanonote-files/data/qi_lb60/scripts/compile-openwrt-xburst.sh

Source at commit 26a488ae1fbef3b20ce247e767c6f63f17793c0b created 9 years 1 month ago.
By Xiangfu Liu, compile-openwrt-xburst.sh: don't copy failed build to IMAGES_URL
1#!/bin/bash
2
3# This script file is using in build host
4# $1: full_system minimal xbboot
5
6OPENWRT_DIR_NAME="openwrt-xburst."$1
7OPENWRT_DIR="/home/xiangfu/${OPENWRT_DIR_NAME}/"
8CONFIG_FILE_TYPE="config."$1
9
10MAKE_VARS=" V=99 IGNORE_ERRORS=m "
11
12########################################################################
13DATE=$(date "+%Y-%m-%d")
14DATE_TIME=`date +"%Y%m%d-%H%M"`
15
16GET_FEEDS_VERSION_SH="/home/xiangfu/bin/get-feeds-revision.sh"
17PATCH_OPENWRT_SH="/home/xiangfu/bin/patch-openwrt.sh"
18
19IMAGES_URL="http://fidelio.qi-hardware.com/~xiangfu/build-nanonote"
20IMAGES_DIR_BASE="/home/xiangfu/building/Nanonote/Ben"
21IMAGES_DIR="${IMAGES_DIR_BASE}/${OPENWRT_DIR_NAME}-${DATE_TIME}/"
22DEST_DIR="/home/xiangfu/build-nanonote"
23mkdir -p ${IMAGES_DIR}
24mkdir -p ${DEST_DIR}
25
26BUILD_LOG="${IMAGES_DIR}/BUILD_LOG"
27VERSIONS_FILE="${IMAGES_DIR}/VERSIONS"
28
29########################################################################
30cd ${OPENWRT_DIR}
31
32echo "make distclean..."
33make distclean
34
35
36echo "updating git repo..."
37git fetch -a
38git reset --hard origin/master
39if [ "$?" != "0" ]; then
40    echo "ERROR: updating openwrt-xburst failed"
41    exit 1
42fi
43
44
45echo "update and install feeds..."
46./scripts/feeds update -a && ./scripts/feeds install -a
47if [ "$?" != "0" ]; then
48    echo "ERROR: update and install feeds failed"
49    exit 1
50fi
51cp feeds/qipackages/nanonote-files/data/qi_lb60/conf/${CONFIG_FILE_TYPE} \
52    .config
53sed -i '/CONFIG_ALL/s/.*/CONFIG_ALL=y/' .config
54yes "" | make oldconfig > /dev/null
55
56
57echo "copy files, create VERSION, link dl folder, last prepare..."
58rm -f files && ln -s feeds/qipackages/nanonote-files/data/qi_lb60/files/
59rm -f dl && ln -s ~/dl
60mkdir -p files/etc && echo ${DATE} > files/etc/VERSION
61mkdir -p files/etc/uci-defaults && \
62    echo -e "\0043\0041/bin/sh \ndate --set `date +"%Y%m%d%H%M"`\nhwclock --systohc" > files/etc/uci-defaults/99-set-time
63
64
65echo "patch openwrt..."
66${PATCH_OPENWRT_SH} ${OPENWRT_DIR}
67
68
69echo "starting compiling - this may take several hours..."
70time make ${MAKE_VARS} > ${IMAGES_DIR}/BUILD_LOG 2>&1
71MAKE_RET="$?"
72
73
74echo "getting version numbers of used repositories..."
75${GET_FEEDS_VERSION_SH} ${OPENWRT_DIR} > ${VERSIONS_FILE}
76
77
78echo "copy all files to IMAGES_DIR..."
79cp .config ${IMAGES_DIR}/config
80cp build_dir/linux-xburst_qi_lb60/linux-*/.config ${IMAGES_DIR}/kernel.config
81cp feeds.conf ${IMAGES_DIR}/
82cp -a bin/xburst/* ${IMAGES_DIR} 2>/dev/null
83mkdir -p ${IMAGES_DIR}/files
84cp -a files/* ${IMAGES_DIR}/files/
85
86(cd ${IMAGES_DIR}; \
87    grep -E "ERROR:\ package.*failed to build" BUILD_LOG | \
88        grep -v "package/kernel" > failed_packages.txt; \
89    bzip2 -z BUILD_LOG; \
90    bzip2 -z openwrt-xburst-qi_lb60-root.ubi; \
91)
92
93if [ "${MAKE_RET}" != "0" ]; then
94    echo "ERROR: Build failed! please refer to the BUILD_LOG file"
95    tail -n 100 ${IMAGES_DIR}/BUILD_LOG > \
96    ${IMAGES_DIR}/BUILD_LOG.`date +"%m%d%Y-%H%M"`.last100
97    MSG="The build was FAILED"
98    URL="http://fidelio.qi-hardware.com/~xiangfu/building/Nanonote/Ben/\
99/${OPENWRT_DIR_NAME}-${DATE_TIME}"
100else
101    mv ${IMAGES_DIR} ${DEST_DIR}
102    MSG="The build was successful"
103    URL="${IMAGES_URL}/${OPENWRT_DIR_NAME}-${DATE_TIME}"
104fi
105
106echo -e "say #qi-hardware ${MSG}: ${URL} \nclose" \
107    | nc turandot.qi-hardware.com 3858
108
109echo "Done"
110

Archive Download this file



interactive