Provide template configuration for each machine or board
[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 # set template conf for each <board/device>
11 if [ -z "$TEMPLATECONF" ]; then
12     TEMPLATECONF="$PWD/meta-agl-demo/templates/$MACHINE/conf"
13 fi
14
15 case "$MACHINE" in
16         "porter")
17                 # setup proprietary gfx drivers and multimedia packages
18                 COPY_MM_SCRIPT=meta-renesas/meta-rcar-gen2/scripts/setup_mm_packages.sh
19                 if [ -f $COPY_MM_SCRIPT ]; then
20                         . $COPY_MM_SCRIPT
21                         copy_mm_packages $1
22                         if [ $? -ne 0 ]; then
23                                 echo "Copying gfx drivers and multimedia packages for '$1' failed."
24                                 return 1
25                         fi
26                 fi
27
28                 if [ ! -d "$TEMPLATECONF" ]; then
29                     # set template conf for R-Car2 M2 Porter board
30                     TEMPLATECONF="$PWD/meta-renesas/meta-rcar-gen2/conf"
31                 fi
32                 ;;
33         "intel-corei7-64")
34                 ;;
35         "qemux86")
36                 ;;
37         "qemux86-64")
38                 ;;
39         *)
40                 # nothing to do here
41                 echo "WARN: '$MACHINE' is not tested by AGL Distro"
42                 ;;
43 esac
44
45 echo "envsetup: Set '$1 as MACHINE."
46 export MACHINE
47
48 if [ ! -d "$TEMPLATECONF" ]; then
49    # Allow to use templates at meta-agl-demo/conf
50    TEMPLATECONF="$PWD/meta-agl-demo/conf"
51 fi
52
53 echo "envsetup: Using templates for local.conf & bblayers.conf from :"
54 echo "          '$TEMPLATECONF'"
55 export TEMPLATECONF
56
57 if [ -n "$2" ]; then
58   BUILD_DIR="$2"
59 else
60   BUILD_DIR=build
61 fi
62
63 echo "envsetup: Setup build environment for poky/oe."
64 echo -e
65
66 source poky/oe-init-build-env $BUILD_DIR
67
68 if [ -n "$DL_DIR" ]; then
69         BB_ENV_EXTRAWHITE="$BB_ENV_EXTRAWHITE DL_DIR"
70 fi
71
72 if [ -n "$SSTATE_DIR" ]; then
73         BB_ENV_EXTRAWHITE="$BB_ENV_EXTRAWHITE SSTATE_DIR"
74 fi
75
76 export BB_ENV_EXTRAWHITE
77