summaryrefslogtreecommitdiff
path: root/setup
diff options
context:
space:
mode:
authorAlexander Filippov <a.filippov@yadro.com>2019-05-21 15:45:26 +0300
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2019-06-11 23:51:05 +0300
commitd70e7e81bfd44553f425fd828c0231ae3b14b4d5 (patch)
tree4910e682c0a0db234674537c2677bcb11fc28427 /setup
parent7bcc93cfc1bb55f85e3088ff02baaeb4d44d2c62 (diff)
downloadopenbmc-d70e7e81bfd44553f425fd828c0231ae3b14b4d5.tar.xz
setup: Use config name instead layer name
Allows user to pass a config name instead of a layer name. This can be extremely useful for layers, which contain several configs. E.g. to build firmware for swift you can call: ``` . setup swift bitbake obmc-phosphor-image ``` Change-Id: I397a53b0cc135f622e4b3dc712ff93f6a0c10b8a Signed-off-by: Alexander Filippov <a.filippov@yadro.com>
Diffstat (limited to 'setup')
-rwxr-xr-xsetup36
1 files changed, 20 insertions, 16 deletions
diff --git a/setup b/setup
index a1b3cc1826..09329cda11 100755
--- a/setup
+++ b/setup
@@ -24,24 +24,28 @@ fi
machine() {
local target=$1
local build_dir=$2
- local mfg mach realmach
- for mfg in meta-*; do
- for mach in $mfg/meta-*; do
- if [ -d "$mach" -a -d "$mach/conf/machine" ]; then
- realmach=${mach##*meta-}
- # If a target is specified, then check for a match,
- # otherwise just list what we've discovered
- if [ -n "$target" ]; then
- if [ "$realmach" = "$target" ]; then
- echo Machine $target is $mach
- TEMPLATECONF="$mach/conf" source oe-init-build-env $build_dir
- return
- fi
- else
- echo "$realmach"
+ local cfg name tmpl
+ for cfg in meta-*/meta-*/conf/machine/*.conf; do
+ name=${cfg##*/}
+ name=${name%.conf}
+ tmpl=${cfg%/machine/*.conf}
+ # If a target is specified, then check for a match,
+ # otherwise just list what we've discovered
+ if [ -n "$target" ]; then
+ if [ "${name}" = "${target}" ]; then
+ echo "Machine ${target} found in ${tmpl%/conf}"
+ TEMPLATECONF="${tmpl}" source \
+ oe-init-build-env ${build_dir}
+
+ if [ "$(cat conf/templateconf.cfg)" = "${tmpl}" ]; then
+ sed "s/^\(MACHINE\s*[?:]*\s*=\s*\).*$/\1${target}/" \
+ -i conf/local.conf
fi
+ return
fi
- done
+ else
+ echo "${name}"
+ fi
done
[ -n "$target" ] && echo "No such machine!"