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

Source at commit 97b9b842ec7a4620de2b77151f52f90c3b81c980 created 8 years 4 months ago.
By Xiangfu, nanonote-files: compile script file: collect all failed package in minial build
1#!/bin/bash
2
3# This script file is using in build host, Xiangfu <xiangfu@openmobilefree.net>
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
57if [ "$1" == "full_system" ]; then
58    echo "re-write config file"
59    cp .config ${IMAGES_DIR}/config.autogen
60    cp /home/xiangfu/config .config
61fi
62
63
64echo "getting version numbers of used repositories..."
65HEAD_NEW=`${GET_FEEDS_VERSION_SH} ${OPENWRT_DIR}`
66HEAD_OLD=`cat ${IMAGES_DIR}/../${OPENWRT_DIR_NAME}.VERSIONS`
67if [ "${HEAD_NEW}" == "${HEAD_OLD}" ]; then
68    echo "No new commit, ignore build"
69    rm -f ${BUILD_LOG} ${VERSIONS_FILE}
70    rmdir ${IMAGES_DIR}
71    exit 0
72fi
73${GET_FEEDS_VERSION_SH} ${OPENWRT_DIR} > ${VERSIONS_FILE}
74cp ${VERSIONS_FILE} ${IMAGES_DIR}/../${OPENWRT_DIR_NAME}.VERSIONS
75
76echo "copy files, create VERSION, link dl folder, last prepare..."
77rm -f files && ln -s feeds/qipackages/nanonote-files/data/qi_lb60/files/
78rm -f dl && ln -s ~/dl
79mkdir -p files/etc && echo ${DATE} > files/etc/VERSION
80mkdir -p files/etc/uci-defaults && \
81    echo -e "\0043\0041/bin/sh \ndate --set `date +"%Y%m%d%H%M"`\n \
82hwclock --systohc" > files/etc/uci-defaults/99-set-time
83
84
85echo "patch openwrt..."
86${PATCH_OPENWRT_SH} ${OPENWRT_DIR}
87
88
89echo "starting compiling - this may take several hours..."
90time make ${MAKE_VARS} > ${IMAGES_DIR}/BUILD_LOG 2>&1
91MAKE_RET="$?"
92
93
94echo "copy all files to IMAGES_DIR..."
95cp .config ${IMAGES_DIR}/config
96cp build_dir/linux-xburst_qi_lb60/linux-*/.config ${IMAGES_DIR}/kernel.config
97cp feeds.conf ${IMAGES_DIR}/
98cp -a bin/xburst/* ${IMAGES_DIR} 2>/dev/null
99mkdir -p ${IMAGES_DIR}/files
100cp -a files/* ${IMAGES_DIR}/files/
101
102(cd ${IMAGES_DIR} && \
103    grep -E "ERROR:\ package.*failed to build" BUILD_LOG | \
104    grep -v "package/kernel" > failed_packages.txt; \
105)
106
107if [ "${MAKE_RET}" != "0" ]; then
108    echo "ERROR: Build failed! please refer to the BUILD_LOG file"
109    tail -n 100 ${IMAGES_DIR}/BUILD_LOG > ${IMAGES_DIR}/BUILD_LOG.last100
110    MSG="The build has FAILED"
111    URL="http://fidelio.qi-hardware.com/~xiangfu/building/Nanonote/Ben\
112/${OPENWRT_DIR_NAME}-${DATE_TIME}"
113else
114    (cd ${IMAGES_DIR} && \
115        bzip2 -z openwrt-xburst-qi_lb60-root.ubi; \
116    )
117    mv ${IMAGES_DIR} ${DEST_DIR}
118    MSG="The build was successful"
119    URL="${IMAGES_URL}/${OPENWRT_DIR_NAME}-${DATE_TIME}"
120fi
121
122(cd ${IMAGES_DIR} && bzip2 -z BUILD_LOG;)
123
124echo -e "say #qi-hardware ${MSG}: ${URL} \nclose" \
125    | nc turandot.qi-hardware.com 3858
126
127echo "Done"
128

Archive Download this file



interactive