blob: 05a1c38bdbfd942e3046a7ac45038968cfcf210d [file] [log] [blame]
Alexander Amelkin68a967d2018-02-02 12:01:13 +03001#!/bin/sh
Alexander Amelkin363dccc2018-03-05 16:47:05 +03002#
3# Copyright (c) 2018, YADRO
4# Author: Alexander Amelkin <a.amelkin@yadro.com>
5#
6# Licensed under the Apache License, Version 2.0 (the "License");
7# you may not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17#
Alexander Amelkin68a967d2018-02-02 12:01:13 +030018
19if [ "$(basename -- "$0")" = "setup" ]; then
20 echo The script must be sourced, not executed
21 exit 1
22fi
23
24machine() {
25 local target=$1
Dave Cobbley194ff4f2018-08-22 21:40:54 -040026 local mfg mach realmach
27 for mfg in meta-*; do
28 for mach in $mfg/meta-*; do
29 if [ -d "$mach" -a -d "$mach/conf/machine" ]; then
30 realmach=${mach##*meta-}
31 # If a target is specified, then check for a match,
32 # otherwise just list what we've discovered
33 if [ -n "$target" ]; then
34 if [ "$realmach" = "$target" ]; then
35 echo Machine $target is $mach
36 TEMPLATECONF="$mach/conf" source oe-init-build-env build
37 return
Alexander Amelkin68a967d2018-02-02 12:01:13 +030038 fi
Dave Cobbley194ff4f2018-08-22 21:40:54 -040039 else
40 echo "$realmach"
Alexander Amelkin68a967d2018-02-02 12:01:13 +030041 fi
Dave Cobbley194ff4f2018-08-22 21:40:54 -040042 fi
Alexander Amelkin68a967d2018-02-02 12:01:13 +030043 done
44 done
45
46 [ -n "$target" ] && echo "No such machine!"
47}
48
49if [ -z "$1" ]; then
50 echo Target machine must be specified. Use one of:
51 echo
Alexander Amelkin363dccc2018-03-05 16:47:05 +030052 (echo qemuarm; machine) | sort
Alexander Amelkin68a967d2018-02-02 12:01:13 +030053elif [ "$1" = "qemuarm" ]; then
54 source openbmc-env
Alexander Amelkin363dccc2018-03-05 16:47:05 +030055else
56 machine $1
Alexander Amelkin68a967d2018-02-02 12:01:13 +030057fi
58