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
20IMAGES_DIR="/home/xiangfu/compile-log/${OPENWRT_DIR_NAME}-${DATE_TIME}/"
21mkdir -p ${IMAGES_DIR}
22
23BUILD_LOG="${IMAGES_DIR}/BUILD_LOG"
24VERSIONS_FILE="${IMAGES_DIR}/VERSIONS"
25
26
27########################################################################
28cd ${OPENWRT_DIR}
29
30echo "make distclean ..."
31make distclean
32
33
34echo "updating git repo..."
35git fetch -a
36git reset --hard origin/master
37if [ "$?" != "0" ]; then
38    echo "ERROR: updating openwrt-xburst failed"
39    exit 1
40fi
41
42
43echo "update and install feeds..."
44./scripts/feeds update -a && ./scripts/feeds install -a
45if [ "$?" != "0" ]; then
46    echo "ERROR: update and install feeds failed"
47    exit 1
48fi
49cp feeds/qipackages/nanonote-files/data/qi_lb60/conf/${CONFIG_FILE_TYPE} .config
50sed -i '/CONFIG_ALL/s/.*/CONFIG_ALL=y/' .config
51yes "" | make oldconfig > /dev/null
52
53
54echo "copy files, create VERSION, copy dl folder, last prepare..."
55rm -f files && ln -s feeds/qipackages/nanonote-files/data/qi_lb60/files/
56rm -f dl && ln -s ~/dl
57mkdir -p files/etc && echo ${DATE} > files/etc/VERSION
58    mkdir -p files/etc/uci-defaults && echo -e "\0043\0041/bin/sh \ndate --set `date +"%Y%m%d%H%M"`\nhwclock --systohc" > files/etc/uci-defaults/99-set-time
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} > ${IMAGES_DIR}/BUILD_LOG 2>&1
67if [ "$?" != "0" ]; then
68    echo "ERROR: Build failed! Please refer to the log file"
69    tail -n 100 ${IMAGES_DIR}/BUILD_LOG > ${IMAGES_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 IMAGES_DIR..."
87cp .config ${IMAGES_DIR}/config
88cp build_dir/linux-xburst_qi_lb60/linux-*/.config ${IMAGES_DIR}/kernel.config
89cp feeds.conf ${IMAGES_DIR}/
90cp -a bin/xburst/* ${IMAGES_DIR} 2>/dev/null
91mkdir -p ${IMAGES_DIR}/files
92cp -a files/* ${IMAGES_DIR}/files/
93
94(cd ${IMAGES_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