Alexander Amelkin | 68a967d | 2018-02-02 12:01:13 +0300 | [diff] [blame] | 1 | #!/bin/sh |
Alexander Amelkin | 363dccc | 2018-03-05 16:47:05 +0300 | [diff] [blame] | 2 | # |
| 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 Amelkin | 68a967d | 2018-02-02 12:01:13 +0300 | [diff] [blame] | 18 | |
| 19 | if [ "$(basename -- "$0")" = "setup" ]; then |
| 20 | echo The script must be sourced, not executed |
| 21 | exit 1 |
| 22 | fi |
| 23 | |
| 24 | machine() { |
| 25 | local target=$1 |
Amithash Prasad | 80d844b | 2018-09-26 17:39:24 -0700 | [diff] [blame^] | 26 | local build_dir=$2 |
Dave Cobbley | 194ff4f | 2018-08-22 21:40:54 -0400 | [diff] [blame] | 27 | local mfg mach realmach |
| 28 | for mfg in meta-*; do |
| 29 | for mach in $mfg/meta-*; do |
| 30 | if [ -d "$mach" -a -d "$mach/conf/machine" ]; then |
| 31 | realmach=${mach##*meta-} |
| 32 | # If a target is specified, then check for a match, |
| 33 | # otherwise just list what we've discovered |
| 34 | if [ -n "$target" ]; then |
| 35 | if [ "$realmach" = "$target" ]; then |
| 36 | echo Machine $target is $mach |
Amithash Prasad | 80d844b | 2018-09-26 17:39:24 -0700 | [diff] [blame^] | 37 | TEMPLATECONF="$mach/conf" source oe-init-build-env $build_dir |
Dave Cobbley | 194ff4f | 2018-08-22 21:40:54 -0400 | [diff] [blame] | 38 | return |
Alexander Amelkin | 68a967d | 2018-02-02 12:01:13 +0300 | [diff] [blame] | 39 | fi |
Dave Cobbley | 194ff4f | 2018-08-22 21:40:54 -0400 | [diff] [blame] | 40 | else |
| 41 | echo "$realmach" |
Alexander Amelkin | 68a967d | 2018-02-02 12:01:13 +0300 | [diff] [blame] | 42 | fi |
Dave Cobbley | 194ff4f | 2018-08-22 21:40:54 -0400 | [diff] [blame] | 43 | fi |
Alexander Amelkin | 68a967d | 2018-02-02 12:01:13 +0300 | [diff] [blame] | 44 | done |
| 45 | done |
| 46 | |
| 47 | [ -n "$target" ] && echo "No such machine!" |
| 48 | } |
| 49 | |
| 50 | if [ -z "$1" ]; then |
| 51 | echo Target machine must be specified. Use one of: |
| 52 | echo |
Alexander Amelkin | 363dccc | 2018-03-05 16:47:05 +0300 | [diff] [blame] | 53 | (echo qemuarm; machine) | sort |
Alexander Amelkin | 68a967d | 2018-02-02 12:01:13 +0300 | [diff] [blame] | 54 | elif [ "$1" = "qemuarm" ]; then |
| 55 | source openbmc-env |
Alexander Amelkin | 363dccc | 2018-03-05 16:47:05 +0300 | [diff] [blame] | 56 | else |
Amithash Prasad | 80d844b | 2018-09-26 17:39:24 -0700 | [diff] [blame^] | 57 | bld_dir=$2 |
| 58 | if [ -z "$2" ]; then |
| 59 | bld_dir="build" |
| 60 | fi |
| 61 | machine $1 $bld_dir |
Alexander Amelkin | 68a967d | 2018-02-02 12:01:13 +0300 | [diff] [blame] | 62 | fi |
| 63 | |