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

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")
14TIME=$(date "+%H-%M-%S")
15DATE_TIME=`date +"%m%d%Y-%H%M"`
16
17GET_FEEDS_VERSION_SH="/home/xiangfu/bin/get-feeds-revision.sh"
18PATCH_OPENWRT_SH="/home/xiangfu/bin/patch-openwrt.sh"
19
20BASE_DIR="/home/xiangfu/compile-log/"
21IMAGE_DIR="${BASE_DIR}/${OPENWRT_DIR_NAME}-${DATE_TIME}/"
22mkdir -p ${IMAGE_DIR}
23
24BUILD_LOG="${IMAGE_DIR}/BUILD_LOG"
25VERSIONS_FILE="${IMAGE_DIR}/VERSIONS"
26
27
28########################################################################
29cd ${OPENWRT_DIR}
30
31echo "make distclean ..."
32make distclean
33
34
35echo "updating git repo..."
36git fetch -a
37git reset --hard origin/master
38if [ "$?" != "0" ]; then
39    echo "ERROR: updating openwrt-xburst failed"
40    exit 1
41fi
42
43
44echo "update and install feeds..."
45./scripts/feeds update -a && ./scripts/feeds install -a
46if [ "$?" != "0" ]; then
47    echo "ERROR: update and install feeds failed"
48    exit 1
49fi
50cp feeds/qipackages/nanonote-files/data/qi_lb60/conf/${CONFIG_FILE_TYPE} .config
51sed -i '/CONFIG_ALL/s/.*/CONFIG_ALL=y/' .config
52yes "" | make oldconfig > /dev/null
53
54
55echo "copy files, create VERSION, copy dl folder, last prepare..."
56rm -f files && ln -s feeds/qipackages/nanonote-files/data/qi_lb60/files/
57rm -f dl && ln -s ~/dl
58mkdir -p files/etc && echo ${DATE} > files/etc/VERSION
59
60
61echo "patch openwrt "
62${PATCH_OPENWRT_SH} ${OPENWRT_DIR}
63
64
65echo "starting compiling - this may take several hours..."
66time make ${MAKE_VARS} > ${IMAGE_DIR}/BUILD_LOG 2>&1
67if [ "$?" != "0" ]; then
68    echo "ERROR: Build failed! Please refer to the log file"
69    tail -n 100 ${IMAGE_DIR}/BUILD_LOG > ${IMAGE_DIR}/BUILD_LOG.`date +"%m%d%Y-%H%M"`.last100
70        echo -e "\
71say #qi-hardware The build has FAILED, \
72see log here: http://fidelio.qi-hardware.com/~xiangfu/compile-log/${OPENWRT_DIR_NAME}-${DATE_TIME}/\nclose" \
73             | nc turandot.qi-hardware.com 3858
74else
75echo -e "\
76say #qi-hardware The build was successfull, \
77see images here: http://fidelio.qi-hardware.com/~xiangfu/compile-log/${OPENWRT_DIR_NAME}-${DATE_TIME}/\nclose" \
78     | nc turandot.qi-hardware.com 3858
79fi
80
81
82echo "getting version numbers of used repositories..."
83${GET_FEEDS_VERSION_SH} ${OPENWRT_DIR} > ${VERSIONS_FILE}
84
85
86echo "copy all files to IMAGE_DIR..."
87cp .config ${IMAGE_DIR}/config
88cp build_dir/linux-xburst_qi_lb60/linux-2.6*/.config ${IMAGE_DIR}/kernel.config
89cp feeds.conf ${IMAGE_DIR}/
90cp -a bin/xburst/* ${IMAGE_DIR} 2>/dev/null
91mkdir -p ${IMAGE_DIR}/files
92cp -a files/* ${IMAGE_DIR}/files/
93
94(cd ${IMAGE_DIR}; \
95 grep -E "ERROR:\ package.*failed to build" BUILD_LOG | grep -v "package/kernel" > failed_packages.txt; \
96 bzip2 -z BUILD_LOG; \
97 bzip2 -z openwrt-xburst-qi_lb60-root.ubi; \
98)
99
100echo "DONE :)"
101

Archive Download this file



interactive