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
|
|
|
|
KERNEL_ONLY="no" # build only kernel
|
|
|
|
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,
|
2015-12-10 21:21:52 +03:00
|
|
|
# "images" = delete "./output/images", "debs" = delete "./output/debs",
|
|
|
|
# "cache" = delete "./output/cache", "sources" = delete "./sources"
|
2015-12-02 20:33:32 +01:00
|
|
|
# user
|
|
|
|
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
|
|
|
|
EXTERNAL="yes" # compile extra drivers`
|
|
|
|
FORCE_CHECKOUT="yes" # igre manual changes to source
|
|
|
|
BUILD_ALL="no" # cycle through selected boards and make 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
|
|
|
#--------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
# source is where we start the script
|
|
|
|
SRC=$(pwd)
|
|
|
|
|
|
|
|
# destination
|
2015-12-29 21:26:14 +03:00
|
|
|
DEST=$(pwd)/output
|
2015-12-02 20:33:32 +01:00
|
|
|
|
|
|
|
# sources download
|
|
|
|
SOURCES=$(pwd)/sources
|
|
|
|
|
|
|
|
#--------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
# To preserve proper librarires updating
|
|
|
|
#--------------------------------------------------------------------------------------------------------------------------------
|
2015-12-29 21:26:14 +03:00
|
|
|
if [[ -f main.sh && -d bin ]]; then
|
2015-12-02 20:33:32 +01:00
|
|
|
echo -e "[\e[0;31m error \x1B[0m] Copy this file one level up, alter and run again."
|
|
|
|
exit
|
|
|
|
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
|
|
|
|
#--------------------------------------------------------------------------------------------------------------------------------
|
2015-12-14 17:03:41 +03:00
|
|
|
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-01-01 14:42:20 +03:00
|
|
|
cd $SRC/lib; git pull; git checkout ${LIB_TAG:- master}
|
2015-12-02 20:33:32 +01:00
|
|
|
|
|
|
|
#--------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
# Do we need to build all images
|
|
|
|
#--------------------------------------------------------------------------------------------------------------------------------
|
2015-12-29 21:26:14 +03:00
|
|
|
if [[ $BUILD_ALL == yes ]]; 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-02-10 10:19:41 +01:00
|
|
|
# VERSION=9
|