2011-04-18 17:53:45 +03:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# this script file is using in build host
|
|
|
|
# $1: full_system minimal xbboot
|
2011-08-03 04:54:49 +03:00
|
|
|
|
2011-04-18 17:53:45 +03:00
|
|
|
OPENWRT_DIR_NAME="openwrt-xburst."$1
|
2011-08-03 04:54:49 +03:00
|
|
|
OPENWRT_DIR="/home/xiangfu/${OPENWRT_DIR_NAME}/"
|
2011-04-18 17:53:45 +03:00
|
|
|
CONFIG_FILE_TYPE="config."$1
|
|
|
|
|
2011-10-20 10:11:22 +03:00
|
|
|
MAKE_VARS=" V=99 IGNORE_ERRORS=m "
|
2011-08-03 04:54:49 +03:00
|
|
|
|
|
|
|
########################################################################
|
|
|
|
DATE=$(date "+%Y-%m-%d")
|
2012-01-27 13:48:46 +02:00
|
|
|
DATE_TIME=`date +"%Y%m%d-%H%M"`
|
2011-08-03 04:54:49 +03:00
|
|
|
|
2011-04-18 17:53:45 +03:00
|
|
|
GET_FEEDS_VERSION_SH="/home/xiangfu/bin/get-feeds-revision.sh"
|
2011-08-03 04:54:49 +03:00
|
|
|
PATCH_OPENWRT_SH="/home/xiangfu/bin/patch-openwrt.sh"
|
2011-04-18 17:53:45 +03:00
|
|
|
|
2012-01-27 13:48:46 +02:00
|
|
|
IMAGES_DIR="/home/xiangfu/building/Nanonote/Ben/${OPENWRT_DIR_NAME}-${DATE_TIME}/"
|
|
|
|
DEST_DIR="/home/xiangfu/build-nanonote"
|
2011-09-09 06:27:26 +03:00
|
|
|
mkdir -p ${IMAGES_DIR}
|
2012-01-27 13:48:46 +02:00
|
|
|
mkdir -p ${DEST_DIR}
|
2011-08-03 04:54:49 +03:00
|
|
|
|
2011-09-09 06:27:26 +03:00
|
|
|
BUILD_LOG="${IMAGES_DIR}/BUILD_LOG"
|
|
|
|
VERSIONS_FILE="${IMAGES_DIR}/VERSIONS"
|
2011-04-18 17:53:45 +03:00
|
|
|
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
cd ${OPENWRT_DIR}
|
|
|
|
|
|
|
|
echo "make distclean ..."
|
|
|
|
make distclean
|
|
|
|
|
|
|
|
|
|
|
|
echo "updating git repo..."
|
|
|
|
git fetch -a
|
|
|
|
git reset --hard origin/master
|
|
|
|
if [ "$?" != "0" ]; then
|
|
|
|
echo "ERROR: updating openwrt-xburst failed"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
echo "update and install feeds..."
|
|
|
|
./scripts/feeds update -a && ./scripts/feeds install -a
|
|
|
|
if [ "$?" != "0" ]; then
|
|
|
|
echo "ERROR: update and install feeds failed"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
cp feeds/qipackages/nanonote-files/data/qi_lb60/conf/${CONFIG_FILE_TYPE} .config
|
|
|
|
sed -i '/CONFIG_ALL/s/.*/CONFIG_ALL=y/' .config
|
|
|
|
yes "" | make oldconfig > /dev/null
|
|
|
|
|
|
|
|
|
|
|
|
echo "copy files, create VERSION, copy dl folder, last prepare..."
|
|
|
|
rm -f files && ln -s feeds/qipackages/nanonote-files/data/qi_lb60/files/
|
|
|
|
rm -f dl && ln -s ~/dl
|
|
|
|
mkdir -p files/etc && echo ${DATE} > files/etc/VERSION
|
2011-09-09 06:27:26 +03:00
|
|
|
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
|
2011-04-18 17:53:45 +03:00
|
|
|
|
|
|
|
|
2011-08-03 04:54:49 +03:00
|
|
|
echo "patch openwrt "
|
|
|
|
${PATCH_OPENWRT_SH} ${OPENWRT_DIR}
|
|
|
|
|
|
|
|
|
2011-04-18 17:53:45 +03:00
|
|
|
echo "starting compiling - this may take several hours..."
|
2011-09-09 06:27:26 +03:00
|
|
|
time make ${MAKE_VARS} > ${IMAGES_DIR}/BUILD_LOG 2>&1
|
2011-04-18 17:53:45 +03:00
|
|
|
if [ "$?" != "0" ]; then
|
|
|
|
echo "ERROR: Build failed! Please refer to the log file"
|
2011-09-09 06:27:26 +03:00
|
|
|
tail -n 100 ${IMAGES_DIR}/BUILD_LOG > ${IMAGES_DIR}/BUILD_LOG.`date +"%m%d%Y-%H%M"`.last100
|
2011-08-03 04:54:49 +03:00
|
|
|
echo -e "\
|
|
|
|
say #qi-hardware The build has FAILED, \
|
2012-01-30 08:11:51 +02:00
|
|
|
see log here: http://fidelio.qi-hardware.com/~xiangfu/build-nanonote/${OPENWRT_DIR_NAME}-${DATE_TIME}/\nclose" \
|
2011-08-03 04:54:49 +03:00
|
|
|
| nc turandot.qi-hardware.com 3858
|
|
|
|
else
|
|
|
|
echo -e "\
|
2012-02-23 06:02:24 +02:00
|
|
|
say #qi-hardware The build was successful, \
|
2012-01-30 08:11:51 +02:00
|
|
|
see images here: http://fidelio.qi-hardware.com/~xiangfu/build-nanonote/${OPENWRT_DIR_NAME}-${DATE_TIME}/\nclose" \
|
2011-08-03 04:54:49 +03:00
|
|
|
| nc turandot.qi-hardware.com 3858
|
2011-04-18 17:53:45 +03:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
echo "getting version numbers of used repositories..."
|
|
|
|
${GET_FEEDS_VERSION_SH} ${OPENWRT_DIR} > ${VERSIONS_FILE}
|
|
|
|
|
|
|
|
|
2011-09-09 06:27:26 +03:00
|
|
|
echo "copy all files to IMAGES_DIR..."
|
|
|
|
cp .config ${IMAGES_DIR}/config
|
2011-10-20 10:11:22 +03:00
|
|
|
cp build_dir/linux-xburst_qi_lb60/linux-*/.config ${IMAGES_DIR}/kernel.config
|
2011-09-09 06:27:26 +03:00
|
|
|
cp feeds.conf ${IMAGES_DIR}/
|
|
|
|
cp -a bin/xburst/* ${IMAGES_DIR} 2>/dev/null
|
|
|
|
mkdir -p ${IMAGES_DIR}/files
|
|
|
|
cp -a files/* ${IMAGES_DIR}/files/
|
2011-04-18 17:53:45 +03:00
|
|
|
|
2011-09-09 06:27:26 +03:00
|
|
|
(cd ${IMAGES_DIR}; \
|
2011-08-03 04:54:49 +03:00
|
|
|
grep -E "ERROR:\ package.*failed to build" BUILD_LOG | grep -v "package/kernel" > failed_packages.txt; \
|
2011-04-18 17:53:45 +03:00
|
|
|
bzip2 -z BUILD_LOG; \
|
|
|
|
bzip2 -z openwrt-xburst-qi_lb60-root.ubi; \
|
|
|
|
)
|
|
|
|
|
2012-01-27 13:48:46 +02:00
|
|
|
mv ${IMAGES_DIR} ${DEST_DIR}
|
|
|
|
|
|
|
|
echo "DONE!"
|