aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/runqemu
blob: abe15f4c84ac6ac31f1721a5810f3636ee5bb822 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/sh
_script_dir=`dirname $0`
_meta_ivi=`dirname ${_script_dir}`

_check_it=`basename ${_meta_ivi}`
if [ "x${_check_it}" != "xmeta-ivi" ]; then
   echo "this is not script of meta-ivi"
   exit 1
fi
_top_dir=`dirname ${_meta_ivi}`

_build=${_top_dir}/build
_machine='qemux86-64'
_image=`grep bitbake ${_meta_ivi}/README.md | awk '{print $4}'`
while getopts "hm:i:b:" arg; do
  case $arg in
    h)
      echo "usage $0 [option] [runqemu option]" 
      echo "  -h        display this message"
      echo "  -m        set machine"
      echo "  -i        set image name"
      echo "  -b        set build directory"
      exit 0
      ;;
    m)
      _machine=$OPTARG
      ;;
    i)
      _image=${OPTARG}-image
      ;;
    b)
      _build=${_top_dir}/$OPTARG
      ;;
  esac
done
shift $((OPTIND-1))

w_bit=`which bitbake`
if [ "x${w_bit}" == "x" ]; then
   export TEMPLATECONF=${_meta_ivi}/meta-ivi/conf
   _poky=${_top_dir}/poky
   source ${_poky}/oe-init-build-env ${_build}
else
   cd ${_build}
fi

_DIR=tmp/deploy/images/${_machine}
_CONF=${_DIR}/${_image}-${_machine}.qemuboot.conf
_ARG=""
if [ -e ${_CONF} ]; then
   _ARG=${_CONF}
else
   _K=${_DIR}/*-${_machine}.bin
   _I=${_DIR}/${_image}-${_machine}.ext*
   if [ -e ${_K} -a -e ${_I} ]; then
      _k=`\ls ${_DIR}/*-${_machine}.bin`
      _i=`\ls ${_DIR}/${_image}-${_machine}.ext*`
      if [ "${_machine}" == "vexpressa9" ]; then
         _ARG="vexpress-a9 ${_k} ${_i}"
      else
         _ARG="${_machine} ${_k} ${_i}"
      fi
   else
      if [ ! -e ${_K} ]; then
         echo there is no ${_K}
      fi
      if [ ! -e ${_I} ]; then
         echo there is no ${_I}
      fi
      exit 2
   fi
fi
../poky/scripts/runqemu ${_ARG} $*