Rework build-all.sh to use board configuration files

This commit is contained in:
zador-blood-stained
2016-04-16 21:42:53 +03:00
parent 694c3936c8
commit 27339983b5
3 changed files with 86 additions and 426 deletions

View File

@@ -6,95 +6,89 @@
# 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
#
IFS=";"
#OLDFAMILY=""
#START=9
#STOP=9
#BUILD_ALL="demo"
declare -a MYARRAY1=('wheezy' '' 'jessie' '' 'trusty' '');
#declare -a MYARRAY1=('wheezy' '' 'jessie' '' 'trusty' '' 'xenial' '');
# This file is a part of tool chain https://github.com/igorpecovnik/li
# Include here to make "display_alert" and "prepare_host" available
source $SRC/lib/general.sh
# Function display and runs compilation with desired parameters
#
# Two parameters: $1 = BOARD $2 = BRANCH $3 = $TARGET
#
distro-list ()
RELEASE_LIST=("trusty" "xenial" "wheezy" "jessie")
create_images_list()
{
k1=0
l1=1
while [[ $k1 -lt ${#MYARRAY1[@]} ]]
do
BUILD_DESKTOP="no"
BOARD=$1
RELEASE=${MYARRAY1[$k1]}
BRANCH=$2
unset IFS array DESKTOP_TARGET LINUXFAMILY LINUXCONFIG LINUXKERNEL LINUXSOURCE KERNELBRANCH \
BOOTLOADER BOOTSOURCE BOOTBRANCH CPUMIN GOVERNOR NEEDS_UBOOT NEEDS_KERNEL BOOTSIZE UBOOT_TOOLCHAIN KERNEL_TOOLCHAIN
source $SRC/lib/configuration.sh
array=(${DESKTOP_TARGET//,/ })
arrax=(${CLI_TARGET//,/ })
# % means all BRANCH / DISTRIBUTION
[[ ${array[0]} == "%" ]] && array[0]=$RELEASE
[[ ${array[1]} == "%" ]] && array[1]=$2
[[ ${arrax[0]} == "%" ]] && arrax[0]=$RELEASE
[[ ${arrax[1]} == "%" ]] && arrax[1]=$2
# we define desktop building in config
if [[ "$RELEASE" == "${array[0]}" && $2 == "${array[1]}" && $3 == "desktop" ]]; then
display_alert "$BOARD desktop" "$RELEASE - $BRANCH - $LINUXFAMILY" "ext"
BUILD_DESKTOP="yes"
fi
if [[ "$RELEASE" == "${arrax[0]}" && $2 == "${arrax[1]}" && $3 == "cli" ]]; then
display_alert "$BOARD CLI" "$RELEASE - $BRANCH - $LINUXFAMILY" "ext"
BUILD_DESKTOP="no"
fi
# demo - for debugging purposes
[[ $BUILD_ALL != "demo" ]] && source $SRC/lib/main.sh
IFS=";"
k1=$[$k1+2]
l1=$[$l1+2]
for board in $SRC/lib/config/boards/*.conf; do
BOARD=$(basename $board | cut -d'.' -f1)
source $SRC/lib/config/boards/$BOARD.conf
if [[ -n $CLI_TARGET ]]; then
build_settings=($(tr ',' ' ' <<< "$CLI_TARGET"))
# release
[[ ${build_settings[0]} == "%" ]] && build_settings[0]="${RELEASE_LIST[@]}"
# kernel
# NOTE: This prevents building images with "dev" kernel - may need another solution for sun8i
[[ ${build_settings[1]} == "%" ]] && build_settings[1]=$(tr ',' ' ' <<< "${KERNEL_TARGET//dev}")
for release in ${build_settings[0]}; do
for kernel in ${build_settings[1]}; do
buildlist+=("$BOARD $kernel $release no")
done
done
fi
if [[ -n $DESKTOP_TARGET ]]; then
build_settings=($(tr ',' ' ' <<< "$DESKTOP_TARGET"))
# release
[[ ${build_settings[0]} == "%" ]] && build_settings[0]="${RELEASE_LIST[@]}"
# kernel
# NOTE: This prevents building images with "dev" kernel - may need another solution for sun8i
[[ ${build_settings[1]} == "%" ]] && build_settings[1]=$(tr ',' ' ' <<< "${KERNEL_TARGET//dev}")
for release in ${build_settings[0]}; do
for kernel in ${build_settings[1]}; do
buildlist+=("$BOARD $kernel $release yes")
done
done
fi
unset CLI_TARGET DESKTOP_TARGET KERNEL_TARGET
done
}
IFS=";"
[[ -z "$START" ]] && START=0
MYARRAY=($(cat $SRC/lib/configuration.sh | awk '/)#enabled/ || /#des/ || /#build/' | sed -e 's/\t\t//' | sed 's/)#enabled//g' \
| sed 's/#description //g' | sed -e 's/\t//' | sed 's/#build //g' | sed ':a;N;$!ba;s/\n/;/g'))
i1=$[0+$START]
j1=$[1+$START]
o1=$[2+$START]
while [[ $i1 -lt ${#MYARRAY[@]} ]]
do
if [[ "${MYARRAY[$o1]}" == "1" || "${MYARRAY[$o1]}" == "3" || "${MYARRAY[$o1]}" == "6" ]]; then
distro-list "${MYARRAY[$i1]}" "default" "cli"
distro-list "${MYARRAY[$i1]}" "default" "desktop"
fi
if [[ "${MYARRAY[$o1]}" == "2" || "${MYARRAY[$o1]}" == "3" || "${MYARRAY[$o1]}" == "5" || "${MYARRAY[$o1]}" == "6" ]]; then
distro-list "${MYARRAY[$i1]}" "next" "cli"
distro-list "${MYARRAY[$i1]}" "next" "desktop"
fi
#if [[ "${MYARRAY[$o1]}" == "4" || "${MYARRAY[$o1]}" == "5" || "${MYARRAY[$o1]}" == "6" ]]; then
# distro-list "${MYARRAY[$i1]}" "dev"
#fi
i1=$[$i1+3];j1=$[$j1+3];o1=$[$o1+3]
#[[ $BUILD_ALL == "demo" ]] && echo $i1
if [[ -n "$STOP" && "$i1" -gt "$STOP" ]]; then exit; fi
create_kernels_list()
{
for board in $SRC/lib/config/boards/*.conf; do
BOARD=$(basename $board | cut -d'.' -f1)
source $SRC/lib/config/boards/$BOARD.conf
if [[ -n $KERNEL_TARGET ]]; then
for kernel in $(tr ',' ' ' <<< $KERNEL_TARGET); do
buildlist+=("$BOARD $kernel")
done
fi
unset KERNEL_TARGET
done
}
buildlist=()
if [[ $KERNEL_ONLY == yes ]]; then
create_kernels_list
printf "%-20s %-10s %-10s %-10s\n" BOARD BRANCH
else
create_images_list
printf "%-20s %-10s %-10s %-10s\n" BOARD BRANCH RELEASE DESKTOP
fi
for line in "${buildlist[@]}"; do
printf "%-20s %-10s %-10s %-10s\n" $line
done
echo -e "\n${#buildlist[@]} total\n"
[[ $BUILD_ALL == demo ]] && exit 0
buildall_start=`date +%s`
for line in "${buildlist[@]}"; do
unset IFS LINUXFAMILY LINUXCONFIG LINUXKERNEL LINUXSOURCE KERNELBRANCH BOOTLOADER BOOTSOURCE BOOTBRANCH \
CPUMIN GOVERNOR NEEDS_UBOOT NEEDS_KERNEL BOOTSIZE UBOOT_TOOLCHAIN KERNEL_TOOLCHAIN
read BOARD BRANCH RELEASE BUILD_DESKTOP <<< $line
display_alert "Building" "Board: $BOARD Kernel:$BRANCH${RELEASE:+ Release: $RELEASE}${BUILD_DESKTOP:+ Desktop: $BUILD_DESKTOP}" "ext"
source $SRC/lib/main.sh
done
buildall_end=`date +%s`
buildall_runtime=$(((buildall_end - buildall_start) / 60))
display_alert "Runtime" "$buildall_runtime min" "info"

View File

@@ -29,7 +29,7 @@ CONSOLE_CHAR="UTF-8"
KERNEL_KEEP_CONFIG="no" # overwrite kernel config before compilation
EXTERNAL="yes" # install extra applications and drivers
FORCE_CHECKOUT="yes" # ignore manual changes to source
BUILD_ALL="no" # cycle through selected boards and make images
BUILD_ALL="no" # cycle through available boards and make images or kernel/u-boot packages
# build script version to use
LIB_TAG="" # empty for latest version,
@@ -37,19 +37,17 @@ LIB_TAG="" # empty for latest version,
# or commit hash
#--------------------------------------------------------------------------------------------------------------------------------
# source is where we start the script
SRC=$(pwd)
# source is where compile.sh is located
SRC=$(dirname $(realpath $0))
# destination
DEST=$(pwd)/output
# sources download
SOURCES=$(pwd)/sources
DEST=$SRC/output
# sources for compilation
SOURCES=$SRC/sources
#--------------------------------------------------------------------------------------------------------------------------------
# To preserve proper librarires updating
#--------------------------------------------------------------------------------------------------------------------------------
if [[ -f main.sh && -d bin ]]; then
if [[ -f $SRC/main.sh && -d $SRC/bin ]]; then
echo -e "[\e[0;31m error \x1B[0m] Copy this file one level up, alter and run again."
exit
fi
@@ -95,7 +93,7 @@ fi
#--------------------------------------------------------------------------------------------------------------------------------
# Do we need to build all images
#--------------------------------------------------------------------------------------------------------------------------------
if [[ $BUILD_ALL == yes ]]; then
if [[ $BUILD_ALL == yes || $BUILD_ALL == demo ]]; then
source $SRC/lib/build-all.sh
else
source $SRC/lib/main.sh
@@ -103,4 +101,4 @@ fi
# If you are committing new version of this file, increment VERSION
# Only integers are supported
# VERSION=15
# VERSION=16

View File

@@ -41,338 +41,6 @@ MISC5="https://github.com/hglm/a10disp/" # Display changer for Allwinner
MISC5_DIR="sunxi-display-changer" # local directory
CACHEDIR=$DEST/cache
# board configurations (obsolete, used only for build-all.sh to determine build targets)
# please edit board templates in config/boards to change configuration
if false; then
case $BOARD in
cubieboard4)#disabled
LINUXFAMILY="sun9i"
BOOTCONFIG="Cubieboard4_defconfig"
CPUMIN="1200000"
CPUMAX="1800000"
GOVERNOR="ondemand"
;;
aw-som-a20)#enabled
#description A20 dual core SoM
#build 0
LINUXFAMILY="sun7i"
BOOTCONFIG="Awsom_defconfig"
MODULES="hci_uart gpio_sunxi rfcomm hidp bonding spi_sun7i"
MODULES_NEXT="bonding"
;;
olinux-som-a13)#enabled
#description A13 single core 512Mb SoM
#build 0
LINUXFAMILY="sun5i"
BOOTCONFIG="A13-OLinuXino_defconfig"
MODULES="gpio_sunxi spi_sunxi"
MODULES_NEXT="bonding"
;;
cubieboard)#enabled
#description A10 single core 1Gb SoC
#build 6
LINUXFAMILY="sun4i"
BOOTCONFIG="Cubieboard_config"
MODULES="hci_uart gpio_sunxi rfcomm hidp sunxi-ir bonding spi_sunxi"
MODULES_NEXT="bonding"
CLI_TARGET="%,%"
DESKTOP_TARGET="jessie,%"
;;
cubieboard2)#enabled
#description A20 dual core 1Gb SoC
#build 6
LINUXFAMILY="sun7i"
BOOTCONFIG="Cubieboard2_config"
MODULES="hci_uart gpio_sunxi rfcomm hidp sunxi-ir bonding spi_sun7i"
MODULES_NEXT="bonding"
CLI_TARGET="%,%"
DESKTOP_TARGET="jessie,%"
;;
cubietruck)#enabled
#description A20 dual core 2Gb SoC Wifi
#build 6
LINUXFAMILY="sun7i"
BOOTCONFIG="Cubietruck_config"
MODULES="hci_uart gpio_sunxi rfcomm hidp sunxi-ir bonding spi_sun7i ap6210"
MODULES_NEXT="brcmfmac rfcomm hidp bonding"
CLI_TARGET="%,%"
DESKTOP_TARGET="jessie,%"
;;
lime-a10)#enabled
#description A10 single core 512Mb SoC
#build 6
LINUXFAMILY="sun4i"
BOOTCONFIG="A10-OLinuXino-Lime_defconfig"
MODULES="hci_uart gpio_sunxi rfcomm hidp bonding spi_sun7i 8021q a20_tp"
MODULES_NEXT="bonding"
CLI_TARGET="%,%"
DESKTOP_TARGET="jessie,%"
;;
lime)#enabled
#description A20 dual core 512Mb SoC
#build 6
LINUXFAMILY="sun7i"
BOOTCONFIG="A20-OLinuXino-Lime_defconfig"
MODULES="hci_uart gpio_sunxi rfcomm hidp bonding spi_sun7i 8021q a20_tp"
MODULES_NEXT="bonding"
CLI_TARGET="%,%"
DESKTOP_TARGET="jessie,%"
;;
lime2)#enabled
#description A20 dual core 1Gb SoC
#build 6
LINUXFAMILY="sun7i"
BOOTCONFIG="A20-OLinuXino-Lime2_defconfig"
MODULES="hci_uart gpio_sunxi rfcomm hidp bonding spi_sun7i 8021q a20_tp"
MODULES_NEXT="bonding"
CLI_TARGET="%,%"
DESKTOP_TARGET="jessie,%"
;;
micro)#enabled
#description A20 dual core 1Gb SoC
#build 6
LINUXFAMILY="sun7i"
BOOTCONFIG="A20-OLinuXino_MICRO_config"
MODULES="hci_uart gpio_sunxi rfcomm hidp bonding spi_sun7i 8021q a20_tp"
MODULES_NEXT="bonding"
CLI_TARGET="%,%"
DESKTOP_TARGET="jessie,%"
;;
pcduino3nano)#enabled
#description A20 dual core 1Gb SoC
#build 6
LINUXFAMILY="sun7i"
BOOTCONFIG="Linksprite_pcDuino3_Nano_defconfig"
MODULES="hci_uart gpio_sunxi rfcomm hidp sunxi-ir bonding spi_sun7i"
MODULES_NEXT="bonding"
CLI_TARGET="%,%"
DESKTOP_TARGET="jessie,%"
;;
bananapim2)#enabled
#description A31 quad core 1Gb SoC Wifi
#build 5
LINUXFAMILY="sun6i"
BOOTCONFIG="Sinovoip_BPI_M2_defconfig"
MODULES="hci_uart gpio_sunxi rfcomm hidp sunxi-ir bonding spi_sun7i 8021q a20_tp"
MODULES_NEXT="brcmfmac bonding"
CLI_TARGET="%,%"
DESKTOP_TARGET="jessie,next"
;;
bananapipro)#enabled
#description A20 dual core 1Gb SoC
#build 6
LINUXFAMILY="sun7i"
BOOTCONFIG="Bananapro_defconfig"
MODULES="hci_uart gpio_sunxi rfcomm hidp sunxi-ir bonding spi_sun7i 8021q a20_tp #ap6211"
MODULES_NEXT="brcmfmac bonding"
CLI_TARGET="%,%"
DESKTOP_TARGET="jessie,%"
;;
lamobo-r1)#enabled
#description A20 dual core 1Gb SoC Switch
#build 6
LINUXFAMILY="sun7i"
BOOTCONFIG="Lamobo_R1_defconfig"
MODULES="hci_uart gpio_sunxi rfcomm hidp sunxi-ir bonding spi_sun7i 8021q"
CLI_TARGET="%,%"
;;
orangepi)#enabled
#description A20 dual core 1Gb SoC Wifi USB hub
#build 6
LINUXFAMILY="sun7i"
BOOTCONFIG="Orangepi_defconfig"
MODULES="hci_uart gpio_sunxi rfcomm hidp sunxi-ir bonding spi_sun7i 8021q a20_tp"
MODULES_NEXT="bonding"
CLI_TARGET="%,%"
DESKTOP_TARGET="jessie,%"
;;
orangepimini)#enabled
#description A20 dual core 1Gb SoC Wifi
#build 0
LINUXFAMILY="sun7i"
BOOTCONFIG="Orangepi_mini_defconfig"
MODULES="hci_uart gpio_sunxi rfcomm hidp sunxi-ir bonding spi_sun7i 8021q a20_tp"
MODULES_NEXT="bonding"
CLI_TARGET="%,%"
DESKTOP_TARGET="jessie,%"
;;
orangepiplus)#enabled
#description H3 quad core (Orange Pi Plus or Plus 2)
#build 6wip
LINUXFAMILY="sun8i"
BOOTCONFIG="orangepi_plus_defconfig"
MODULES="8189es #gpio_sunxi #w1-sunxi #w1-gpio #w1-therm #gc2035"
MODULES_NEXT=""
CPUMIN="480000"
CPUMAX="1296000"
GOVERNOR="interactive"
CLI_TARGET="%,%"
DESKTOP_TARGET="jessie,default"
;;
orangepih3)#enabled
#description H3 quad core (Orange Pi PC/One/2/Lite)
#build 6wip
LINUXFAMILY="sun8i"
BOOTCONFIG="orangepi_h3_defconfig"
MODULES="8189es #gpio_sunxi #w1-sunxi #w1-gpio #w1-therm #gc2035"
MODULES_NEXT=""
CPUMIN="480000"
CPUMAX="1296000"
GOVERNOR="interactive"
CLI_TARGET="%,%"
DESKTOP_TARGET="jessie,default"
;;
bananapim2plus)#enabled
#description H3 quad core 1Gb SoC Wifi
#build 6wip
LINUXFAMILY="sun8i"
BOOTCONFIG="Sinovoip_BPI_M2_plus_defconfig"
MODULES="#gpio_sunxi #w1-sunxi #w1-gpio #w1-therm #ap6211"
MODULES_NEXT="brcmfmac"
CPUMIN="240000"
CPUMAX="1200000"
GOVERNOR="interactive"
CLI_TARGET="%,%"
DESKTOP_TARGET="jessie,default"
;;
cubox-i)#enabled
#description Freescale iMx dual/quad core Wifi
#build 6
LINUXFAMILY="cubox"
BOOTCONFIG="mx6_cubox-i_config"
MODULES="bonding"
MODULES_NEXT="bonding"
SERIALCON="ttymxc0"
CLI_TARGET="%,%"
DESKTOP_TARGET="jessie,%"
;;
udoo)#enabled
#description Freescale iMx dual/quad core Wifi
#build 3
LINUXFAMILY="udoo"
BOOTCONFIG="udoo_qdl_config"
MODULES="bonding"
MODULES_NEXT=""
SERIALCON="ttymxc1"
CLI_TARGET="%,%"
DESKTOP_TARGET="jessie,%"
;;
udoo-neo)#enabled
#description Freescale iMx singe core Wifi
#build 1
#BOOTSIZE="32"
LINUXFAMILY="neo"
BOOTCONFIG="udoo_neo_config"
MODULES="bonding"
MODULES_NEXT=""
SERIALCON="ttymxc0"
CLI_TARGET="%,%"
DESKTOP_TARGET="jessie,default"
;;
guitar)#enabled
#description S500 Lemaker Guitar Action quad core
#build 1
LINUXFAMILY="s500"
OFFSET="16"
BOOTSIZE="16"
BOOTCONFIG="s500_defconfig"
MODULES="ethernet wlan_8723bs"
MODULES_NEXT=""
SERIALCON="ttyS3"
;;
odroidxu4)#enabled
#description Exynos5422 XU3/XU4 octa core
#build 1
LINUXFAMILY="odroidxu4"
BOOTSIZE="16"
OFFSET="2"
BOOTCONFIG="odroid_config"
MODULES="bonding"
MODULES_NEXT=""
SERIALCON="ttySAC2"
CLI_TARGET="%,%"
DESKTOP_TARGET="jessie,default"
;;
odroidc1)#enabled
#description S805 C1 quad core
#build 1
LINUXFAMILY="odroidc1"
BOOTSIZE="32"
BOOTCONFIG="odroidc_config"
MODULES="bonding"
MODULES_NEXT=""
SERIALCON="ttyS0"
CLI_TARGET="jessie,default"
DESKTOP_TARGET="jessie,default"
;;
odroidc2)#enabled
#description S905 C2 quad core
#build 1wip
ARCH="arm64"
CROSS_COMPILE="$CCACHE aarch64-linux-gnu-"
TARGETS="Image"
LINUXFAMILY="odroidc2"
BOOTSIZE="32"
OFFSET="1"
BOOTCONFIG="odroidc2_config"
MODULES="bonding"
MODULES_NEXT=""
CPUMIN="500000"
CPUMAX="2016000"
GOVERNOR="conservative"
SERIALCON="ttyS0"
CLI_TARGET="jessie,default"
DESKTOP_TARGET="jessie,default"
;;
toradex)#disabled
LINUXFAMILY="toradex"
BOOTCONFIG="colibri_imx6_defconfig"
MODULES=""
MODULES_NEXT=""
SERIALCON="ttymxc0"
;;
armada)#enabled
#description Marvell Armada 38x
#build 3
LINUXFAMILY="marvell"
BOOTCONFIG="armada_38x_clearfog_config"
MODULES=""
MODULES_NEXT=""
SERIALCON="ttyS0"
CLI_TARGET="%,%"
;;
esac
fi
# board family configurations
case $LINUXFAMILY in