2015-12-02 20:33:32 +01:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Copyright (c) 2015 Igor Pecovnik, igor.pecovnik@gma**.com
|
|
|
|
#
|
|
|
|
# This file is licensed under the terms of the GNU General Public
|
|
|
|
# License version 2. This program is licensed "as is" without any
|
|
|
|
# warranty of any kind, whether express or implied.
|
|
|
|
#
|
|
|
|
# This file is a part of tool chain https://github.com/igorpecovnik/lib
|
|
|
|
#
|
|
|
|
#--------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
2016-01-09 16:26:45 +03:00
|
|
|
# Read build script documentation
|
|
|
|
# http://www.armbian.com/using-armbian-tools/
|
|
|
|
# for detailed explanation of these parameters
|
2015-12-29 21:26:14 +03:00
|
|
|
|
2015-12-02 20:33:32 +01:00
|
|
|
# method
|
2016-04-19 13:04:53 +03:00
|
|
|
KERNEL_ONLY="" # leave empty to select each time, set to "yes" or "no" to skip dialog prompt
|
2015-12-02 20:33:32 +01:00
|
|
|
KERNEL_CONFIGURE="no" # want to change my default configuration
|
2016-01-09 16:26:45 +03:00
|
|
|
CLEAN_LEVEL="make,debs" # comma-separated list of clean targets: "make" = make clean for selected kernel and u-boot,
|
2016-05-06 13:42:43 +03:00
|
|
|
# "debs" = delete packages in "./output/debs" for current branch and family,
|
2016-03-19 17:38:45 +03:00
|
|
|
# "alldebs" - delete all packages in "./output/debs", "images" = delete "./output/images",
|
2015-12-10 21:21:52 +03:00
|
|
|
# "cache" = delete "./output/cache", "sources" = delete "./sources"
|
2016-03-17 20:16:26 +01:00
|
|
|
# user
|
2015-12-02 20:33:32 +01:00
|
|
|
DEST_LANG="en_US.UTF-8" # sl_SI.UTF-8, en_US.UTF-8
|
|
|
|
CONSOLE_CHAR="UTF-8"
|
|
|
|
|
|
|
|
# advanced
|
|
|
|
KERNEL_KEEP_CONFIG="no" # overwrite kernel config before compilation
|
2016-04-19 13:04:53 +03:00
|
|
|
EXTERNAL="yes" # build and install extra applications and drivers
|
2016-06-13 21:02:39 +02:00
|
|
|
DEBUG_MODE="no" # wait that you make changes to uboot and kernel source and creates patches
|
2016-04-05 11:27:41 +02:00
|
|
|
FORCE_CHECKOUT="yes" # ignore manual changes to source
|
2016-04-19 13:04:53 +03:00
|
|
|
BUILD_ALL="no" # cycle through available boards and make images or kernel/u-boot packages.
|
|
|
|
# set KERNEL_ONLY to "yes" or "no" to build all kernels/all images
|
2016-01-09 16:26:45 +03:00
|
|
|
|
|
|
|
# build script version to use
|
|
|
|
LIB_TAG="" # empty for latest version,
|
|
|
|
# one of listed here: https://github.com/igorpecovnik/lib/tags for stable versions,
|
|
|
|
# or commit hash
|
2015-12-02 20:33:32 +01:00
|
|
|
#--------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
2016-04-16 21:42:53 +03:00
|
|
|
# source is where compile.sh is located
|
2016-04-16 21:12:24 +02:00
|
|
|
SRC=$(pwd)
|
2015-12-02 20:33:32 +01:00
|
|
|
# destination
|
2016-04-16 21:42:53 +03:00
|
|
|
DEST=$SRC/output
|
|
|
|
# sources for compilation
|
|
|
|
SOURCES=$SRC/sources
|
2015-12-02 20:33:32 +01:00
|
|
|
|
|
|
|
#--------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
# To preserve proper librarires updating
|
|
|
|
#--------------------------------------------------------------------------------------------------------------------------------
|
2016-04-16 21:42:53 +03:00
|
|
|
if [[ -f $SRC/main.sh && -d $SRC/bin ]]; then
|
2016-03-17 20:16:26 +01:00
|
|
|
echo -e "[\e[0;31m error \x1B[0m] Copy this file one level up, alter and run again."
|
|
|
|
exit
|
2015-12-02 20:33:32 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
#--------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
# Show warning for those who updated the script
|
|
|
|
#--------------------------------------------------------------------------------------------------------------------------------
|
2015-12-29 21:26:14 +03:00
|
|
|
if [[ -d $DEST/output ]]; then
|
2015-12-02 20:33:32 +01:00
|
|
|
echo -e "[\e[0;35m warn \x1B[0m] Structure has been changed. Remove all files and start in a clean directory. \
|
|
|
|
CTRL-C to exit or any key to continue. Only sources will be doubled ..."
|
|
|
|
read
|
|
|
|
fi
|
|
|
|
|
2015-12-29 21:26:14 +03:00
|
|
|
if [[ $EUID != 0 ]]; then
|
2015-12-07 16:55:53 +03:00
|
|
|
echo -e "[\e[0;35m warn \x1B[0m] This script requires root privileges"
|
|
|
|
sudo "$0" "$@"
|
|
|
|
exit 1
|
|
|
|
fi
|
2015-12-02 20:33:32 +01:00
|
|
|
|
|
|
|
#--------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
# Get updates of the main build libraries
|
|
|
|
#--------------------------------------------------------------------------------------------------------------------------------
|
2016-03-22 21:37:18 +03:00
|
|
|
[[ $(dpkg-query -W -f='${db:Status-Abbrev}\n' git 2>/dev/null) != *ii* ]] && \
|
|
|
|
apt-get -qq -y --no-install-recommends install git
|
|
|
|
|
2015-12-29 21:26:14 +03:00
|
|
|
if [[ ! -d $SRC/lib ]]; then
|
|
|
|
git clone https://github.com/igorpecovnik/lib
|
2015-12-02 20:33:32 +01:00
|
|
|
fi
|
2016-03-22 17:32:53 +03:00
|
|
|
cd $SRC/lib
|
|
|
|
if [[ ! -f $SRC/.ignore_changes ]]; then
|
|
|
|
echo -e "[\e[0;32m o.k. \x1B[0m] This script will try to update"
|
|
|
|
git pull
|
|
|
|
CHANGED_FILES=$(git diff --name-only)
|
|
|
|
if [[ -n $CHANGED_FILES ]]; then
|
|
|
|
echo -e "[\e[0;35m warn \x1B[0m] Can't update [\e[0;33mlib/\x1B[0m] since you made changes to: \e[0;32m\n${CHANGED_FILES}\x1B[0m"
|
|
|
|
echo -e "Press \e[0;33m<Ctrl-C>\x1B[0m to abort compilation, \e[0;33m<Enter>\x1B[0m to ignore and continue"
|
|
|
|
read
|
|
|
|
else
|
|
|
|
git checkout ${LIB_TAG:- master}
|
|
|
|
fi
|
2016-03-19 08:54:56 +01:00
|
|
|
fi
|
2015-12-02 20:33:32 +01:00
|
|
|
#--------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
# Do we need to build all images
|
|
|
|
#--------------------------------------------------------------------------------------------------------------------------------
|
2016-04-16 21:42:53 +03:00
|
|
|
if [[ $BUILD_ALL == yes || $BUILD_ALL == demo ]]; then
|
2015-12-02 20:33:32 +01:00
|
|
|
source $SRC/lib/build-all.sh
|
|
|
|
else
|
|
|
|
source $SRC/lib/main.sh
|
|
|
|
fi
|
2015-12-08 23:27:23 +03:00
|
|
|
|
2015-12-09 00:07:52 +03:00
|
|
|
# If you are committing new version of this file, increment VERSION
|
2015-12-08 23:27:23 +03:00
|
|
|
# Only integers are supported
|
2016-06-13 21:02:39 +02:00
|
|
|
# VERSION=19
|