mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2025-04-21 12:27:27 +03:00
copy data folder from history branch
Signed-off-by: Xiangfu Liu <xiangfu@sharism.cc>
This commit is contained in:
132
data/qi_lb60/scripts/build
Executable file
132
data/qi_lb60/scripts/build
Executable file
@@ -0,0 +1,132 @@
|
||||
#!/bin/bash
|
||||
|
||||
BASE_DIR="xburst"
|
||||
|
||||
LOG="${BASE_DIR}/LOG"
|
||||
|
||||
BUILD_LOG="${BASE_DIR}/BUILD_LOG"
|
||||
|
||||
DATE=$(date "+%Y-%m-%d")
|
||||
TIME=$(date "+%H-%M-%S")
|
||||
DATE_TIME="${DATE}_${TIME}"
|
||||
|
||||
FEEDS_CONF="feeds.conf.default"
|
||||
test -f "feeds.conf" && FEEDS_CONF="feeds.conf"
|
||||
|
||||
if [ "${0}" != "./scripts/build" ]; then
|
||||
echo "Please call me that way: ./scripts/build"
|
||||
echo " - out of the main directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f ".config" ]; then
|
||||
echo "OpenWrt didn't get configured yet."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -f "config" ]; then
|
||||
echo "file <config> exists."
|
||||
echo "That means normally, a previous build failed"
|
||||
echo "Please examine the situation"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "This script will move previous builds to bak/!"
|
||||
echo "This script will compile base on last commit"
|
||||
echo " your modifications will backup by git stash"
|
||||
echo " those modifications will apply again after compile"
|
||||
echo "This script comes without any kind of warranty!"
|
||||
echo " "
|
||||
echo "Are you brave, dude? [NO/yes]"
|
||||
|
||||
read brave
|
||||
|
||||
echo " "
|
||||
|
||||
if [ "${brave}" != "yes" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "cleaning up toolchain..."
|
||||
mkdir bak 2>/dev/null
|
||||
BAK="build_dir staging_dir tmp bin .config.old feeds xburst config"
|
||||
for bak in $BAK; do
|
||||
mv "${bak}" "bak/${bak}_${DATE_TIME}" 2> /dev/null && echo "backed up <${bak}>"
|
||||
done
|
||||
rm -rf package/feeds/*
|
||||
|
||||
mv .config config
|
||||
mkdir xburst
|
||||
|
||||
echo "updating git repo..."
|
||||
git stash
|
||||
git checkout tracking_backfire
|
||||
git pull > /dev/null
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "ERROR: updating openwrt-xburst failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "updating feeds..."
|
||||
scripts/feeds update -a > /dev/null 2>&1
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "ERROR: updating feeds failed"
|
||||
exit 1
|
||||
fi
|
||||
echo "installing feeds..."
|
||||
scripts/feeds install -a > /dev/null 2>&1
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "ERROR: installing feeds failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "getting version numbers of used repositories..."
|
||||
feeds="$(cat "${FEEDS_CONF}" | grep -v -E "^#")"
|
||||
VERSIONS_FILE="xburst/VERSIONS"
|
||||
echo "# base :: 'openwrt' [scm-protocol] [revision] [source] [branch]" > ${VERSIONS_FILE}
|
||||
tmp=($(git show-ref | head -n 1))
|
||||
rev=${tmp[0]}
|
||||
echo "openwrt git ${rev} git://projects.qi-hardware.com/openwrt-xburst.git tracking_backfire" >> ${VERSIONS_FILE}
|
||||
echo "# feeds :: [feedname] [scm-protocol] [revision]" >> ${VERSIONS_FILE}
|
||||
IFS=$'\n'
|
||||
for feed in $feeds; do
|
||||
IFS=' ' arr=(${feed:4})
|
||||
proto=${arr[0]}
|
||||
dir=${arr[1]}
|
||||
url=${arr[2]}
|
||||
if [ "$proto" = "svn" ]; then
|
||||
cd feeds/${arr[1]} && tmp=($(svn info | grep -E "^Revision")) && cd ../../
|
||||
rev=${tmp[1]}
|
||||
fi
|
||||
if [ "$proto" = "git" ]; then
|
||||
cd feeds/${arr[1]} && tmp=($(git show-ref | head -n 1)) && cd ../../
|
||||
rev=${tmp[0]}
|
||||
fi
|
||||
echo "${dir} ${proto} ${rev}" >> ${VERSIONS_FILE}
|
||||
done
|
||||
|
||||
mkdir -p files/etc
|
||||
echo ${DATE} > files/etc/VERSION
|
||||
|
||||
mv config .config
|
||||
|
||||
yes "" | make oldconfig
|
||||
|
||||
echo "starting compiling - this may take several hours..."
|
||||
|
||||
time make V=99 > xburst/BUILD_LOG 2>&1
|
||||
|
||||
if [ "$?" != "0" ]; then
|
||||
echo "ERROR: Build failed!"
|
||||
echo "Please refer to the log file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
git stash pop
|
||||
|
||||
cp .config xburst/config
|
||||
cp bin/xburst/* xburst/ 2>/dev/null
|
||||
mkdir xburst/files
|
||||
cp -a files/* xburst/files/
|
||||
|
||||
echo "DONE :)"
|
||||
174
data/qi_lb60/scripts/reflash_ben.sh
Normal file
174
data/qi_lb60/scripts/reflash_ben.sh
Normal file
@@ -0,0 +1,174 @@
|
||||
#!/bin/bash
|
||||
VERSION="latest"
|
||||
|
||||
# use 'http' to download and flash images, use 'file' to flash images present in the <WORKING_DIR>
|
||||
PROTOCOL="http"
|
||||
|
||||
# working directory
|
||||
#WORKING_DIR="/tmp/NanoNote/${VERSION}"
|
||||
WORKING_DIR="${HOME}/.qi/nanonote/ben/${VERSION}"
|
||||
|
||||
# where the verbose output goes to
|
||||
LOG_FILE="${WORKING_DIR}/log.txt"
|
||||
|
||||
# URL to images ($URL/$VERSION/$[images])
|
||||
#BASE_URL_HTTP="http://downloads.qi-hardware.com/software/images/Ben_NanoNote_2GB_NAND"
|
||||
BASE_URL_HTTP="http://downloads.qi-hardware.com/software/images/NanoNote/Ben"
|
||||
|
||||
# names of images
|
||||
LOADER="openwrt-xburst-qi_lb60-u-boot.bin"
|
||||
#KERNEL="openwrt-xburst-uImage.bin"
|
||||
KERNEL="openwrt-xburst-qi_lb60-uImage.bin"
|
||||
#ROOTFS="openwrt-xburst-rootfs.ubi"
|
||||
ROOTFS="openwrt-xburst-qi_lb60-root.ubi"
|
||||
|
||||
###############
|
||||
|
||||
# version of script
|
||||
__VERSION__="2.1.1"
|
||||
|
||||
|
||||
# options for reflash bootloader, kernel or rootfs
|
||||
B="TRUE"
|
||||
K="TRUE"
|
||||
R="TRUE"
|
||||
|
||||
while getopts d:l:bkr OPTIONS
|
||||
do
|
||||
case $OPTIONS in
|
||||
d)
|
||||
VERSION=$OPTARG # override version by first argument if passed
|
||||
B="TRUE"
|
||||
K="TRUE"
|
||||
R="TRUE"
|
||||
;;
|
||||
l)
|
||||
WORKING_DIR=$OPTARG
|
||||
VERSION=
|
||||
PROTOCOL="file"
|
||||
B="TRUE"
|
||||
K="TRUE"
|
||||
R="TRUE"
|
||||
;;
|
||||
*)
|
||||
echo "\
|
||||
Usage: $0 [-d <version>] [-l <path to local images>] [-b] [-k] [-r] [-h] [-v]
|
||||
|
||||
without any arguments, I will download and flash the latest official images
|
||||
(includes bootloader, kernel and rootfs)
|
||||
|
||||
-d <> I will download and flash a specific version of official images
|
||||
(includes bootloader, kernel and rootfs)
|
||||
|
||||
-l <> I will flash images present in <arg>
|
||||
(includes bootloader, kernel and rootfs -
|
||||
missing files will be skipped)
|
||||
|
||||
-h you already found out
|
||||
|
||||
|
||||
reflash script for qi-hardware Ben NanoNote
|
||||
|
||||
written by: Mirko Vogt (mirko.vogt@sharism.cc)
|
||||
Xiangfu Liu (xiangfu@sharism.cc)
|
||||
|
||||
version: ${__VERSION__}
|
||||
|
||||
Please report bugs to developer@lists.qi-hardware.com"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# if no arguments were given
|
||||
if [ "$#" == "0" ]; then
|
||||
B="TRUE"
|
||||
K="TRUE"
|
||||
R="TRUE"
|
||||
fi
|
||||
|
||||
# create working directory
|
||||
mkdir -p ${WORKING_DIR}
|
||||
date > "${LOG_FILE}" # purge logfile if exists
|
||||
|
||||
function log() {
|
||||
echo -e "$1"
|
||||
echo -e "$1" >> "${LOG_FILE}"
|
||||
}
|
||||
|
||||
function abort() {
|
||||
log "==="
|
||||
log "fatal error occured - ABORTED"
|
||||
log "==="
|
||||
log "$1"
|
||||
log "==="
|
||||
log "Before reporting this as a bug"
|
||||
log "please ensure you're using the latest available version of"
|
||||
log " this reflash script"
|
||||
log " the xburst-tools"
|
||||
exit 1
|
||||
}
|
||||
|
||||
[ "$(whoami)" == "root" ] || abort "this script must be run as root"
|
||||
|
||||
log "working dir: ${WORKING_DIR}"
|
||||
log "chosen method: ${PROTOCOL}"
|
||||
test ${VERSION} && log "chosen version: ${VERSION}"
|
||||
log "==="
|
||||
|
||||
if [ "$PROTOCOL" == "http" ]; then
|
||||
|
||||
MD5SUMS_SERVER=$(wget -O - ${BASE_URL_HTTP}/${VERSION}/md5sums 2> /dev/null | grep -E "(${LOADER}|${KERNEL}|${ROOTFS})" | sort)
|
||||
[ "${MD5SUMS_SERVER}" ] || abort "can't fetch files from server"
|
||||
|
||||
MD5SUMS_LOCAL=$( (cd "${WORKING_DIR}" ; md5sum --binary "${LOADER}" "${KERNEL}" "${ROOTFS}" 2> /dev/null) | sort )
|
||||
|
||||
if [ "${MD5SUMS_SERVER}" == "${MD5SUMS_LOCAL}" ]; then
|
||||
log "present files are identical to the ones on the server - do not download them again"
|
||||
else
|
||||
rm -f "${WORKING_DIR}/${LOADER}" "${WORKING_DIR}/${KERNEL}" "${WORKING_DIR}/${ROOTFS}"
|
||||
if [ "$B" == "TRUE" ]; then
|
||||
log "fetching bootloader..."
|
||||
wget \
|
||||
-a "${LOG_FILE}" \
|
||||
-P "${WORKING_DIR}" \
|
||||
"${BASE_URL_HTTP}/${VERSION}/${LOADER}"
|
||||
fi
|
||||
if [ "$K" == "TRUE" ]; then
|
||||
log "fetching kernel..."
|
||||
wget \
|
||||
-a "${LOG_FILE}" \
|
||||
-P "${WORKING_DIR}" \
|
||||
"${BASE_URL_HTTP}/${VERSION}/${KERNEL}"
|
||||
fi
|
||||
if [ "$R" == "TRUE" ]; then
|
||||
log "fetching rootfs..."
|
||||
wget \
|
||||
-a "${LOG_FILE}" \
|
||||
-P "${WORKING_DIR}" \
|
||||
"${BASE_URL_HTTP}/${VERSION}/${ROOTFS}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
log "booting device..."
|
||||
usbboot -c "boot" >> "${LOG_FILE}" || abort "can't boot device - xburst-tools setup correctly? device in boot-mode? device connected?"
|
||||
|
||||
if [ "$B" == "TRUE" ]; then
|
||||
log "flashing bootloader..."
|
||||
tmp=$(usbboot -c "nprog 0 ${WORKING_DIR}/${LOADER} 0 0 -n" 3>> "${LOG_FILE}" 2>&1 >&3)
|
||||
test "${tmp}" && abort "error while flashing bootloader:\n${tmp}"
|
||||
fi
|
||||
if [ "$K" == "TRUE" ]; then
|
||||
log "flashing kernel..."
|
||||
tmp=$(usbboot -c "nprog 1024 ${WORKING_DIR}/${KERNEL} 0 0 -n" 3>> "${LOG_FILE}" 2>&1 >&3)
|
||||
test "${tmp}" && abort "error while flashing kernel:\n${tmp}"
|
||||
fi
|
||||
if [ "$R" == "TRUE" ]; then
|
||||
log "erase nand rootfs partition..."
|
||||
usbboot -c "boot;nerase 16 512 0 0" >> "${LOG_FILE}" 2>&1
|
||||
log "flashing rootfs..."
|
||||
tmp=$(usbboot -c "nprog 2048 ${WORKING_DIR}/${ROOTFS} 0 0 -n" 3>> "${LOG_FILE}" 2>&1 >&3)
|
||||
test "${tmp}" && abort "error while flashing rootfs:\n${tmp}"
|
||||
fi
|
||||
log "done"
|
||||
Reference in New Issue
Block a user