2015-12-02 20:33:32 +01:00
|
|
|
# Copyright (c) 2015 Igor Pecovnik, igor.pecovnik@gma**.com
|
2014-10-13 19:04:03 +02:00
|
|
|
#
|
2015-12-02 20:33:32 +01:00
|
|
|
# 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.
|
2017-08-01 12:51:10 +03:00
|
|
|
|
|
|
|
# This file is a part of the Armbian build script
|
|
|
|
# https://github.com/armbian/build/
|
|
|
|
|
2015-12-02 20:33:32 +01:00
|
|
|
# Main program
|
|
|
|
#
|
2016-09-03 16:42:03 +03:00
|
|
|
|
2017-07-11 12:46:08 +03:00
|
|
|
if [[ $(basename $0) == main.sh ]]; then
|
|
|
|
echo "Please use compile.sh to start the build process"
|
|
|
|
exit -1
|
|
|
|
fi
|
|
|
|
|
2017-07-26 15:50:00 +03:00
|
|
|
# default umask for root is 022 so parent directories won't be group writeable without this
|
|
|
|
# this is used instead of making the chmod in prepare_host() recursive
|
|
|
|
umask 002
|
|
|
|
|
2016-09-03 16:42:03 +03:00
|
|
|
# destination
|
|
|
|
DEST=$SRC/output
|
2015-12-02 20:33:32 +01:00
|
|
|
|
2016-04-16 18:12:34 +03:00
|
|
|
TTY_X=$(($(stty size | awk '{print $2}')-6)) # determine terminal width
|
|
|
|
TTY_Y=$(($(stty size | awk '{print $1}')-6)) # determine terminal height
|
2016-03-27 15:39:08 +02:00
|
|
|
|
2016-04-18 18:21:43 +03:00
|
|
|
# We'll use this title on all menus
|
|
|
|
backtitle="Armbian building script, http://www.armbian.com | Author: Igor Pecovnik"
|
2015-12-12 18:35:38 +03:00
|
|
|
|
2016-04-18 18:21:43 +03:00
|
|
|
# if language not set, set to english
|
|
|
|
[[ -z $LANGUAGE ]] && export LANGUAGE="en_US:en"
|
|
|
|
|
|
|
|
# default console if not set
|
|
|
|
[[ -z $CONSOLE_CHAR ]] && export CONSOLE_CHAR="UTF-8"
|
|
|
|
|
2017-07-09 23:40:41 +03:00
|
|
|
[[ -z $FORCE_CHECKOUT ]] && FORCE_CHECKOUT=yes
|
|
|
|
|
2016-04-18 18:21:43 +03:00
|
|
|
# Load libraries
|
2016-08-09 18:26:22 +03:00
|
|
|
source $SRC/lib/debootstrap-ng.sh # System specific install
|
2017-09-07 12:22:50 +03:00
|
|
|
source $SRC/lib/image-helpers.sh # helpers for OS image building
|
2016-04-18 18:21:43 +03:00
|
|
|
source $SRC/lib/distributions.sh # System specific install
|
|
|
|
source $SRC/lib/desktop.sh # Desktop specific install
|
2017-07-27 17:35:21 +03:00
|
|
|
source $SRC/lib/compilation.sh # Patching and compilation of kernel, uboot, ATF
|
2016-04-18 18:21:43 +03:00
|
|
|
source $SRC/lib/makeboarddeb.sh # Create board support package
|
|
|
|
source $SRC/lib/general.sh # General functions
|
2016-06-19 16:55:03 +03:00
|
|
|
source $SRC/lib/chroot-buildpackages.sh # Building packages in chroot
|
2016-02-10 20:20:54 +01:00
|
|
|
|
2015-12-24 19:37:34 +03:00
|
|
|
# compress and remove old logs
|
2016-01-07 11:47:38 +03:00
|
|
|
mkdir -p $DEST/debug
|
2016-07-05 22:16:15 +03:00
|
|
|
(cd $DEST/debug && tar -czf logs-$(<timestamp).tgz *.log) > /dev/null 2>&1
|
2015-12-24 19:37:34 +03:00
|
|
|
rm -f $DEST/debug/*.log > /dev/null 2>&1
|
2016-07-05 22:16:15 +03:00
|
|
|
date +"%d_%m_%Y-%H_%M_%S" > $DEST/debug/timestamp
|
2016-06-16 14:34:45 +03:00
|
|
|
# delete compressed logs older than 7 days
|
2017-08-06 15:33:15 +03:00
|
|
|
(cd $DEST/debug && find . -name '*.tgz' -mtime +7 -delete) > /dev/null
|
2015-12-24 19:37:34 +03:00
|
|
|
|
2015-12-11 20:49:10 +03:00
|
|
|
# Script parameters handling
|
|
|
|
for i in "$@"; do
|
2016-04-23 19:06:39 +03:00
|
|
|
if [[ $i == *=* ]]; then
|
2015-12-11 20:49:10 +03:00
|
|
|
parameter=${i%%=*}
|
|
|
|
value=${i##*=}
|
2015-12-12 18:35:38 +03:00
|
|
|
display_alert "Command line: setting $parameter to" "${value:-(empty)}" "info"
|
2015-12-11 20:49:10 +03:00
|
|
|
eval $parameter=$value
|
2015-12-09 18:02:04 +03:00
|
|
|
fi
|
2015-12-11 20:49:10 +03:00
|
|
|
done
|
|
|
|
|
2016-01-03 13:51:56 +03:00
|
|
|
if [[ $PROGRESS_DISPLAY == none ]]; then
|
2016-04-23 19:06:39 +03:00
|
|
|
OUTPUT_VERYSILENT=yes
|
2017-07-09 21:25:52 +03:00
|
|
|
elif [[ $PROGRESS_DISPLAY == dialog ]]; then
|
2016-04-23 19:06:39 +03:00
|
|
|
OUTPUT_DIALOG=yes
|
2015-12-11 20:49:10 +03:00
|
|
|
fi
|
2016-01-03 13:51:56 +03:00
|
|
|
if [[ $PROGRESS_LOG_TO_FILE != yes ]]; then unset PROGRESS_LOG_TO_FILE; fi
|
|
|
|
|
2017-06-23 17:58:23 +03:00
|
|
|
SHOW_WARNING=yes
|
|
|
|
|
2016-01-03 13:51:56 +03:00
|
|
|
if [[ $USE_CCACHE != no ]]; then
|
|
|
|
CCACHE=ccache
|
2016-05-04 17:16:39 +03:00
|
|
|
export PATH="/usr/lib/ccache:$PATH"
|
2016-09-25 17:58:48 +03:00
|
|
|
# private ccache directory to avoid permission issues when using build script with "sudo"
|
|
|
|
# see https://ccache.samba.org/manual.html#_sharing_a_cache for alternative solution
|
2017-08-02 18:59:17 +02:00
|
|
|
[[ $PRIVATE_CCACHE == yes ]] && export CCACHE_DIR=$SRC/cache/ccache
|
2016-01-03 13:51:56 +03:00
|
|
|
else
|
|
|
|
CCACHE=""
|
|
|
|
fi
|
2015-12-11 20:49:10 +03:00
|
|
|
|
2016-08-30 19:25:32 +03:00
|
|
|
# Check and install dependencies, directory structure and settings
|
2015-12-12 18:35:38 +03:00
|
|
|
prepare_host
|
2015-12-11 20:49:10 +03:00
|
|
|
|
2017-07-09 21:25:52 +03:00
|
|
|
# if KERNEL_ONLY, KERNEL_CONFIGURE, BOARD, BRANCH or RELEASE are not set, display selection menu
|
2016-12-19 18:14:03 +01:00
|
|
|
|
2016-04-16 18:06:21 +03:00
|
|
|
if [[ -z $KERNEL_ONLY ]]; then
|
2017-07-09 21:25:52 +03:00
|
|
|
options+=("yes" "U-boot and kernel packages")
|
|
|
|
options+=("no" "Full OS image for flashing")
|
2016-12-19 22:12:27 +03:00
|
|
|
KERNEL_ONLY=$(dialog --stdout --title "Choose an option" --backtitle "$backtitle" --no-tags --menu "Select what to build" \
|
2016-12-12 21:45:46 +03:00
|
|
|
$TTY_Y $TTY_X $(($TTY_Y - 8)) "${options[@]}")
|
2016-04-16 18:06:21 +03:00
|
|
|
unset options
|
|
|
|
[[ -z $KERNEL_ONLY ]] && exit_with_error "No option selected"
|
2017-07-09 21:25:52 +03:00
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -z $KERNEL_CONFIGURE ]]; then
|
|
|
|
options+=("no" "Do not change the kernel configuration")
|
|
|
|
options+=("yes" "Show a kernel configuration menu before compilation")
|
|
|
|
KERNEL_CONFIGURE=$(dialog --stdout --title "Choose an option" --backtitle "$backtitle" --no-tags --menu "Select the kernel configuration" \
|
|
|
|
$TTY_Y $TTY_X $(($TTY_Y - 8)) "${options[@]}")
|
|
|
|
unset options
|
|
|
|
[[ -z $KERNEL_CONFIGURE ]] && exit_with_error "No option selected"
|
|
|
|
|
2015-12-11 20:49:10 +03:00
|
|
|
fi
|
2015-12-02 20:33:32 +01:00
|
|
|
|
2016-04-16 18:06:21 +03:00
|
|
|
if [[ -z $BOARD ]]; then
|
2017-06-27 20:36:33 +03:00
|
|
|
WIP_STATE=supported
|
|
|
|
WIP_BUTTON='CSC/WIP/EOS'
|
2017-06-27 20:41:13 +03:00
|
|
|
STATE_DESCRIPTION=' - Officially supported boards'
|
2017-06-18 17:14:15 +03:00
|
|
|
temp_rc=$(mktemp)
|
2016-12-19 22:04:58 +03:00
|
|
|
while true; do
|
|
|
|
options=()
|
2017-06-18 17:14:15 +03:00
|
|
|
if [[ $WIP_STATE == supported ]]; then
|
2017-07-11 12:39:32 +03:00
|
|
|
for board in $SRC/config/boards/*.conf; do
|
2017-06-18 17:14:15 +03:00
|
|
|
options+=("$(basename $board | cut -d'.' -f1)" "$(head -1 $board | cut -d'#' -f2)")
|
|
|
|
done
|
|
|
|
else
|
2017-07-11 12:39:32 +03:00
|
|
|
for board in $SRC/config/boards/*.wip; do
|
2017-06-23 17:58:23 +03:00
|
|
|
options+=("$(basename $board | cut -d'.' -f1)" "\Z1(WIP)\Zn $(head -1 $board | cut -d'#' -f2)")
|
2017-06-18 17:14:15 +03:00
|
|
|
done
|
2017-08-17 14:09:55 +03:00
|
|
|
for board in $SRC/config/boards/*.csc; do
|
|
|
|
options+=("$(basename $board | cut -d'.' -f1)" "\Z1(CSC)\Zn $(head -1 $board | cut -d'#' -f2)")
|
|
|
|
done
|
2017-07-11 12:39:32 +03:00
|
|
|
for board in $SRC/config/boards/*.eos; do
|
2017-06-23 17:58:23 +03:00
|
|
|
options+=("$(basename $board | cut -d'.' -f1)" "\Z1(EOS)\Zn $(head -1 $board | cut -d'#' -f2)")
|
2017-06-18 17:14:15 +03:00
|
|
|
done
|
|
|
|
fi
|
|
|
|
if [[ $WIP_STATE != supported ]]; then
|
|
|
|
cat <<-'EOF' > $temp_rc
|
|
|
|
dialog_color = (RED,WHITE,OFF)
|
|
|
|
screen_color = (WHITE,RED,ON)
|
2017-06-23 17:58:23 +03:00
|
|
|
tag_color = (RED,WHITE,ON)
|
2017-06-18 17:14:15 +03:00
|
|
|
item_selected_color = (WHITE,RED,ON)
|
|
|
|
tag_selected_color = (WHITE,RED,ON)
|
|
|
|
tag_key_selected_color = (WHITE,RED,ON)
|
|
|
|
EOF
|
|
|
|
else
|
|
|
|
echo > $temp_rc
|
|
|
|
fi
|
2017-06-23 17:58:23 +03:00
|
|
|
BOARD=$(DIALOGRC=$temp_rc dialog --stdout --title "Choose a board" --backtitle "$backtitle" --scrollbar --colors \
|
2017-11-27 10:27:05 +03:00
|
|
|
--extra-label "Show $WIP_BUTTON" --extra-button --menu "Select the target board. Displaying:\n$STATE_DESCRIPTION" \
|
2017-06-23 17:58:23 +03:00
|
|
|
$TTY_Y $TTY_X $(($TTY_Y - 8)) "${options[@]}")
|
2016-12-19 22:04:58 +03:00
|
|
|
STATUS=$?
|
|
|
|
if [[ $STATUS == 3 ]]; then
|
|
|
|
if [[ $WIP_STATE == supported ]]; then
|
2017-06-23 17:58:23 +03:00
|
|
|
[[ $SHOW_WARNING == yes ]] && show_developer_warning
|
2017-06-27 20:36:33 +03:00
|
|
|
STATE_DESCRIPTION=' - \Z1(CSC)\Zn - Community Supported Configuration\n - \Z1(WIP)\Zn - Work In Progress\n - \Z1(EOS)\Zn - End Of Support'
|
|
|
|
WIP_STATE=unsupported
|
2016-12-20 12:46:49 +03:00
|
|
|
WIP_BUTTON='supported'
|
2016-12-19 22:04:58 +03:00
|
|
|
else
|
2017-06-27 20:36:33 +03:00
|
|
|
STATE_DESCRIPTION=' - Officially supported boards'
|
|
|
|
WIP_STATE=supported
|
|
|
|
WIP_BUTTON='CSC/WIP/EOS'
|
2016-12-19 22:04:58 +03:00
|
|
|
fi
|
|
|
|
continue
|
|
|
|
elif [[ $STATUS == 0 ]]; then
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
unset options
|
|
|
|
[[ -z $BOARD ]] && exit_with_error "No board selected"
|
2016-04-16 18:06:21 +03:00
|
|
|
done
|
2015-12-11 20:49:10 +03:00
|
|
|
fi
|
2015-12-02 20:33:32 +01:00
|
|
|
|
2017-07-11 12:39:32 +03:00
|
|
|
if [[ -f $SRC/config/boards/${BOARD}.conf ]]; then
|
2017-06-18 17:14:15 +03:00
|
|
|
BOARD_TYPE='conf'
|
2017-07-11 12:39:32 +03:00
|
|
|
elif [[ -f $SRC/config/boards/${BOARD}.csc ]]; then
|
2017-06-27 20:36:33 +03:00
|
|
|
BOARD_TYPE='csc'
|
2017-07-11 12:39:32 +03:00
|
|
|
elif [[ -f $SRC/config/boards/${BOARD}.wip ]]; then
|
2017-06-18 17:14:15 +03:00
|
|
|
BOARD_TYPE='wip'
|
2017-07-11 12:39:32 +03:00
|
|
|
elif [[ -f $SRC/config/boards/${BOARD}.eos ]]; then
|
2017-06-18 17:14:15 +03:00
|
|
|
BOARD_TYPE='eos'
|
2016-12-20 12:46:49 +03:00
|
|
|
fi
|
2015-12-02 20:33:32 +01:00
|
|
|
|
2017-07-11 12:39:32 +03:00
|
|
|
source $SRC/config/boards/${BOARD}.${BOARD_TYPE}
|
2017-11-26 23:04:50 +01:00
|
|
|
LINUXFAMILY="${BOARDFAMILY}"
|
2017-06-18 17:14:15 +03:00
|
|
|
|
2016-04-16 18:06:21 +03:00
|
|
|
[[ -z $KERNEL_TARGET ]] && exit_with_error "Board configuration does not define valid kernel config"
|
2015-12-02 20:33:32 +01:00
|
|
|
|
2016-04-16 18:06:21 +03:00
|
|
|
if [[ -z $BRANCH ]]; then
|
|
|
|
options=()
|
2016-12-12 21:45:46 +03:00
|
|
|
[[ $KERNEL_TARGET == *default* ]] && options+=("default" "Vendor provided / legacy (3.4.x - 4.4.x)")
|
|
|
|
[[ $KERNEL_TARGET == *next* ]] && options+=("next" "Mainline (@kernel.org) (4.x)")
|
2017-06-23 17:58:23 +03:00
|
|
|
[[ $KERNEL_TARGET == *dev* && $EXPERT=yes ]] && options+=("dev" "\Z1Development version (4.x)\Zn")
|
2016-04-16 18:06:21 +03:00
|
|
|
# do not display selection dialog if only one kernel branch is available
|
|
|
|
if [[ "${#options[@]}" == 2 ]]; then
|
2016-04-17 15:12:09 +03:00
|
|
|
BRANCH="${options[0]}"
|
2016-04-16 18:06:21 +03:00
|
|
|
else
|
2017-06-23 17:58:23 +03:00
|
|
|
BRANCH=$(dialog --stdout --title "Choose a kernel" --backtitle "$backtitle" --colors \
|
2016-12-12 21:45:46 +03:00
|
|
|
--menu "Select the target kernel branch\nExact kernel versions depend on selected board" \
|
|
|
|
$TTY_Y $TTY_X $(($TTY_Y - 8)) "${options[@]}")
|
2015-12-02 20:33:32 +01:00
|
|
|
fi
|
2016-04-16 18:06:21 +03:00
|
|
|
unset options
|
|
|
|
[[ -z $BRANCH ]] && exit_with_error "No kernel branch selected"
|
2017-06-23 17:58:23 +03:00
|
|
|
[[ $BRANCH == dev && $SHOW_WARNING == yes ]] && show_developer_warning
|
2016-04-18 15:17:28 +03:00
|
|
|
else
|
|
|
|
[[ $KERNEL_TARGET != *$BRANCH* ]] && exit_with_error "Kernel branch not defined for this board" "$BRANCH"
|
2015-12-11 20:49:10 +03:00
|
|
|
fi
|
|
|
|
|
2016-04-16 18:06:21 +03:00
|
|
|
if [[ $KERNEL_ONLY != yes && -z $RELEASE ]]; then
|
|
|
|
options=()
|
2016-12-12 21:45:46 +03:00
|
|
|
options+=("jessie" "Debian 8 Jessie")
|
2017-11-17 17:41:37 +03:00
|
|
|
options+=("stretch" "Debian 9 Stretch")
|
2016-12-12 21:45:46 +03:00
|
|
|
options+=("xenial" "Ubuntu Xenial 16.04 LTS")
|
|
|
|
RELEASE=$(dialog --stdout --title "Choose a release" --backtitle "$backtitle" --menu "Select the target OS release" \
|
|
|
|
$TTY_Y $TTY_X $(($TTY_Y - 8)) "${options[@]}")
|
2016-04-16 18:06:21 +03:00
|
|
|
unset options
|
|
|
|
[[ -z $RELEASE ]] && exit_with_error "No release selected"
|
2016-08-03 17:14:24 +03:00
|
|
|
fi
|
2016-04-16 18:06:21 +03:00
|
|
|
|
2017-01-12 15:35:48 +03:00
|
|
|
if [[ $KERNEL_ONLY != yes && -z $BUILD_DESKTOP ]]; then
|
2016-04-16 18:06:21 +03:00
|
|
|
options=()
|
2016-12-12 21:45:46 +03:00
|
|
|
options+=("no" "Image with console interface (server)")
|
2016-04-16 18:06:21 +03:00
|
|
|
options+=("yes" "Image with desktop environment")
|
2016-12-12 21:45:46 +03:00
|
|
|
BUILD_DESKTOP=$(dialog --stdout --title "Choose image type" --backtitle "$backtitle" --no-tags --menu "Select the target image type" \
|
|
|
|
$TTY_Y $TTY_X $(($TTY_Y - 8)) "${options[@]}")
|
2016-04-16 18:06:21 +03:00
|
|
|
unset options
|
|
|
|
[[ -z $BUILD_DESKTOP ]] && exit_with_error "No option selected"
|
|
|
|
fi
|
2015-12-11 20:49:10 +03:00
|
|
|
|
2016-04-18 18:21:43 +03:00
|
|
|
source $SRC/lib/configuration.sh
|
2015-12-11 20:49:10 +03:00
|
|
|
|
2017-08-23 19:27:43 +03:00
|
|
|
# optimize build time with 100% CPU usage
|
|
|
|
CPUS=$(grep -c 'processor' /proc/cpuinfo)
|
|
|
|
if [[ $USEALLCORES != no ]]; then
|
|
|
|
CTHREADS="-j$(($CPUS + $CPUS/2))"
|
|
|
|
else
|
|
|
|
CTHREADS="-j1"
|
|
|
|
fi
|
|
|
|
|
2015-12-11 20:49:10 +03:00
|
|
|
start=`date +%s`
|
|
|
|
|
2016-04-16 18:12:34 +03:00
|
|
|
[[ $CLEAN_LEVEL == *sources* ]] && cleaning "sources"
|
2015-12-11 20:49:10 +03:00
|
|
|
|
2016-09-20 18:17:13 +02:00
|
|
|
# ignore updates help on building all images - for internal purposes
|
2016-12-12 21:45:46 +03:00
|
|
|
# fetch_from_repo <url> <dir> <ref> <subdir_flag>
|
2016-09-20 18:17:13 +02:00
|
|
|
if [[ $IGNORE_UPDATES != yes ]]; then
|
|
|
|
display_alert "Downloading sources" "" "info"
|
|
|
|
fetch_from_repo "$BOOTSOURCE" "$BOOTDIR" "$BOOTBRANCH" "yes"
|
|
|
|
fetch_from_repo "$KERNELSOURCE" "$KERNELDIR" "$KERNELBRANCH" "yes"
|
2017-08-06 16:52:24 +03:00
|
|
|
if [[ -n $ATFSOURCE ]]; then
|
|
|
|
fetch_from_repo "$ATFSOURCE" "$ATFDIR" "$ATFBRANCH" "yes"
|
|
|
|
fi
|
|
|
|
fetch_from_repo "https://github.com/linux-sunxi/sunxi-tools" "sunxi-tools" "branch:master"
|
2017-08-16 14:49:18 +03:00
|
|
|
fetch_from_repo "https://github.com/rockchip-linux/rkbin" "rkbin-tools" "branch:master"
|
2017-10-02 12:08:47 +02:00
|
|
|
fetch_from_repo "https://github.com/MarvellEmbeddedProcessors/A3700-utils-marvell" "marvell-tools" "branch:A3700_utils-armada-17.10"
|
2017-10-06 15:36:07 +03:00
|
|
|
fetch_from_repo "https://github.com/armbian/odroidc2-blobs" "odroidc2-blobs" "branch:master"
|
2016-09-20 18:17:13 +02:00
|
|
|
fi
|
2016-08-30 19:25:32 +03:00
|
|
|
|
2017-11-26 18:36:33 +01:00
|
|
|
if [[ $BETA == yes ]]; then
|
|
|
|
IMAGE_TYPE=nightly
|
|
|
|
elif [[ $BETA == no && $BUILD_ALL == yes && -n $GPG_PASS ]]; then
|
|
|
|
IMAGE_TYPE=stable
|
|
|
|
else
|
|
|
|
IMAGE_TYPE=user-built
|
|
|
|
fi
|
|
|
|
|
2016-08-30 19:25:32 +03:00
|
|
|
compile_sunxi_tools
|
2017-08-16 14:49:18 +03:00
|
|
|
install_rkbin_tools
|
2015-12-11 20:49:10 +03:00
|
|
|
|
2017-11-06 12:05:13 +03:00
|
|
|
BOOTSOURCEDIR=$BOOTDIR/${BOOTBRANCH##*:}
|
|
|
|
LINUXSOURCEDIR=$KERNELDIR/${KERNELBRANCH##*:}
|
|
|
|
[[ -n $ATFSOURCE ]] && ATFSOURCEDIR=$ATFDIR/${ATFBRANCH##*:}
|
|
|
|
|
2016-03-14 21:54:03 +03:00
|
|
|
# define package names
|
|
|
|
DEB_BRANCH=${BRANCH//default}
|
2016-04-02 13:40:09 +03:00
|
|
|
# if not empty, append hyphen
|
2016-03-14 21:54:03 +03:00
|
|
|
DEB_BRANCH=${DEB_BRANCH:+${DEB_BRANCH}-}
|
|
|
|
CHOSEN_UBOOT=linux-u-boot-${DEB_BRANCH}${BOARD}
|
|
|
|
CHOSEN_KERNEL=linux-image-${DEB_BRANCH}${LINUXFAMILY}
|
|
|
|
CHOSEN_ROOTFS=linux-${RELEASE}-root-${DEB_BRANCH}${BOARD}
|
2017-10-06 15:43:41 +03:00
|
|
|
CHOSEN_KSRC=linux-source-${BRANCH}-${LINUXFAMILY}
|
2015-12-11 20:49:10 +03:00
|
|
|
|
|
|
|
for option in $(tr ',' ' ' <<< "$CLEAN_LEVEL"); do
|
2016-03-14 21:54:03 +03:00
|
|
|
[[ $option != sources ]] && cleaning "$option"
|
2015-12-11 20:49:10 +03:00
|
|
|
done
|
|
|
|
|
2016-04-18 18:21:43 +03:00
|
|
|
# Compile u-boot if packed .deb does not exist
|
|
|
|
if [[ ! -f $DEST/debs/${CHOSEN_UBOOT}_${REVISION}_${ARCH}.deb ]]; then
|
2017-08-06 16:52:24 +03:00
|
|
|
if [[ -n $ATFSOURCE ]]; then
|
|
|
|
compile_atf
|
|
|
|
fi
|
2016-11-03 20:57:56 +03:00
|
|
|
compile_uboot
|
2016-04-18 18:21:43 +03:00
|
|
|
fi
|
2015-12-19 17:35:43 +03:00
|
|
|
|
2016-04-18 18:21:43 +03:00
|
|
|
# Compile kernel if packed .deb does not exist
|
|
|
|
if [[ ! -f $DEST/debs/${CHOSEN_KERNEL}_${REVISION}_${ARCH}.deb ]]; then
|
2016-11-03 20:57:56 +03:00
|
|
|
compile_kernel
|
2016-04-18 18:21:43 +03:00
|
|
|
fi
|
2015-12-11 20:49:10 +03:00
|
|
|
|
2016-10-24 18:02:58 +03:00
|
|
|
overlayfs_wrapper "cleanup"
|
|
|
|
|
2016-08-30 19:25:32 +03:00
|
|
|
# extract kernel version from .deb package
|
|
|
|
VER=$(dpkg --info $DEST/debs/${CHOSEN_KERNEL}_${REVISION}_${ARCH}.deb | grep Descr | awk '{print $(NF)}')
|
|
|
|
VER="${VER/-$LINUXFAMILY/}"
|
|
|
|
|
2016-12-12 21:45:46 +03:00
|
|
|
# create board support package
|
2017-03-24 18:12:40 +03:00
|
|
|
[[ -n $RELEASE && ! -f $DEST/debs/$RELEASE/${CHOSEN_ROOTFS}_${REVISION}_${ARCH}.deb ]] && create_board_package
|
2015-12-21 18:28:40 +03:00
|
|
|
|
2016-12-12 21:45:46 +03:00
|
|
|
# build additional packages
|
2016-09-03 16:42:03 +03:00
|
|
|
[[ $EXTERNAL_NEW == compile ]] && chroot_build_packages
|
2016-06-19 16:55:03 +03:00
|
|
|
|
2015-12-30 14:31:33 +03:00
|
|
|
if [[ $KERNEL_ONLY != yes ]]; then
|
2016-08-09 18:26:22 +03:00
|
|
|
debootstrap_ng
|
2015-12-30 14:31:33 +03:00
|
|
|
else
|
2016-09-17 18:40:04 +02:00
|
|
|
display_alert "Kernel build done" "@host" "info"
|
2015-12-30 14:31:33 +03:00
|
|
|
display_alert "Target directory" "$DEST/debs/" "info"
|
2016-03-23 20:58:58 +01:00
|
|
|
display_alert "File name" "${CHOSEN_KERNEL}_${REVISION}_${ARCH}.deb" "info"
|
2015-12-11 20:49:10 +03:00
|
|
|
fi
|
|
|
|
|
2017-08-01 15:31:54 +03:00
|
|
|
# hook for function to run after build, i.e. to change owner of $SRC
|
|
|
|
# NOTE: this will run only if there were no errors during build process
|
|
|
|
[[ $(type -t run_after_build) == function ]] && run_after_build || true
|
|
|
|
|
2015-12-11 20:49:10 +03:00
|
|
|
end=`date +%s`
|
2016-04-16 18:12:34 +03:00
|
|
|
runtime=$(((end-start)/60))
|
2017-05-26 15:35:37 +02:00
|
|
|
display_alert "Runtime" "$runtime min" "info"
|