aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/poky-qemu
blob: 111aa15b70e29fbec3a6a884b2ac82eb5599b80a (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
74
75
76
#!/bin/bash

# Handle running Poky images standalone with QEMU
#
# Copyright (C) 2006-2007 OpenedHand Ltd.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.


if [ "x$1" = "x" ]; then
    MYNAME=`basename $0`
    echo "Run as MACHINE=xyz $MYNAME KERNEL ROOTFS [OPTIONS]"
    echo "where:"
    echo "  KERNEL - the kernel image file to use"
    echo "  ROOTFS - the rootfs image file or nfsroot directory to use"
#    echo "  (NFS booting assumed if ROOTFS not specified)"
    echo "  MACHINE=xyz - the machine name (optional, autodetected from KERNEL filename if unspecified)"
    echo "  OPTIONS - extra options to pass to QEMU"
    exit 1
else
    KERNEL=$1
    shift
fi

if [ "x$MACHINE" = "x" ]; then
    MACHINE=`basename $KERNEL | sed -r -e 's#.*-([a-z]+[0-9\-]*)-?[0-9]*..*#\1#'`
fi

if [ "x$1" = "x" ]; then
    FSTYPE="nfs"
    echo "Error: NFS booting without an explicit ROOTFS path is not yet supported"
    exit 1
else
    ROOTFS=$1

    if [ -d "$1" ]; then
        echo "$ROOTFS is a directory, assuming nfsroot"
        FSTYPE="nfs"
    else
        FSTYPE="ext3"
        EXT=${ROOTFS##.*}
        if [[ "x$EXT" == "xext2" || "x$EXT" == "xext3" ||
              "x$EXT" == "xjffs2" ]]; then
            FSTYPE=$EXT
        fi
        echo "Using $FSTYPE as filesytem type for $ROOTFS"
    fi
    shift
fi

# We can't run without a libGL.so
libgl='no'

test -e /usr/lib/libGL.so -a -e /usr/lib/libGLU.so && libgl='yes'
test -e /usr/lib64/libGL.so -a -e /usr/lib64/libGLU.so && libgl='yes'

if [ "$libgl" != 'yes' ]; then
    echo "You need libGL.so and libGLU.so to exist in your library path to run the QEMU emulator.
    Ubuntu package names are: libgl1-mesa-dev and libglu1-mesa-dev."
    exit 1;
fi

INTERNAL_SCRIPT=`which poky-qemu-internal`

. $INTERNAL_SCRIPT