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

1#!/bin/bash
2DATE=$(date "+%Y-%m-%d")
3TIME=$(date "+%H-%M-%S")
4DATE_TIME=`date +"%m%d%Y-%H%M"`
5
6# this script file is using in build host
7
8# $1: full_system minimal xbboot
9OPENWRT_DIR_NAME="openwrt-xburst."$1
10CONFIG_FILE_TYPE="config."$1
11
12# you may need change those Variables
13BASE_DIR="/home/xiangfu/compile-log/"
14OPENWRT_DIR="/home/xiangfu/${OPENWRT_DIR_NAME}/"
15GET_FEEDS_VERSION_SH="/home/xiangfu/bin/get-feeds-revision.sh"
16
17IMAGE_DIR="${BASE_DIR}/${OPENWRT_DIR_NAME}-${DATE_TIME}/"
18BUILD_LOG="${IMAGE_DIR}/BUILD_LOG"
19VERSIONS_FILE="${IMAGE_DIR}/VERSIONS"
20
21MAKE_VARS=" V=99 IGNORE_ERRORS=m "
22
23########################################################################
24cd ${OPENWRT_DIR}
25
26echo "make distclean ..."
27make distclean
28
29
30echo "updating git repo..."
31git fetch -a
32git reset --hard origin/master
33if [ "$?" != "0" ]; then
34    echo "ERROR: updating openwrt-xburst failed"
35    exit 1
36fi
37
38
39echo "update and install feeds..."
40./scripts/feeds update -a && ./scripts/feeds install -a
41if [ "$?" != "0" ]; then
42    echo "ERROR: update and install feeds failed"
43    exit 1
44fi
45cp feeds/qipackages/nanonote-files/data/qi_lb60/conf/${CONFIG_FILE_TYPE} .config
46sed -i '/CONFIG_ALL/s/.*/CONFIG_ALL=y/' .config
47yes "" | make oldconfig > /dev/null
48
49
50echo "copy files, create VERSION, copy dl folder, last prepare..."
51rm -f files && ln -s feeds/qipackages/nanonote-files/data/qi_lb60/files/
52rm -f dl && ln -s ~/dl
53mkdir -p files/etc && echo ${DATE} > files/etc/VERSION
54
55
56echo "starting compiling - this may take several hours..."
57mkdir -p ${IMAGE_DIR}
58time make ${MAKE_VARS} > ${IMAGE_DIR}/BUILD_LOG 2>&1
59if [ "$?" != "0" ]; then
60    echo "ERROR: Build failed! Please refer to the log file"
61    tail -n 100 ${IMAGE_DIR}/BUILD_LOG > ${IMAGE_DIR}/BUILD_LOG.`date +"%m%d%Y-%H%M"`.last100
62fi
63
64
65echo "getting version numbers of used repositories..."
66${GET_FEEDS_VERSION_SH} ${OPENWRT_DIR} > ${VERSIONS_FILE}
67
68
69echo "copy all files to IMAGE_DIR..."
70cp .config ${IMAGE_DIR}/config
71cp feeds.conf ${IMAGE_DIR}/
72cp -a bin/xburst/* ${IMAGE_DIR} 2>/dev/null
73mkdir -p ${IMAGE_DIR}/files
74cp -a files/* ${IMAGE_DIR}/files/
75
76(cd ${IMAGE_DIR}; \
77 bzip2 -z BUILD_LOG; \
78 bzip2 -z openwrt-xburst-qi_lb60-root.ubi; \
79)
80
81echo "DONE :)"
82

Archive Download this file



interactive