From ba3a26199039dd54ba7e654f7801c9af41f8806f Mon Sep 17 00:00:00 2001
From: Norman Stetter <norman.stetter@garz-fricke.com>
Date: Thu, 17 Sep 2020 12:30:46 +0200
Subject: [PATCH] Fix setup-environment bblayers.conf

* The manifests repo is not checked out anymore to sources/base so the
bblayers.conf needs to be copied from the .repo/manifests dir
---
 scripts/setup-environment | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/scripts/setup-environment b/scripts/setup-environment
index 6a77f112..752c36b8 100755
--- a/scripts/setup-environment
+++ b/scripts/setup-environment
@@ -185,7 +185,6 @@ if "$build_dir_setup_enabled"; then
     mv conf/local.conf conf/local.conf.sample
 
     # Generate the local.conf based on the Yocto defaults
-    TEMPLATES=$CWD/sources/base/conf 
     grep -v '^#\|^$' conf/local.conf.sample > conf/local.conf
     echo >> conf/local.conf 
 
@@ -196,7 +195,7 @@ if "$build_dir_setup_enabled"; then
         echo 'BB_GENERATE_MIRROR_TARBALLS = "1"' >> conf/local.conf
         message "Generating mirror tarballs from downloaded repos."
     else
-        echo "DL_DIR ?= \"$BSPDIR/downloads\"" >> conf/local.conf 
+        echo "DL_DIR ?= \"$CWD/downloads\"" >> conf/local.conf
     fi
     # Add G&F typical sstate cache dir as default settings
     if [ -d "$SSTATE_MIRROR" ] && [ -r "$SSTATE_MIRROR" ];then 
@@ -211,8 +210,13 @@ if "$build_dir_setup_enabled"; then
         -e "s,PACKAGE_CLASSES ?=.*,PACKAGE_CLASSES ?= '$PACKAGE_CLASSES',g" \
         -i conf/local.conf
 
-    if [ -d "$TEMPLATES" ]; then
-        cp "$TEMPLATES/*" conf/
+    # Copy bblayers.conf from manifest repo
+    BBLAYERS=$CWD/.repo/manifests/conf/bblayers.conf
+    if [ -f "$BBLAYERS" ]; then
+        cp "$BBLAYERS" conf/
+    else
+      echo "No bblayers.conf file found in the manifests repo!"
+      echo "Bitbake will fall back to the poky default bblayers.conf"
     fi
 
     for s in $HOME/.oe $HOME/.yocto; do
-- 
GitLab