Skip to content

Commit

Permalink
scripts: sync with master
Browse files Browse the repository at this point in the history
Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
  • Loading branch information
RobertCNelson committed May 16, 2013
1 parent 8429e0a commit 345d0f1
Show file tree
Hide file tree
Showing 8 changed files with 352 additions and 71 deletions.
59 changes: 54 additions & 5 deletions build_deb.sh
Expand Up @@ -75,7 +75,7 @@ make_deb () {
if [ "x${DTBS}" != "x" ] ; then
echo "make -j${CORES} ARCH=arm LOCALVERSION=-${BUILD} CROSS_COMPILE=\"${CC}\" ${CONFIG_DEBUG_SECTION} dtbs"
make -j${CORES} ARCH=arm LOCALVERSION=-${BUILD} CROSS_COMPILE="${CC}" ${CONFIG_DEBUG_SECTION} dtbs
ls arch/arm/boot/* | grep dtb || unset DTBS
ls arch/arm/boot/* | grep dtb >/dev/null 2>&1 || unset DTBS
fi

KERNEL_UTS=$(cat ${DIR}/KERNEL/include/generated/utsrelease.h | awk '{print $3}' | sed 's/\"//g' )
Expand All @@ -90,6 +90,11 @@ make_firmware_pkg () {
echo "Building Firmware Archive"
echo "-----------------------------"

deployfile="-firmware.tar.gz"
if [ -f "${DIR}/deploy/${KERNEL_UTS}${deployfile}" ] ; then
rm -rf "${DIR}/deploy/${KERNEL_UTS}${deployfile}" || true
fi

if [ -d ${DIR}/deploy/tmp ] ; then
rm -rf ${DIR}/deploy/tmp || true
fi
Expand All @@ -99,12 +104,19 @@ make_firmware_pkg () {

cd ${DIR}/deploy/tmp
echo "-----------------------------"
echo "Building ${KERNEL_UTS}-firmware.tar.gz"
tar czf ../${KERNEL_UTS}-firmware.tar.gz *
echo "Building ${KERNEL_UTS}${deployfile}"
tar czf ../${KERNEL_UTS}${deployfile} *
echo "-----------------------------"

cd ${DIR}/
rm -rf ${DIR}/deploy/tmp || true

if [ ! -f "${DIR}/deploy/${KERNEL_UTS}${deployfile}" ] ; then
export ERROR_MSG="File Generation Failure: [${KERNEL_UTS}${deployfile}]"
/bin/sh -e "${DIR}/scripts/error.sh" && { exit 1 ; }
else
ls -lh "${DIR}/deploy/${KERNEL_UTS}${deployfile}"
fi
}

make_dtbs_pkg () {
Expand All @@ -114,6 +126,11 @@ make_dtbs_pkg () {
echo "Building DTBS Archive"
echo "-----------------------------"

deployfile="-dtbs.tar.gz"
if [ -f "${DIR}/deploy/${KERNEL_UTS}${deployfile}" ] ; then
rm -rf "${DIR}/deploy/${KERNEL_UTS}${deployfile}" || true
fi

if [ -d ${DIR}/deploy/tmp ] ; then
rm -rf ${DIR}/deploy/tmp || true
fi
Expand All @@ -123,18 +140,50 @@ make_dtbs_pkg () {

cd ${DIR}/deploy/tmp
echo "-----------------------------"
echo "Building ${KERNEL_UTS}-dtbs.tar.gz"
tar czf ../${KERNEL_UTS}-dtbs.tar.gz *
echo "Building ${KERNEL_UTS}${deployfile}"
tar czf ../${KERNEL_UTS}${deployfile} *
echo "-----------------------------"

cd ${DIR}/
rm -rf ${DIR}/deploy/tmp || true

if [ ! -f "${DIR}/deploy/${KERNEL_UTS}${deployfile}" ] ; then
export ERROR_MSG="File Generation Failure: [${KERNEL_UTS}${deployfile}]"
/bin/sh -e "${DIR}/scripts/error.sh" && { exit 1 ; }
else
ls -lh "${DIR}/deploy/${KERNEL_UTS}${deployfile}"
fi
}

/bin/sh -e ${DIR}/tools/host_det.sh || { exit 1 ; }

if [ ! -f ${DIR}/system.sh ] ; then
cp ${DIR}/system.sh.sample ${DIR}/system.sh
else
#fixes for bash -> sh conversion...
sed -i 's/bash/sh/g' ${DIR}/system.sh
sed -i 's/==/=/g' ${DIR}/system.sh
fi

if [ -f "${DIR}/branches.list" ] ; then
echo "-----------------------------"
echo "Please checkout one of the active branches:"
echo "-----------------------------"
cat ${DIR}/branches.list | grep -v INACTIVE
echo "-----------------------------"
exit
fi

if [ -f "${DIR}/branch.expired" ] ; then
echo "-----------------------------"
echo "Support for this branch has expired."
unset response
echo -n "Do you wish to bypass this warning and support your self: (y/n)? "
read response
if [ "x${response}" != "xy" ] ; then
exit
fi
echo "-----------------------------"
fi

unset CC
Expand Down
106 changes: 84 additions & 22 deletions build_kernel.sh
Expand Up @@ -74,19 +74,31 @@ make_kernel () {
if [ "x${DTBS}" != "x" ] ; then
echo "make -j${CORES} ARCH=arm LOCALVERSION=-${BUILD} CROSS_COMPILE=\"${CC}\" ${CONFIG_DEBUG_SECTION} dtbs"
make -j${CORES} ARCH=arm LOCALVERSION=-${BUILD} CROSS_COMPILE="${CC}" ${CONFIG_DEBUG_SECTION} dtbs
ls arch/arm/boot/* | grep dtb || unset DTBS
ls arch/arm/boot/* | grep dtb >/dev/null 2>&1 || unset DTBS
fi

KERNEL_UTS=$(cat ${DIR}/KERNEL/include/generated/utsrelease.h | awk '{print $3}' | sed 's/\"//g' )

deployfile=".zImage"
if [ -f "${DIR}/deploy/${KERNEL_UTS}${deployfile}" ] ; then
rm -rf "${DIR}/deploy/${KERNEL_UTS}${deployfile}" || true
rm -rf "${DIR}/deploy/${KERNEL_UTS}.config" || true
fi

if [ -f ./arch/arm/boot/zImage ] ; then
cp arch/arm/boot/zImage ${DIR}/deploy/${KERNEL_UTS}.zImage
cp .config ${DIR}/deploy/${KERNEL_UTS}.config
else
echo "-----------------------------"
echo "Error: make zImage modules failed"
exit
cp -v arch/arm/boot/zImage "${DIR}/deploy/${KERNEL_UTS}.zImage"
cp -v .config "${DIR}/deploy/${KERNEL_UTS}.config"
fi

cd ${DIR}/

if [ ! -f "${DIR}/deploy/${KERNEL_UTS}${deployfile}" ] ; then
export ERROR_MSG="File Generation Failure: [${KERNEL_UTS}${deployfile}]"
/bin/sh -e "${DIR}/scripts/error.sh" && { exit 1 ; }
else
ls -lh "${DIR}/deploy/${KERNEL_UTS}${deployfile}"
fi
}

make_modules_pkg () {
Expand All @@ -96,6 +108,11 @@ make_modules_pkg () {
echo "Building Module Archive"
echo "-----------------------------"

deployfile="-modules.tar.gz"
if [ -f "${DIR}/deploy/${KERNEL_UTS}${deployfile}" ] ; then
rm -rf "${DIR}/deploy/${KERNEL_UTS}${deployfile}" || true
fi

if [ -d ${DIR}/deploy/tmp ] ; then
rm -rf ${DIR}/deploy/tmp || true
fi
Expand All @@ -105,12 +122,19 @@ make_modules_pkg () {

cd ${DIR}/deploy/tmp
echo "-----------------------------"
echo "Building ${KERNEL_UTS}-modules.tar.gz"
tar czf ../${KERNEL_UTS}-modules.tar.gz *
echo "Building ${KERNEL_UTS}${deployfile}"
tar czf ../${KERNEL_UTS}${deployfile} *
echo "-----------------------------"

cd ${DIR}/
rm -rf ${DIR}/deploy/tmp || true

if [ ! -f "${DIR}/deploy/${KERNEL_UTS}${deployfile}" ] ; then
export ERROR_MSG="File Generation Failure: [${KERNEL_UTS}${deployfile}]"
/bin/sh -e "${DIR}/scripts/error.sh" && { exit 1 ; }
else
ls -lh "${DIR}/deploy/${KERNEL_UTS}${deployfile}"
fi
}

make_firmware_pkg () {
Expand All @@ -120,6 +144,11 @@ make_firmware_pkg () {
echo "Building Firmware Archive"
echo "-----------------------------"

deployfile="-firmware.tar.gz"
if [ -f "${DIR}/deploy/${KERNEL_UTS}${deployfile}" ] ; then
rm -rf "${DIR}/deploy/${KERNEL_UTS}${deployfile}" || true
fi

if [ -d ${DIR}/deploy/tmp ] ; then
rm -rf ${DIR}/deploy/tmp || true
fi
Expand All @@ -129,12 +158,19 @@ make_firmware_pkg () {

cd ${DIR}/deploy/tmp
echo "-----------------------------"
echo "Building ${KERNEL_UTS}-firmware.tar.gz"
tar czf ../${KERNEL_UTS}-firmware.tar.gz *
echo "Building ${KERNEL_UTS}${deployfile}"
tar czf ../${KERNEL_UTS}${deployfile} *
echo "-----------------------------"

cd ${DIR}/
rm -rf ${DIR}/deploy/tmp || true

if [ ! -f "${DIR}/deploy/${KERNEL_UTS}${deployfile}" ] ; then
export ERROR_MSG="File Generation Failure: [${KERNEL_UTS}${deployfile}]"
/bin/sh -e "${DIR}/scripts/error.sh" && { exit 1 ; }
else
ls -lh "${DIR}/deploy/${KERNEL_UTS}${deployfile}"
fi
}

make_dtbs_pkg () {
Expand All @@ -144,6 +180,11 @@ make_dtbs_pkg () {
echo "Building DTBS Archive"
echo "-----------------------------"

deployfile="-dtbs.tar.gz"
if [ -f "${DIR}/deploy/${KERNEL_UTS}${deployfile}" ] ; then
rm -rf "${DIR}/deploy/${KERNEL_UTS}${deployfile}" || true
fi

if [ -d ${DIR}/deploy/tmp ] ; then
rm -rf ${DIR}/deploy/tmp || true
fi
Expand All @@ -153,31 +194,41 @@ make_dtbs_pkg () {

cd ${DIR}/deploy/tmp
echo "-----------------------------"
echo "Building ${KERNEL_UTS}-dtbs.tar.gz"
tar czf ../${KERNEL_UTS}-dtbs.tar.gz *
echo "Building ${KERNEL_UTS}${deployfile}"
tar czf ../${KERNEL_UTS}${deployfile} *
echo "-----------------------------"

cd ${DIR}/
rm -rf ${DIR}/deploy/tmp || true

if [ ! -f "${DIR}/deploy/${KERNEL_UTS}${deployfile}" ] ; then
export ERROR_MSG="File Generation Failure: [${KERNEL_UTS}${deployfile}]"
/bin/sh -e "${DIR}/scripts/error.sh" && { exit 1 ; }
else
ls -lh "${DIR}/deploy/${KERNEL_UTS}${deployfile}"
fi
}

/bin/sh -e ${DIR}/tools/host_det.sh || { exit 1 ; }

if [ ! -f ${DIR}/system.sh ] ; then
cp ${DIR}/system.sh.sample ${DIR}/system.sh
else
#fixes for bash -> sh conversion...
sed -i 's/bash/sh/g' ${DIR}/system.sh
sed -i 's/==/=/g' ${DIR}/system.sh
fi

unset CC
unset DEBUG_SECTION
unset LINUX_GIT
unset LOCAL_PATCH_DIR
. ${DIR}/system.sh
/bin/sh -e "${DIR}/scripts/gcc.sh" || { exit 1 ; }
. ${DIR}/.CC
echo "debug: CC=${CC}"
if [ -f "${DIR}/branches.list" ] ; then
echo "-----------------------------"
echo "Please checkout one of the active branches:"
echo "-----------------------------"
cat ${DIR}/branches.list | grep -v INACTIVE
echo "-----------------------------"
exit
fi

. ${DIR}/version.sh
if [ "${EXPIRED_BRANCH}" ] ; then
if [ -f "${DIR}/branch.expired" ] ; then
echo "-----------------------------"
echo "Support for this branch has expired."
unset response
Expand All @@ -188,6 +239,17 @@ if [ "${EXPIRED_BRANCH}" ] ; then
fi
echo "-----------------------------"
fi

unset CC
unset DEBUG_SECTION
unset LINUX_GIT
unset LOCAL_PATCH_DIR
. ${DIR}/system.sh
/bin/sh -e "${DIR}/scripts/gcc.sh" || { exit 1 ; }
. ${DIR}/.CC
echo "debug: CC=${CC}"

. ${DIR}/version.sh
export LINUX_GIT

unset CONFIG_DEBUG_SECTION
Expand Down
69 changes: 69 additions & 0 deletions scripts/error.sh
@@ -0,0 +1,69 @@
#!/bin/sh -e
#
# Copyright (c) 2013 Robert Nelson <robertcnelson@gmail.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

DIR=$PWD

#Yuck, this error script can be called two directories...
offset="/"
if [ -f ${DIR}/../version.sh ] ; then
. ${DIR}/../version.sh
offset="../"
fi
if [ -f ${DIR}/../../version.sh ] ; then
. ${DIR}/../../version.sh
offset="../../"
fi

echo "-----------------------------"
echo "Script Error: please cut and paste the following into an email to: bugs@rcn-ee.com"
echo "**********************************************************"
echo "Error: [${ERROR_MSG}]"

if [ -f "${DIR}/${offset}.git/config" ] ; then
gitrepo=$(cat "${DIR}/${offset}.git/config" | grep url | awk '{print $3}')
gitwhatchanged=$(cd ${offset} ; git whatchanged -1)
echo "git repo: [${gitrepo}]"
echo "-----------------------------"
echo "${gitwhatchanged}"
echo "-----------------------------"
else
if [ "${BRANCH}" ] ; then
echo "nongit: [${BRANCH}]"
else
echo "nongit: [master]"
fi
fi

if [ ! "${KERNEL_SHA}" ] ; then
echo "kernel: [v${KERNEL_TAG}-${BUILD}]"
else
echo "kernel: [v${KERNEL_TAG}-${BUILD}] + [${KERNEL_SHA}]"
fi

echo "uname -m"
uname -m
if [ $(which lsb_release) ] ; then
echo "lsb_release -a"
lsb_release -a
fi
echo "**********************************************************"

0 comments on commit 345d0f1

Please sign in to comment.