Newer
Older
Robert Nelson
committed
# Copyright (c) 2009-2014 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
mkdir -p ${DIR}/deploy/
Robert Nelson
committed
export DIR
/bin/sh -e ${DIR}/patch.sh || { git add . ; exit 1 ; }
Robert Nelson
committed
git add --all
git commit --allow-empty -a -m "${KERNEL_TAG}-${BUILD} patchset"
fi
cd ${DIR}/KERNEL/
make ARCH=arm CROSS_COMPILE=${CC} distclean
make ARCH=arm CROSS_COMPILE=${CC} ${config}
cp -v .config ${DIR}/patches/ref_${config}
cp -v ${DIR}/patches/defconfig .config
cd ${DIR}/
cd ${DIR}/KERNEL/
make ARCH=arm CROSS_COMPILE=${CC} menuconfig
cp -v .config ${DIR}/patches/defconfig
cd ${DIR}/
Robert Nelson
committed
image="zImage"
unset address
#uImage, if you really really want a uImage, zreladdr needs to be defined on the build line going forward...
#image="uImage"
#address="LOADADDR=${ZRELADDR}"
Robert Nelson
committed
cd ${DIR}/KERNEL/
echo "-----------------------------"
Robert Nelson
committed
echo "make -j${CORES} ARCH=arm LOCALVERSION=-${BUILD} CROSS_COMPILE=${CC} ${address} ${image} modules"
echo "-----------------------------"
Robert Nelson
committed
make -j${CORES} ARCH=arm LOCALVERSION=-${BUILD} CROSS_COMPILE=${CC} ${address} ${image} modules
Robert Nelson
committed
cat ${DIR}/KERNEL/arch/arm/Makefile | grep "dtbs:" >/dev/null 2>&1 && DTBS=enable
#FIXME: Starting with v3.15-rc0
unset has_dtbs_install
if [ "x${DTBS}" = "x" ] ; then
cat ${DIR}/KERNEL/arch/arm/Makefile | grep "dtbs dtbs_install:" >/dev/null 2>&1 && DTBS=enable
if [ "x${DTBS}" = "xenable" ] ; then
has_dtbs_install=enable
fi
fi
if [ "x${DTBS}" = "xenable" ] ; then
Robert Nelson
committed
echo "make -j${CORES} ARCH=arm LOCALVERSION=-${BUILD} CROSS_COMPILE=${CC} dtbs"
Robert Nelson
committed
make -j${CORES} ARCH=arm LOCALVERSION=-${BUILD} CROSS_COMPILE=${CC} dtbs
ls arch/arm/boot/* | grep dtb >/dev/null 2>&1 || unset DTBS
Robert Nelson
committed
KERNEL_UTS=$(cat ${DIR}/KERNEL/include/generated/utsrelease.h | awk '{print $3}' | sed 's/\"//g' )
Robert Nelson
committed
if [ -f "${DIR}/deploy/${KERNEL_UTS}.${image}" ] ; then
rm -rf "${DIR}/deploy/${KERNEL_UTS}.${image}" || true
Robert Nelson
committed
rm -rf "${DIR}/deploy/config-${KERNEL_UTS}" || true
Robert Nelson
committed
if [ -f ./arch/arm/boot/${image} ] ; then
Robert Nelson
committed
if [ ${AUTO_TESTER} ] ; then
Robert Nelson
committed
mkdir -p "${DIR}/deploy/beagleboard.org/${KERNEL_UTS}/" || true
cp -uv arch/arm/boot/${image} "${DIR}/deploy/beagleboard.org/${KERNEL_UTS}/${KERNEL_UTS}.${image}"
xz -z "${DIR}/deploy/beagleboard.org/${KERNEL_UTS}/${KERNEL_UTS}.${image}"
mkimage -A arm -O linux -T kernel -C none -a 0x80008000 -e 0x80008000 -n ${KERNEL_UTS} -d arch/arm/boot/zImage "${DIR}/deploy/beagleboard.org/${KERNEL_UTS}/${KERNEL_UTS}.uImage"
xz -z "${DIR}/deploy/beagleboard.org/${KERNEL_UTS}/${KERNEL_UTS}.uImage"
Robert Nelson
committed
cp -uv .config "${DIR}/deploy/beagleboard.org/${KERNEL_UTS}/config-${KERNEL_UTS}"
Robert Nelson
committed
fi
Robert Nelson
committed
cp -v arch/arm/boot/${image} "${DIR}/deploy/${KERNEL_UTS}.${image}"
Robert Nelson
committed
cp -v .config "${DIR}/deploy/config-${KERNEL_UTS}"
Robert Nelson
committed
cd ${DIR}/
Robert Nelson
committed
if [ ! -f "${DIR}/deploy/${KERNEL_UTS}.${image}" ] ; then
export ERROR_MSG="File Generation Failure: [${KERNEL_UTS}.${image}]"
/bin/sh -e "${DIR}/scripts/error.sh" && { exit 1 ; }
else
Robert Nelson
committed
ls -lh "${DIR}/deploy/${KERNEL_UTS}.${image}"
Robert Nelson
committed
}
Robert Nelson
committed
tar_options="--create --gzip --file"
Robert Nelson
committed
if [ "${AUTO_TESTER}" ] ; then
Robert Nelson
committed
#FIXME: xz might not be available everywhere...
#FIXME: ./tools/install_kernel.sh needs update...
deployfile="-${pkg}.tar.xz"
tar_options="--create --xz --file"
fi
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
mkdir -p ${DIR}/deploy/tmp
echo "-----------------------------"
echo "Building ${pkg} archive..."
make -s ARCH=arm CROSS_COMPILE=${CC} modules_install INSTALL_MOD_PATH=${DIR}/deploy/tmp
make -s ARCH=arm CROSS_COMPILE=${CC} firmware_install INSTALL_FW_PATH=${DIR}/deploy/tmp
Robert Nelson
committed
if [ "x${has_dtbs_install}" = "xenable" ] ; then
make -s ARCH=arm LOCALVERSION=-${BUILD} CROSS_COMPILE=${CC} dtbs_install INSTALL_DTBS_PATH=${DIR}/deploy/tmp
else
find ./arch/arm/boot/ -iname "*.dtb" -exec cp -v '{}' ${DIR}/deploy/tmp/ \;
fi
echo "Compressing ${KERNEL_UTS}${deployfile}..."
Robert Nelson
committed
tar ${tar_options} ../${KERNEL_UTS}${deployfile} *
Robert Nelson
committed
if [ ${AUTO_TESTER} ] ; then
Robert Nelson
committed
cp -uv ../${KERNEL_UTS}${deployfile} "${DIR}/deploy/beagleboard.org/${KERNEL_UTS}/"
fi
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 () {
pkg="modules"
make_pkg
}
make_firmware_pkg () {
pkg="firmware"
make_pkg
Robert Nelson
committed
update_latest () {
echo "#!/bin/sh -e" > "${DIR}/deploy/beagleboard.org/latest"
Robert Nelson
committed
echo "abi=aac" >> "${DIR}/deploy/beagleboard.org/latest"
Robert Nelson
committed
echo "kernel=${KERNEL_UTS}" >> "${DIR}/deploy/beagleboard.org/latest"
cp -uv ./tools/test-me.sh "${DIR}/deploy/beagleboard.org/"
}
/bin/sh -e ${DIR}/tools/host_det.sh || { exit 1 ; }
Robert Nelson
committed
cp -v ${DIR}/system.sh.sample ${DIR}/system.sh
Robert Nelson
committed
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
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
unset LINUX_GIT
. ${DIR}/system.sh
/bin/sh -e "${DIR}/scripts/gcc.sh" || { exit 1 ; }
. ${DIR}/.CC
echo "debug: CC=${CC}"
. ${DIR}/version.sh
#unset FULL_REBUILD
FULL_REBUILD=1
if [ "${FULL_REBUILD}" ] ; then
/bin/sh -e "${DIR}/scripts/git.sh" || { exit 1 ; }
if [ "${RUN_BISECT}" ] ; then
/bin/sh -e "${DIR}/scripts/bisect.sh" || { exit 1 ; }
patch_kernel
copy_defconfig
fi
if [ ! ${AUTO_BUILD} ] ; then
make_menuconfig
fi
Robert Nelson
committed
if [ "x${DTBS}" = "xenable" ] ; then
Robert Nelson
committed
if [ "${AUTO_TESTER}" ] ; then
Robert Nelson
committed
update_latest
fi
echo "-----------------------------"
echo "Script Complete"
echo "eewiki.net: [user@localhost:~$ export kernel_version=${KERNEL_UTS}]"