Add setup script for easy openbmc env setup
Before this commit it was required to specify a long
TEMPLATECONF string before running openbmc-env if one
wanted to build a non-qemu image.
This commit adds a simple setup script that can be
sourced like the following to setup the environment for
any machine (e.g., for palmetto):
. setup palmetto
Change-Id: Id3fa73dca9b8ce9347cf38e41fe8662c03ea84e3
Signed-off-by: Alexander Amelkin <a.amelkin@yadro.com>
diff --git a/setup b/setup
new file mode 100755
index 0000000..5d12425
--- /dev/null
+++ b/setup
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+if [ "$(basename -- "$0")" = "setup" ]; then
+ echo The script must be sourced, not executed
+ exit 1
+fi
+
+machine() {
+ local target=$1
+ local arch mfg mach realmach
+ for arch in meta-openbmc-machines/meta-*; do
+ for mfg in $arch/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
+ return
+ fi
+ else
+ echo "$realmach"
+ fi
+ fi
+ done
+ done
+ done
+
+ [ -n "$target" ] && echo "No such machine!"
+}
+
+if [ -z "$1" ]; then
+ echo Target machine must be specified. Use one of:
+ echo
+ echo qemuarm
+elif [ "$1" = "qemuarm" ]; then
+ source openbmc-env
+fi
+
+machine $1 | sort