Alexander Amelkin | 68a967d | 2018-02-02 12:01:13 +0300 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | if [ "$(basename -- "$0")" = "setup" ]; then |
| 4 | echo The script must be sourced, not executed |
| 5 | exit 1 |
| 6 | fi |
| 7 | |
| 8 | machine() { |
| 9 | local target=$1 |
| 10 | local arch mfg mach realmach |
| 11 | for arch in meta-openbmc-machines/meta-*; do |
| 12 | for mfg in $arch/meta-*; do |
| 13 | for mach in $mfg/meta-*; do |
| 14 | if [ -d "$mach" -a -d "$mach/conf/machine" ]; then |
| 15 | realmach=${mach##*meta-} |
| 16 | # If a target is specified, then check for a match, |
| 17 | # otherwise just list what we've discovered |
| 18 | if [ -n "$target" ]; then |
| 19 | if [ "$realmach" = "$target" ]; then |
| 20 | echo Machine $target is $mach |
| 21 | TEMPLATECONF="$mach/conf" source oe-init-build-env build |
| 22 | return |
| 23 | fi |
| 24 | else |
| 25 | echo "$realmach" |
| 26 | fi |
| 27 | fi |
| 28 | done |
| 29 | done |
| 30 | done |
| 31 | |
| 32 | [ -n "$target" ] && echo "No such machine!" |
| 33 | } |
| 34 | |
| 35 | if [ -z "$1" ]; then |
| 36 | echo Target machine must be specified. Use one of: |
| 37 | echo |
| 38 | echo qemuarm |
| 39 | elif [ "$1" = "qemuarm" ]; then |
| 40 | source openbmc-env |
| 41 | fi |
| 42 | |
| 43 | machine $1 | sort |