From 9be5fd6f1eac4643d4630de428370dade4cedbc3 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 19 Jun 2020 11:02:21 +0200 Subject: [PATCH] initial commit --- .gitignore | 14 + README.md | 156 +++++++ .../0001-local_conf_outcomment_line_15.patch | 20 + init.sh | 420 ++++++++++++++++++ local.conf.common.inc.sample | 295 ++++++++++++ 5 files changed, 905 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 files/0001-local_conf_outcomment_line_15.patch create mode 100755 init.sh create mode 100644 local.conf.common.inc.sample diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1d2be11 --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +poky-*/ +tmp/ +.directory +OLD +meta-* +update-scripts +build-images +build-neutrino +local.conf.common.inc +dist/* +build* +*.orig +*.log + diff --git a/README.md b/README.md new file mode 100644 index 0000000..2cfee8b --- /dev/null +++ b/README.md @@ -0,0 +1,156 @@ +# Quick start image build # + +## Preparation +NOTE: If you are using the Tuxbox-Builder VM please jump to step 1. The Tuxbox-Builder VM already contains required packages. +For details and download of Tuxbox-Builder VM see: https://sourceforge.net/projects/n4k/files/Tuxbox-Builder + +### Install required packages (Debian 9/10) +```bash +apt-get install -y gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat cpio python python3 python3-pip python3-pexpect xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa pylint3 xterm subversion locales-all libxml2-utils ninja-build default-jre clisp +``` +Also required is sdl. +```bash +apt-get install -y libsdl1.2-dev +``` +For newer image versions with dunfell (3.1) or later use libsdl2-dev instead libsdl1.2-dev +```bash +apt-get install -y libsdl2-dev +``` + +### Recommended additional packages: +```bash +apt-get install -y gitk git-gui meld +``` +NOTE: In case of no configured git, please set your global git user data: +```bash +git config --global user.email "you@example.com" +git config --global user.user "Your Name" +``` + +For usage with other distributions see: + +https://www.yoctoproject.org/docs/3.0.3/brief-yoctoprojectqs/brief-yoctoprojectqs.html + +## 1. Clone init script into a directory of your choice +```bash +$:~ git clone https://github.com/Tuxbox-Project/build.git +``` + +## 2. Change to the generated directory +```bash +$:~ cd build +``` + +## 3. Execute init script +This will clone all required layers and moves some config files into your build directory. +* Parameter 1: Machine type can be h7, hd51, hd60, hd61, osmio4k, osmio4kplus or set 'all' or keep empty '' for all machines. +* Parameter 2: Image version can be 3.0, 3.1, 3.2 or keep empty for latest version (recommended, because of older versions are not really maintained anymore) +```bash +$:~ ./init.sh +``` + +## 4. Switch to poky directory +After sccessfull executed init script you will find a subdirectory like poky-3.x . +Now switch to this directory e.g.: +```bash +$:~ cd poky-3.2 +``` + +## 5. Execute environment script +Please use possible machine type which you selected (see step 3)! Here as example we use hd51. +This creates (if not exists!) the build directory named as hd51 (default name ist build) and sets the build environment. +```bash +$:~ . ./oe-init-build-env hd51 + +### Shell environment set up for builds. ### + +You can now run 'bitbake ' + +Common targets are: + core-image-minimal + core-image-sato + meta-toolchain + meta-ide-support + +You can also run generated qemu images with a command like 'runqemu qemux86' + +Other commonly useful commands are: + - 'devtool' and 'recipetool' handle common recipe tasks + - 'bitbake-layers' handles common layer tasks + - 'oe-pkgdata-util' handles common target package tasks +tuxbox@tuxbox-builder:~/Build/poky-3.0/hd51 +$ . ./oe-init-build-env hd51 +``` +NOTE: If you left the build directory you must retry step 5 for your machine type to recreate the required environment. + +## 6. Build image +After step 5 you are ready to build an image. +```bash +$:~ /build/poky-3.0/$ bitbake neutrino-image +``` +This may take a while. Some warn messages can be ignored and error messages during setscene tasks are no problem but errors during build and package tasks will abort the process. In this case please report or send us your solution to https://forum.tuxbox-neutrino.org/forum/viewforum.php?f=77. Help is very welcome. + +If all done, such a message should appear: +```bash +... +NOTE: Tasks Summary: Attempted 4568 tasks of which 4198 didn't need to be rerun and all succeeded. +... +``` +## That's it ... + +Built images and packages to find under: +``` +~/build/poky-X.X//tmp/deploy +``` +or in the dist directory: +``` +~/build/dist// +``` + +## Update the meta layer repositories +Execution of init script will update the meta layers. Of corse you can update your meta-layer repositories manually. + +Note: Your config files will be untouched. New or adapted config options are not considered. Please check your configuration if required. + + +## Reset configuration +If you want to reset your configs, please rename (delete is not recommended) the conf directory and execute the init script again. + + +## Customize if required +It's recommended to build for first time without any changes on config files to get an impression how the build process is working and see the results. +The possibilities for adjustments are very extensive and not really manageable for beginners. However, the Yoctoproject is very +extensively documented and provides the best source of information. + +The generated local.conf contains only a few lines but contains a line which is linking a common config file and is valid for all images and supported machine types. The origin cloned sample config file ("local.conf.common.inc.sample") should be untouched. This avoids possible conflicts during updating the init script from git repo. After executed init script (step 3), the config sample file was renamed from "local.conf.common.inc.sample" to "local.conf.common.inc" and this file you can feed with your own options which have effect for all images you want to build. +Alternatively you can modify the default "$HOME/Build/poky-X.X//conf/local.conf" with your own requirements or include your own config file. After updated init script, some new or changed options could be added or removed. This case you should consider for your own configuration. + +For local configuration these config files within your build directory are required: +``` +../build/poky-X.X//conf/bblayers.conf +../build/poky-X.X//conf/local.conf +``` + +This is the minimal required setup for bblayers.conf. +NOTE! machine name is not a part of layer name (e.g. hd51) + +```bitbake +# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf +# changes incompatibly +POKY_BBLAYERS_CONF_VERSION = "2" + +BBPATH = "${TOPDIR}" +BBFILES ?= "" + +BBLAYERS ?= " \ + ${HOME}/build/poky-X.X/meta \ + ${HOME}/build/poky-X.X/meta-poky \ + ${HOME}/build/poky-X.X/meta-yocto-bsp \ + ${HOME}/build/poky-X.X/meta-neutrino \ + ${HOME}/build/poky-X.X/poky/meta- \ +" +``` +Further informations about yocto buildsystem you can find here: + +* https://www.yoctoproject.org/docs/latest/brief-yoctoprojectqs/brief-yoctoprojectqs.html +* https://www.yoctoproject.org/docs/current/mega-manual/mega-manual.html diff --git a/files/0001-local_conf_outcomment_line_15.patch b/files/0001-local_conf_outcomment_line_15.patch new file mode 100644 index 0000000..4e7e613 --- /dev/null +++ b/files/0001-local_conf_outcomment_line_15.patch @@ -0,0 +1,20 @@ +From 8fdd5ed51bd31fe1900e7adc3c0db6446593d89d Mon Sep 17 00:00:00 2001 +From: Thilo Graf +Date: Wed, 28 Oct 2020 13:14:34 +0100 +Subject: local.conf: outcomment line 15 + +Avoid clone of complete meta-openembeded. + +diff --git a/conf/layer.conf b/conf/layer.conf +index a5738d96..ac632105 100644 +--- a/conf/layer.conf ++++ b/conf/layer.conf +@@ -12,7 +12,7 @@ BBFILE_PRIORITY_meta-python2 = "7" + # cause compatibility issues with other layers + LAYERVERSION_meta-python2 = "1" + +-LAYERDEPENDS_meta-python2 = "core openembedded-layer" ++#LAYERDEPENDS_meta-python2 = "core openembedded-layer" + + LAYERSERIES_COMPAT_meta-python2 = "gatesgarth" + diff --git a/init.sh b/init.sh new file mode 100755 index 0000000..f70d1b9 --- /dev/null +++ b/init.sh @@ -0,0 +1,420 @@ +#!/bin/bash + +#set -x + +BASEPATH=`pwd` +FILES_DIR=$BASEPATH/files +MACHINES="h7 hd51 hd60 hd61 osmio4k osmio4kplus" +HINT_SYNTAX='Usage '$0' ' +HINT_MACHINES="<$MACHINES all>" +HINT_IMAGE_VERSIONS='<3.2> <3.1> <3.0>' + +LOG_PATH=$BASEPATH/log +mkdir -p $LOG_PATH +LOGFILE_NAME="$0_`date '+%Y%m%d_%H%M%S'`.log" +LOGFILE=$LOG_PATH/$LOGFILE_NAME +TMP_LOGFILE=$LOG_PATH/.tmp.log +touch $LOGFILE + +LOGFILE_LINK=$BASEPATH/$0.log + +rm -f $TMP_LOGFILE +rm -f $LOGFILE_LINK +ln -sf $LOGFILE $LOGFILE_LINK + + +# set passed parameters +if [ "$1" = "" ]; then + MACHINE="all" +else + MACHINE=$1 +fi + +if [ "$2" = "" ]; then + IMAGE_VERSION="3.2" +else + IMAGE_VERSION=$2 +fi + +# check for empty machine +if [ -z "$MACHINE" ]; then + echo -e "\033[31;1mERROR:\tNo machine defined. Possible machines are $HINT_MACHINES. $HINT_SYNTAX ...\033[0m" + exit 1 +fi + +# check for valid machine +if [ "$MACHINE" != "hd51" ] && [ "$MACHINE" != "h7" ] && [ "$MACHINE" != "hd60" ] && [ "$MACHINE" != "hd61" ] && [ "$MACHINE" != "osmio4k" ] && [ "$MACHINE" != "osmio4kplus" ] && [ "$MACHINE" != "all" ]; then + echo -e "\033[31;1mERROR:\tInvalid machine defined. $HINT_SYNTAX. Possible machines are $HINT_MACHINES\033[0m" + exit 1 +fi + +# check for image versions +if [ "$IMAGE_VERSION" != "3.2" ] && [ "$IMAGE_VERSION" != "3.1" ] && [ "$IMAGE_VERSION" != "3.0" ]; then + echo -e "\033[31;1mERROR:\tInvalid image version defined. $HINT_SYNTAX. Possible image versions are $HINT_IMAGE_VERSIONS, keep empty for current version\033[0m" + exit 1 +fi + +echo -e "\033[37;1mNOTE:\tInitialze build environment for image version $IMAGE_VERSION and machine: $MACHINE \033[0m\n" + +function do_exec() { + DEX_ARG1=$1 + DEX_ARG2=$2 + DEX_ARG3=$3 + rm -f $TMP_LOGFILE + if [ "$DEX_ARG3" == "show_output" ]; then + $DEX_ARG1 + else + $DEX_ARG1 > /dev/null 2>> $TMP_LOGFILE + fi +# echo -e "DEX_ARG1 [$DEX_ARG1] DEX_ARG2 [$DEX_ARG2] DEX_ARG3 [$DEX_ARG3]" + if [ $? != 0 ]; then + LOGTEXT=`cat $TMP_LOGFILE` + echo "$LOGTEXT" >> $LOGFILE + if [ "$DEX_ARG2" != "no_exit" ]; then + if [ "$LOGTEXT" != "" ]; then + echo -e "\033[31;1mERROR:\t\033[0m $LOGTEXT" + fi + exit 1 + else + if [ "$LOGTEXT" != "" ]; then + echo -e "\033[37;1mNOTE:\t\033[0m $LOGTEXT" + fi + fi + fi +# if [ $DEX_ARG2 == "no_exit" ]; then +# echo -e "\033[32;1mOK:\033[0m `cat $LOGFILE`" +# fi +} + +POKY_NAME=poky-$IMAGE_VERSION +BUILD_ROOT_DIR=$BASEPATH/$POKY_NAME +GUI_LAYER_NAME=meta-neutrino +BACKUP_SUFFIX=bak + +YOCTO_GIT_URL=https://git.yoctoproject.org/git/poky +TUXBOX_LAYER_GIT_URL=https://github.com/neutrino-hd + +PYTHON2_LAYER_NAME=meta-python2 +PYTHON2_LAYER_GIT_URL=https://git.openembedded.org +PYTHON2_LAYER_DO_UPDATE=1 + +GIT_CLONE='git clone' +GIT_PULL='git pull -r' +GIT_STASH='git stash' +GIT_STASH_POP='git stash pop' + + +# set required branch +YOCTO_BRANCH_NAME="" +if [ "$IMAGE_VERSION" = "3.0" ]; then + YOCTO_BRANCH_NAME=zeus + YOCTO_BRANCH_HASH=d88d62c +elif [ "$IMAGE_VERSION" = "3.1" ]; then + YOCTO_BRANCH_NAME=dunfell + YOCTO_BRANCH_HASH=2181825 +elif [ "$IMAGE_VERSION" = "3.2" ]; then + YOCTO_BRANCH_NAME=gatesgarth + YOCTO_BRANCH_HASH=4e4a302 + PYTHON2_BRANCH_HASH=27d2aeb +fi + +# clone required branch from yocto +if test ! -d $BUILD_ROOT_DIR/.git; then + echo -e "\033[36;1mCLONE POKY:\033[0m\nclone branch $YOCTO_BRANCH_NAME from $YOCTO_GIT_URL into $BUILD_ROOT_DIR..." + do_exec "$GIT_CLONE -b $YOCTO_BRANCH_NAME $YOCTO_GIT_URL $POKY_NAME" ' ' 'show_output' + do_exec "cd $BUILD_ROOT_DIR" + do_exec "git checkout $YOCTO_BRANCH_HASH -b $IMAGE_VERSION" + do_exec "git tag $IMAGE_VERSION" + do_exec "$GIT_PULL origin $YOCTO_BRANCH_NAME" ' ' 'show_output' + echo -e "\033[36;1mdone ...\033[0m\n" +else + do_exec "cd $BUILD_ROOT_DIR" + CURRENT_YOCTO_BRANCH=`git -C $BUILD_ROOT_DIR rev-parse --abbrev-ref HEAD` + + echo -e "\033[36;1mUPDATE poky:\033[0m\nupdate $CURRENT_YOCTO_BRANCH..." + + echo -e "\033[37;1mCHECKOUT:\033[0m\nswitch from $CURRENT_YOCTO_BRANCH to $IMAGE_VERSION..." + do_exec "git checkout $IMAGE_VERSION" + + echo -e "\033[37;1mUPDATE:\033[0m\nupdate $POKY_NAME from (branch $YOCTO_BRANCH_NAME) $YOCTO_GIT_URL ..." + do_exec "$GIT_PULL origin $YOCTO_BRANCH_NAME" ' ' 'show_output' + + echo -e "\033[37;1mCHECKOUT:\033[0m\nswitch back to $YOCTO_BRANCH_NAME ..." + do_exec "git checkout $YOCTO_BRANCH_NAME" + do_exec "$GIT_PULL origin $YOCTO_BRANCH_NAME" ' ' 'show_output' + + echo -e "\033[37;1mCHECKOUT:\033[0m\nswitch back to $IMAGE_VERSION ..." + do_exec "git checkout $IMAGE_VERSION" + + echo -e "\033[36;1mdone ...\033[0m\n" +fi + + +# clone or update required branch from gui meta layer +if test ! -d $BUILD_ROOT_DIR/$GUI_LAYER_NAME/.git; then + echo -e "\033[33;1mCLONE $GUI_LAYER_NAME:\033[0m\nclone $GUI_LAYER_NAME (branch $YOCTO_BRANCH_NAME) from $TUXBOX_LAYER_GIT_URL ..." + do_exec "cd $BUILD_ROOT_DIR" + do_exec "$GIT_CLONE -b $YOCTO_BRANCH_NAME $TUXBOX_LAYER_GIT_URL/$GUI_LAYER_NAME.git $GUI_LAYER_NAME" ' ' 'show_output' + echo -e "\033[33;1mdone ...\033[0m\n" +else + do_exec "cd $BUILD_ROOT_DIR/$GUI_LAYER_NAME" + CURRENT_GUI_LAYER_BRANCH=`git -C $BUILD_ROOT_DIR/$GUI_LAYER_NAME rev-parse --abbrev-ref HEAD` + echo -e "\033[33;1mUPDATE: update $GUI_LAYER_NAME $CURRENT_GUI_LAYER_BRANCH\033[0m" + do_exec "$GIT_STASH" 'no_exit' + + if [ "$CURRENT_GUI_LAYER_BRANCH" != "$YOCTO_BRANCH_NAME" ]; then + echo -e "\033[37;1mCHECKOUT:\033[0m\nswitch from $CURRENT_GUI_LAYER_BRANCH to $YOCTO_BRANCH_NAME..." + do_exec "git checkout $YOCTO_BRANCH_NAME" + fi + + #echo -e "\033[37;1mUPDATE:\033[0m\nupdate $GUI_LAYER_NAME from (branch $YOCTO_BRANCH_NAME) $TUXBOX_LAYER_GIT_URL ..." + do_exec "$GIT_PULL origin $YOCTO_BRANCH_NAME" ' ' 'show_output' + + if [ "$CURRENT_GUI_LAYER_BRANCH" != "$YOCTO_BRANCH_NAME" ]; then + echo -e "\033[37;1mCHECKOUT:\033[0m\nswitch back to $CURRENT_GUI_LAYER_BRANCH ..." + do_exec "git checkout $CURRENT_GUI_LAYER_BRANCH" + echo -e "\033[37;1mREBASE:\033[0m\nrebase branch $YOCTO_BRANCH_NAME into $CURRENT_GUI_LAYER_BRANCH" + do_exec "git rebase $YOCTO_BRANCH_NAME" ' ' 'show_output' + fi + + do_exec "$GIT_STASH_POP" 'no_exit' + echo -e "\033[33;1mdone ...\033[0m\n" +fi + + +# clone or update required branch for python2 from https://git.openembedded.org/meta-python2 +function clone_meta_python2 () { + META_MACHINE_LAYER=meta-$1 + + if [ $PYTHON2_LAYER_DO_UPDATE == "1" ] && [ "$IMAGE_VERSION" != "3.0" ] && [ "$IMAGE_VERSION" != "3.1" ] && test -d $BUILD_ROOT_DIR/$META_MACHINE_LAYER/recipes-multimedia/kodi; then + + $CURRENT_PYTHON_LAYER_BRANCH + + if test ! -d $BUILD_ROOT_DIR/$PYTHON2_LAYER_NAME/.git; then + echo -e "\033[35;1mCLONE $PYTHON2_LAYER_NAME:\033[0m\nclone $PYTHON2_LAYER_NAME (branch $YOCTO_BRANCH_NAME) from $PYTHON2_LAYER_GIT_URL ..." + do_exec "cd $BUILD_ROOT_DIR" + do_exec "$GIT_CLONE -b $YOCTO_BRANCH_NAME $PYTHON2_LAYER_GIT_URL/$PYTHON2_LAYER_NAME $PYTHON2_LAYER_NAME" ' ' 'show_output' + do_exec "git -C $BUILD_ROOT_DIR/$PYTHON2_LAYER_NAME checkout $PYTHON2_BRANCH_HASH -b $IMAGE_VERSION" + do_exec "git -C $BUILD_ROOT_DIR/$PYTHON2_LAYER_NAME am $FILES_DIR/0001-local_conf_outcomment_line_15.patch" ' ' 'show_output' + do_exec "$GIT_PULL origin $YOCTO_BRANCH_NAME" ' ' 'show_output' + echo -e "\033[35;1mdone ...\033[0m\n" + else + do_exec "cd $BUILD_ROOT_DIR/$PYTHON2_LAYER_NAME" + CURRENT_PYTHON_LAYER_BRANCH=`git -C $BUILD_ROOT_DIR/$PYTHON2_LAYER_NAME rev-parse --abbrev-ref HEAD` + echo -e "\033[35;1mUPDATE: update $PYTHON2_LAYER_NAME $CURRENT_PYTHON_LAYER_BRANCH\033[0m" + do_exec "$GIT_STASH" 'no_exit' + + if [ "$CURRENT_PYTHON_LAYER_BRANCH" != "$YOCTO_BRANCH_NAME" ]; then + echo -e "\033[35;1mCHECKOUT:\033[0m\nswitch from $CURRENT_PYTHON_LAYER_BRANCH to $YOCTO_BRANCH_NAME..." + do_exec "git checkout $YOCTO_BRANCH_NAME" + fi + + #echo -e "\033[35;1mUPDATE:\033[0m\nupdate $PYTHON2_LAYER_NAME from (branch $YOCTO_BRANCH_NAME) $PYTHON2_LAYER_GIT_URL ..." + do_exec "$GIT_PULL origin $YOCTO_BRANCH_NAME" ' ' 'show_output' + + if [ "$CURRENT_PYTHON_LAYER_BRANCH" != "$YOCTO_BRANCH_NAME" ]; then + echo -e "\033[35;1mCHECKOUT:\033[0m\nswitch back to $CURRENT_PYTHON_LAYER_BRANCH ..." + do_exec "git checkout $CURRENT_PYTHON_LAYER_BRANCH" + echo -e "\033[35;1mREBASE:\033[0m\nrebase branch $YOCTO_BRANCH_NAME into $CURRENT_PYTHON_LAYER_BRANCH" + do_exec "git rebase $YOCTO_BRANCH_NAME" ' ' 'show_output' + fi + + do_exec "$GIT_STASH_POP" 'no_exit' + echo -e "\033[35;1mdone ...\033[0m\n" + PYTHON2_LAYER_DO_UPDATE=0 + fi + fi +} + +function get_metaname () { + TMP_NAME=$1 + + if [ "$TMP_NAME" == "hd51" ]; then + META_NAME="hd51" + elif [ "$TMP_NAME" == "h7" ]; then + META_NAME="zgemma" + elif [ "$TMP_NAME" == "hd60" ] || [ "$TMP_NAME" == "hd61" ]; then + META_NAME="hisilicon" + elif [ "$TMP_NAME" == "osmio4k" ] || [ "$TMP_NAME" == "osmio4kplus" ]; then + META_NAME="edision" + else + META_NAME=$TMP_NAME + fi + echo "$META_NAME" +} + +# function for clone or update required branch(es) from machine meta layer +function clone_box_layer () { + NAME=`get_metaname $1` + + if [ "$NAME" != "all" ]; then + if test ! -d $BUILD_ROOT_DIR/meta-$NAME/.git; then + echo -e "\033[34;1mCLONE: clone meta-$NAME (branch $YOCTO_BRANCH_NAME) from $TUXBOX_LAYER_GIT_URL ...\033[0m" + do_exec "cd $BUILD_ROOT_DIR" + do_exec "$GIT_CLONE -b $YOCTO_BRANCH_NAME $TUXBOX_LAYER_GIT_URL/meta-$NAME.git" ' ' 'show_output' + echo -e "\033[34;1mdone ...\033[0m\n" + + if test ! -d $BUILD_ROOT_DIR/$PYTHON2_LAYER_NAME; then + clone_meta_python2 $NAME + fi + else + do_exec "cd $BUILD_ROOT_DIR/meta-$NAME" + do_exec "$GIT_STASH" 'no_exit' + + CURRENT_MACHINE_LAYER_BRANCH=`git -C $BUILD_ROOT_DIR/meta-$NAME rev-parse --abbrev-ref HEAD` + if [ "$CURRENT_MACHINE_LAYER_BRANCH" != "$YOCTO_BRANCH_NAME" ]; then + echo -e "\033[37;1mCHECKOUT:\033[0m\nswitch from $CURRENT_MACHINE_LAYER_BRANCH to $YOCTO_BRANCH_NAME..." + do_exec "git checkout $YOCTO_BRANCH_NAME" + fi + + echo -e "\033[34;1mUPDATE: update meta-$NAME (branch $YOCTO_BRANCH_NAME) from $TUXBOX_LAYER_GIT_URL ...\033[0m" + do_exec "$GIT_PULL origin $YOCTO_BRANCH_NAME" ' ' 'show_output' + + if [ "$CURRENT_MACHINE_LAYER_BRANCH" != "$YOCTO_BRANCH_NAME" ]; then + echo -e "\033[37;1mCHECKOUT:\033[0m\nswitch back to $CURRENT_MACHINE_LAYER_BRANCH ..." + do_exec "git checkout $CURRENT_MACHINE_LAYER_BRANCH" + echo -e "\033[37;1mREBASE:\033[0m\nrebase branch $YOCTO_BRANCH_NAME into $CURRENT_MACHINE_LAYER_BRANCH" + do_exec "git rebase $YOCTO_BRANCH_NAME" ' ' 'show_output' + fi + + do_exec "$GIT_STASH_POP" 'no_exit' + echo -e "\033[34;1mdone ...\033[0m\n" + + clone_meta_python2 $NAME + fi + fi +} + +# clone or update meta layers +if [ "$MACHINE" == "all" ]; then + for M in $MACHINES ; do + clone_box_layer $M; + done +else + clone_box_layer $MACHINE; +fi + + +# create included config file from sample file +if test ! -f $BASEPATH/local.conf.common.inc; then + echo -e "\033[37;1mCONFIG:\033[0m\tcreate $BASEPATH/local.conf.common.inc as include file for layer configuration ..." + do_exec "cp -v $BASEPATH/local.conf.common.inc.sample $BASEPATH/local.conf.common.inc" +else + echo -e "\033[37;1mNOTE:\t Local configuration not considered\033[0m" + echo -e "\t##########################################################################################" + echo -e "\t# $BASEPATH/local.conf.common.inc already exists. #" + echo -e "\t# Nothing was changed on this file for your configuration. #" + echo -e "\t# Possible changes at sample configuration will be ignored. #" + echo -e "\t# You should check local configuration and modify your configuration if required. #" + echo -e "\t# \033[37;1m$BASEPATH/local.conf.common.inc\033[0m #" + echo -e "\t##########################################################################################" +fi + + +# function to create configuration for box types +function create_local_config () { + CLC_ARG1=$1 + if [ "$CLC_ARG1" != "all" ]; then + BOX_BUILD_DIR=$BUILD_ROOT_DIR/$CLC_ARG1 + + # generate default config + if test ! -d $BOX_BUILD_DIR/conf; then + echo -e "\033[37;1m\tcreate directory for $CLC_ARG1 environment ...\033[0m" + do_exec "cd $BUILD_ROOT_DIR" + do_exec ". ./oe-init-build-env $CLC_ARG1" + do_exec "cd $BASEPATH" + fi + + # move config files into conf directory + if test -f $BASEPATH/local.conf.common.inc; then + if test ! -f $BOX_BUILD_DIR/conf/local.conf.$BACKUP_SUFFIX; then + echo -e "\tset base configuration for $CLC_ARG1 ... " + do_exec "mv -v $BOX_BUILD_DIR/conf/local.conf $BOX_BUILD_DIR/conf/local.conf.$BACKUP_SUFFIX" + echo 'MACHINE ?= "'$CLC_ARG1'"' > $BOX_BUILD_DIR/conf/local.conf + echo "include $BASEPATH/local.conf.common.inc" >> $BOX_BUILD_DIR/conf/local.conf + fi + else + echo -e "\033[31;1mERROR:\033[0m:\ttemplate $BASEPATH/local.conf.common.inc not found..." + exit 1 + fi + + if test ! -f $BOX_BUILD_DIR/conf/bblayers.conf.$BACKUP_SUFFIX; then + echo -e "\033[37;1m\tset base bblayer configuration for $CLC_ARG1...\033[0m" + do_exec "cp -v $BOX_BUILD_DIR/conf/bblayers.conf $BOX_BUILD_DIR/conf/bblayers.conf.$BACKUP_SUFFIX" + META_MACHINE_LAYER=meta-`get_metaname $CLC_ARG1` + echo 'BBLAYERS += " \ + '$BUILD_ROOT_DIR'/meta-neutrino \ + '$BUILD_ROOT_DIR'/'$META_MACHINE_LAYER' \ + "' >> $BOX_BUILD_DIR/conf/bblayers.conf + if test -d $BUILD_ROOT_DIR/$META_MACHINE_LAYER/recipes-multimedia/kodi; then + echo 'BBLAYERS += " \ + '$BUILD_ROOT_DIR'/'$PYTHON2_LAYER_NAME' \ + "' >> $BOX_BUILD_DIR/conf/bblayers.conf + fi + fi + fi +} + +# function create local dist directory to prepare for web access +function create_dist_tree () { + PAR1=$1 + if [ "$PAR1" != "all" ]; then + + DIST_BASEDIR="$BASEPATH/dist/$IMAGE_VERSION" + DIST_LINK=$DIST_BASEDIR/$PAR1 + DIST_LINK_IMAGES=$DIST_BASEDIR/$PAR1/images + DIST_LINK_IPK=$DIST_BASEDIR/$PAR1/ipk + DIST_LINK_LICENSE=$DIST_BASEDIR/$PAR1/licenses + + if test ! -d "$DIST_LINK"; then + echo -e "\n\033[37;1mcreate directory:\033[0m $DIST_LINK" + do_exec "mkdir -p $DIST_LINK" + fi + + DEPLOY_DIR=$BUILD_ROOT_DIR/$PAR1/tmp/deploy + DEPLOY_DIR_IMAGES=$DEPLOY_DIR/images/$PAR1 + DEPLOY_DIR_IPK=$DEPLOY_DIR/ipk + DEPLOY_DIR_LICENSE=$DEPLOY_DIR/licenses + + if test ! -L "$DIST_LINK_IMAGES"; then + echo -e "\033[37;1mcreate symlink:\033[0m $DIST_LINK_IMAGES" + do_exec "ln -sf $DEPLOY_DIR_IMAGES $DIST_LINK_IMAGES" + fi + + if test ! -L "$DIST_LINK_IPK"; then + echo -e "\033[37;1mcreate symlink:\033[0m $DIST_LINK_IPK" + do_exec "ln -sf $DEPLOY_DIR_IPK $DIST_LINK_IPK" + fi + + if test ! -L "$DIST_LINK_LICENSE"; then + echo -e "\033[37;1mcreate symlink:\033[0m $DIST_LINK_LICENSE" + do_exec "ln -sf $DEPLOY_DIR_LICENSE $DIST_LINK_LICENSE" + fi + fi +} + +# create configuration for machine +if [ "$MACHINE" == "all" ]; then + for M in $MACHINES ; do + create_local_config $M; + create_dist_tree $M; + done +else + create_local_config $MACHINE; + create_dist_tree $MACHINE; +fi + +# check and create distribution directory inside html directory for online update +if test ! -L /var/www/html/dist; then + echo -e "\033[37;1mNOTE:\t Online update usage.\033[0m" + echo -e "\t##########################################################################################" + echo -e "\t# /var/www/html/dist doesn't exists. #" + echo -e "\t# If you want to use online update, please configure your webserver and use dist content #" + echo -e "\t# Super user permissions are required to create symlink... #" + echo -e "\t# An easy way is to create a symlink to dist directory: #" + echo -e "\t# \033[37;1msudo ln -s $BASEPATH/dist /var/www/html/dist\033[0m #" + echo -e "\t########################################################################################## " +fi + +echo -e "\033[32;1mDONE!\033[0m" +exit 0 diff --git a/local.conf.common.inc.sample b/local.conf.common.inc.sample new file mode 100644 index 0000000..c39e6ff --- /dev/null +++ b/local.conf.common.inc.sample @@ -0,0 +1,295 @@ +### Host variables +# +# Determine how many tasks bitbake should run in parallel: +BB_NUMBER_THREADS ?= "8" +# +# Determine how many processes make should run in parallel when running compile tasks: +PARALLEL_MAKE ?= "-j 4" + +DISTRO = "tuxbox" + + +### System variables +# +#DL_DIR ?= "${COREBASE}/yocto-downloads" +DL_DIR = "${HOME}/Downloads" + +### sdk options +# +#SDKMACHINE ?= "i686" +SDKMACHINE = "x86_64" +#SDKIMAGE_FEATURES="dev-pkgs dbg-pkgs src-pkgs " + + +### time zone +# +DEFAULT_TIMEZONE = "Europe/Berlin" + + +### base build and source directory +# +YOCTO_BASEDIR = "${COREBASE}" + + +### Disk Space Monitoring during the build +# +BB_DISKMON_DIRS = "\ + STOPTASKS,${TMPDIR},1G,100K \ + STOPTASKS,${DL_DIR},1G,100K \ + STOPTASKS,${SSTATE_DIR},1G,100K \ + ABORT,${TMPDIR},100M,1K \ + ABORT,${DL_DIR},100M,1K \ + ABORT,${SSTATE_DIR},100M,1K" + + +### Hash Equivalence +# +# Enable support for automatically running a local hash equivalence server and +# instruct bitbake to use a hash equivalence aware signature generator. Hash +# equivalence improves reuse of sstate by detecting when a given sstate +# artifact can be reused as equivalent, even if the current task hash doesn't +# match the one that generated the artifact. +# +# A shared hash equivalent server can be set with ":" format+# +# +BB_HASHSERVE = "auto" +BB_SIGNATURE_HANDLER = "OEEquivHash" + +BB_DANGLINGAPPENDS_WARNONLY = "1" + +### Qemu configuration +# +PACKAGECONFIG_pn-qemu-native = "sdl" + +CONF_VERSION = "1" + + +### Image settings +# Image size: +# possible are "small" or "normal" (normal means the same like empty string) +# +#IMAGESIZE = "normal" +#IMAGESIZE = "small" +# +# Which neutrino source will be used: +# Choose neutrino source. Possible values are "tuxbox", "tango" or "ni" +# Note: Successful build of foreign neutrino source is not guaranteed. +# +FLAVOUR = "tuxbox" +# +# Name of the image, default target name "neutrino-image" +#IMAGE_BASENAME = "neutrino-image" +IMAGE_BASENAME = "${SDK_NAME}" +# +# Image version tags: +# Allow usage of customized version tag within image file name. Default = "1" means: not allowed +# For default result: neutrino-image-hd51-20200926170603_ofgwrite.zip +INHIBIT_EXTENDED_IMAGE_VERSION = "1" +# +# For customized results: +#INHIBIT_EXTENDED_IMAGE_VERSION = "0" +# If INHIBIT_EXTENDED_IMAGE_VERSION = 0 then you can use the following options to create useful version labels for image files. +# +# Modify ${DISTRO_VERSION_NUMBER} for extended or custom version tag with what ever you want. This will be append a tag to the output file names, keep empty for nothing. +# sample result, without any effect: neutrino-image_hd51-20200926170603_usb.zip +#DISTRO_CUSTOM_VERSION = "" +# +# sample result: neutrino-image_hd51-20200926170603_v2020.39_usb.zip +#DISTRO_CUSTOM_VERSION = "2020.39" +# +# sample result with increment: neutrino-image_hd51-20200926170603_v20.0_usb.zip +# Result for next build will be: neutrino-image_hd51-20200926170603_v20.1_usb.zip +#DISTRO_CUSTOM_VERSION = "${IMAGE_YEARLY_TAG}.${IMAGE_BUILD_INCREMENT}" + + +### default image root password +# set initial password for user root. Keep empty for root: +# +ROOTPW = "" + + +### Choose which plugins should be installed +# +PLUGIN_INSTALL += "msgbox tuxcom shellexec input tuxwetter" + + +### Add Image Maintainer here +# +CREATOR = "${USER}" +KBUILD_BUILD_USER = "${CREATOR}" +KBUILD_BUILD_HOST = "blue" + + +### git configuration ... needed for etckeeper +# +GIT_USER = "root" +MAIL = "root@tuxbox-${MACHINE}" + + +### dev keys for neutrino gui +# NOTE: Here you see empty entries! NOT WORKING! +# +# You can also include a file eg. named "local.conf.devkeys.inc" +# and add these lines into your included file: +# include ///local.conf.devkeys.inc +YT_DEV_KEY = "" +TMDB_DEV_KEY = "" +SHOUTCAST_DEV_KEY = "" +OMDB_API_KEY = "" +WEATHER_DEV_KEY = "" + + +### extra build config options for neutrino build +# e.g: to enable the neutrino test menu +#EXTRA_OECONF_append_pn-neutrino-mp = " \ +# --enable-testing \ +#" +#EXTRA_OECONF_append_pn-gdb = "--with-system-gdbinit=/etc/gdbinit" + + +### package feed configuration +# +PACKAGE_CLASSES ?= "package_ipk" +# +### Update feeds +# Web server from which packages and images are updated. Points as default to this host +# URL-template (only local in this config file) +# for usage of these url's you should make a symlink as super user to the image and package directories +# +#UPDATE_SERVER_URL = "http://${KBUILD_BUILD_HOST}" +#UPDATE_SERVER_URL = "http://192.168.1.202" +#UPDATE_SERVER_URL = "http://localhost" +#UPDATE_SERVER_URL = "file:///var/www/html" +UPDATE_SERVER_URL = "https://update.tuxbox-neutrino.org" + +### Package manager configuration +# +#IPK_FEED_SERVER = "file:///media/sda1/service/ipk" +# local feed if Tuxbox-Builder VM is in use +DISTRO_FEED_VERSION = "${DISTRO_VERSION_NUMBER}" +#DISTRO_FEED_VERSION = "3.2" +IPK_FEED_SERVER = "${UPDATE_SERVER_URL}/dist/${DISTRO_FEED_VERSION}/${MACHINE}/ipk" + + +### Image update configuration +# IMAGE_LOCATION = "file:////media/sda1/service/image/flashimage.img" +IMAGE_LOCATION = "${UPDATE_SERVER_URL}/dist/${DISTRO_FEED_VERSION}/${MACHINE}/images" + +# RELEASE_TEXT_LOCATION = "file:///media/sda1/service/image/imageversion" +RELEASE_TEXT_LOCATION_HOST = "${DEPLOY_DIR_IMAGE}/beta.txt" +RELEASE_TEXT_LOCATION = "${UPDATE_SERVER_URL}/dist/${DISTRO_FEED_VERSION}/${MACHINE}/images/beta.txt" +# +# +# Image release state within release text, default = "0" (release), "1" (beta), 2 " (nightly) +# This will be set as suffix within image version file in entry imagedescription +#RELEASE_STATE = "0" +RELEASE_STATE = "1" + + +### Some additional lines for /etc/os-release and .version contents +# +OS_RELEASE_FIELDS_append = " HOME_URL SUPPORT_URL BUG_REPORT_URL BUILD_ID" +HOME_URL = "https://github.com/tuxbox-neutrino" +SUPPORT_URL = "https://wiki.tuxbox-neutrino.org" +BUG_REPORT_URL = "https://forum.tuxbox-neutrino.org" + +### download mirrors +# +PREMIRRORS_prepend = "\ + https://.*/.* https://archiv.tuxbox-neutrino.org/ \n \ + git://.*/.* http://www.yoctoproject.org/sources/ \n \ + ftp://.*/.* http://www.yoctoproject.org/sources/ \n \ + http://.*/.* http://www.yoctoproject.org/sources/ \n \ + https://.*/.* http://www.yoctoproject.org/sources/ \n \ +" + +#see: https://wiki.yoctoproject.org/wiki/How_do_I#Q:_How_do_I_create_my_own_source_download_mirror_.3F +# +SOURCE_MIRROR_URL ?= "https://archiv.tuxbox-neutrino.org" +INHERIT += "own-mirrors" +BB_GENERATE_MIRROR_TARBALLS = "1" +#BB_NO_NETWORK = "1" + +PREMIRRORS_prepend = "\ + file://.*/.* file://${HOME}/Downloads/* \n" + +### Tip: use sstate mirrors +# +# Speed up your complete new package build or after deleted tmp dir or sstate-cache and guard against fetcher failures. +# Official mirrors to find here: http://sstate.yoctoproject.org/ +# Ensure you have a fast internet. After 1st build you can disable this +# SSTATE_MIRRORS += "\ +# file://.* http://sstate.yoctoproject.org/dev/PATH;downloadfilename=PATH \n \ +# file://.* http://sstate.yoctoproject.org/2.7.3/PATH;downloadfilename=PATH \n \ +# file://.* http://sstate.yoctoproject.org/3.0.3/PATH;downloadfilename=PATH \n \ +# file://.* http://sstate.yoctoproject.org/3.1/PATH;downloadfilename=PATH \n \ +# file://.* http://sstate.yoctoproject.org/3.1.1/PATH;downloadfilename=PATH \n \ +# file://.* http://sstate.yoctoproject.org/3.1.2/PATH;downloadfilename=PATH \n \ +# file://.* http://sstate.yoctoproject.org/3.2/PATH;downloadfilename=PATH \n \ +# " +# This is our own stock of sstate cache related of last tuxbox builds. +SSTATE_MIRRORS = "\ + file://.* https://sstate.tuxbox-upload.de/all/sstate-cache/PATH;downloadfilename=PATH \n \ +" + + +### masked recipes +# This will ignore recipes to build. +# NOTE: Some masked targets with related depends could break the build. +# BBMASK += "/meta-neutrino/recipes-qt/qt5" + +# These entries replace default installed entries which are contained in ./meta-neutrino/recipes-images/images/neutrino-image-base.inc. +# You can add more entries with variable IMAGE_INSTALL_append see below... +# +# IMAGE_INSTALL += " \ +# vsftpd \ +# " +# IMAGE_INSTALL = " \ +# autofs \ +# ca-certificates \ +# curl \ +# dosfstools \ +# e2fsprogs \ +# e2fsprogs-resize2fs \ +# findutils \ +# gptfdisk \ +# hdparm \ +# ifupdown \ +# less \ +# libswscale \ +# libusb1 \ +# minidlna \ +# nano \ +# nfs-utils \ +# nfs-utils-client \ +# ntpdate \ +# ofgwrite \ +# openssh \ +# openssl \ +# opkg \ +# pv \ +# rpcbind \ +# rsync \ +# samsunglcd4linux \ +# tar \ +# tzdata \ +# tzdata-europe \ +# udev-extraconf \ +# udpxy \ +# util-linux-blkid \ +# util-linux-mount \ +# util-linux-swaponoff \ +# util-linux-umount \ +# virtual/screengrabber \ +# virtual/neutrino \ +# neutrino-plugins \ +# neutrino-lua-plugins \ +# neutrino-plugin-mediathek \ +# xupnpd \ +# zip \ +# " + +# Put additional packages that should be packaged into your image. Separated with a whitespace. or use IMAGE_INSTALL += ... +# +# IMAGE_INSTALL_append = " gdb-dbg glibc-dbg glibc-thread-db qtwebflix webmin rpm" +# IMAGE_INSTALL_append = " gdb-dbg glibc-dbg glibc-thread-db webmin rpm"