b30e0a66b3d6cdab763cc62e16ec396e246c0451
[AGL/meta-agl.git] / scripts / envsetup.sh
1 #!/bin/bash
2
3 if [ -z $1 ]; then
4         echo -e "Usage: source envsetup.sh <board/device> [build dir]"
5         return 1
6 fi
7
8 MACHINE="$1"
9
10
11 case "$MACHINE" in
12         "porter")
13                 # setup proprietary gfx drivers and multimedia packages
14                 COPY_MM_SCRIPT=meta-renesas/meta-rcar-gen2/scripts/setup_mm_packages.sh
15                 if [ -f $COPY_MM_SCRIPT ]; then
16                         . $COPY_MM_SCRIPT
17                         copy_mm_packages $1
18                         if [ $? -ne 0 ]; then
19                                 echo "Copying gfx drivers and multimedia packages for '$1' failed."
20                                 return 1
21                         fi
22                 fi
23
24                 if [ ! -d "$TEMPLATECONF" ]; then
25                     # set template conf for R-Car2 M2 Porter board
26                     TEMPLATECONF="$PWD/meta-renesas/meta-rcar-gen2/conf"
27                 fi
28                 ;;
29         "porter-nogfx")
30                 MACHINE="porter"
31                 if [ ! -d "$TEMPLATECONF" ]; then
32                     # set template conf for R-Car2 M2 Porter board
33                     TEMPLATECONF="$PWD/meta-renesas/meta-rcar-gen2/conf"
34                 fi
35                 ;;
36         "intel-corei7-64")
37                 ;;
38         "minnowboard")
39                 # alias for minnowboardmax
40                 MACHINE="intel-corei7-64"
41                 ;;
42         "qemux86")
43                 ;;
44         "qemux86-64")
45                 ;;
46         "wandboard")
47                 ;;
48         *)
49                 # nothing to do here
50                 echo "WARN: '$MACHINE' is not tested by AGL Distro"
51                 ;;
52 esac
53
54 # set template conf for each <board/device>
55 if [ -z "$TEMPLATECONF" ]; then
56     if [ -d "$PWD/meta-agl-demo/templates/$MACHINE/conf" ]; then
57         TEMPLATECONF="$PWD/meta-agl-demo/templates/$MACHINE/conf"
58     fi
59 fi
60
61 echo "envsetup: Set '$1 as MACHINE."
62 export MACHINE
63
64 # fallback
65 if [ ! -d "$TEMPLATECONF" ]; then
66    # Allow to use templates at meta-agl-demo/conf
67    TEMPLATECONF="$PWD/meta-agl-demo/conf"
68 fi
69
70 echo "envsetup: Using templates for local.conf & bblayers.conf from :"
71 echo "          '$TEMPLATECONF'"
72 export TEMPLATECONF
73
74 if [ -n "$2" ]; then
75   BUILD_DIR="$2"
76 else
77   BUILD_DIR=build
78 fi
79
80 if [ -n "$DL_DIR" ]; then
81         BB_ENV_EXTRAWHITE="$BB_ENV_EXTRAWHITE DL_DIR"
82 fi
83
84 if [ -n "$SSTATE_DIR" ]; then
85         BB_ENV_EXTRAWHITE="$BB_ENV_EXTRAWHITE SSTATE_DIR"
86 fi
87
88 export BB_ENV_EXTRAWHITE
89
90 echo "envsetup: Setup build environment for poky/oe."
91 echo -e
92
93 source poky/oe-init-build-env $BUILD_DIR
94
95 unset TEMPLATECONF