OpenWrt packages
Sign in or create your account | Project List | Help
OpenWrt packages Git Source Tree
Root/
| 1 | #!/bin/bash |
| 2 | |
| 3 | # this script file is using in build host |
| 4 | # $1: full_system minimal xbboot |
| 5 | |
| 6 | OPENWRT_DIR_NAME="openwrt-xburst."$1 |
| 7 | OPENWRT_DIR="/home/xiangfu/${OPENWRT_DIR_NAME}/" |
| 8 | CONFIG_FILE_TYPE="config."$1 |
| 9 | |
| 10 | MAKE_VARS=" V=99 IGNORE_ERRORS=m " |
| 11 | |
| 12 | ######################################################################## |
| 13 | DATE=$(date "+%Y-%m-%d") |
| 14 | TIME=$(date "+%H-%M-%S") |
| 15 | DATE_TIME=`date +"%m%d%Y-%H%M"` |
| 16 | |
| 17 | GET_FEEDS_VERSION_SH="/home/xiangfu/bin/get-feeds-revision.sh" |
| 18 | PATCH_OPENWRT_SH="/home/xiangfu/bin/patch-openwrt.sh" |
| 19 | |
| 20 | IMAGES_DIR="/home/xiangfu/compile-log/${OPENWRT_DIR_NAME}-${DATE_TIME}/" |
| 21 | mkdir -p ${IMAGES_DIR} |
| 22 | |
| 23 | BUILD_LOG="${IMAGES_DIR}/BUILD_LOG" |
| 24 | VERSIONS_FILE="${IMAGES_DIR}/VERSIONS" |
| 25 | |
| 26 | |
| 27 | ######################################################################## |
| 28 | cd ${OPENWRT_DIR} |
| 29 | |
| 30 | echo "make distclean ..." |
| 31 | make distclean |
| 32 | |
| 33 | |
| 34 | echo "updating git repo..." |
| 35 | git fetch -a |
| 36 | git reset --hard origin/master |
| 37 | if [ "$?" != "0" ]; then |
| 38 | echo "ERROR: updating openwrt-xburst failed" |
| 39 | exit 1 |
| 40 | fi |
| 41 | |
| 42 | |
| 43 | echo "update and install feeds..." |
| 44 | ./scripts/feeds update -a && ./scripts/feeds install -a |
| 45 | if [ "$?" != "0" ]; then |
| 46 | echo "ERROR: update and install feeds failed" |
| 47 | exit 1 |
| 48 | fi |
| 49 | cp feeds/qipackages/nanonote-files/data/qi_lb60/conf/${CONFIG_FILE_TYPE} .config |
| 50 | sed -i '/CONFIG_ALL/s/.*/CONFIG_ALL=y/' .config |
| 51 | yes "" | make oldconfig > /dev/null |
| 52 | |
| 53 | |
| 54 | echo "copy files, create VERSION, copy dl folder, last prepare..." |
| 55 | rm -f files && ln -s feeds/qipackages/nanonote-files/data/qi_lb60/files/ |
| 56 | rm -f dl && ln -s ~/dl |
| 57 | mkdir -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 | |
| 61 | echo "patch openwrt " |
| 62 | ${PATCH_OPENWRT_SH} ${OPENWRT_DIR} |
| 63 | |
| 64 | |
| 65 | echo "starting compiling - this may take several hours..." |
| 66 | time make ${MAKE_VARS} > ${IMAGES_DIR}/BUILD_LOG 2>&1 |
| 67 | if [ "$?" != "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 "\ |
| 71 | say #qi-hardware The build has FAILED, \ |
| 72 | see log here: http://fidelio.qi-hardware.com/~xiangfu/compile-log/${OPENWRT_DIR_NAME}-${DATE_TIME}/\nclose" \ |
| 73 | | nc turandot.qi-hardware.com 3858 |
| 74 | else |
| 75 | echo -e "\ |
| 76 | say #qi-hardware The build was successfull, \ |
| 77 | see images here: http://fidelio.qi-hardware.com/~xiangfu/compile-log/${OPENWRT_DIR_NAME}-${DATE_TIME}/\nclose" \ |
| 78 | | nc turandot.qi-hardware.com 3858 |
| 79 | fi |
| 80 | |
| 81 | |
| 82 | echo "getting version numbers of used repositories..." |
| 83 | ${GET_FEEDS_VERSION_SH} ${OPENWRT_DIR} > ${VERSIONS_FILE} |
| 84 | |
| 85 | |
| 86 | echo "copy all files to IMAGES_DIR..." |
| 87 | cp .config ${IMAGES_DIR}/config |
| 88 | cp build_dir/linux-xburst_qi_lb60/linux-*/.config ${IMAGES_DIR}/kernel.config |
| 89 | cp feeds.conf ${IMAGES_DIR}/ |
| 90 | cp -a bin/xburst/* ${IMAGES_DIR} 2>/dev/null |
| 91 | mkdir -p ${IMAGES_DIR}/files |
| 92 | cp -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 | |
| 100 | echo "DONE :)" |
| 101 |
