2008-02-22 16:23:33 +00:00
|
|
|
#!/bin/bash
|
2007-05-16 13:48:29 +00:00
|
|
|
|
|
|
|
# Handle running Poky images standalone with QEMU
|
2007-01-16 12:23:08 +00:00
|
|
|
#
|
2007-05-16 13:48:29 +00:00
|
|
|
# Copyright (C) 2006-2007 OpenedHand Ltd.
|
2007-01-16 12:23:08 +00:00
|
|
|
#
|
|
|
|
# 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.
|
2007-05-16 13:48:29 +00:00
|
|
|
|
2007-01-16 12:23:08 +00:00
|
|
|
|
|
|
|
if [ "x$1" = "x" ]; then
|
|
|
|
MYNAME=`basename $0`
|
2010-09-28 23:23:54 +00:00
|
|
|
echo "Run as MACHINE=xyz $MYNAME KERNEL ROOTFS [OPTIONS]"
|
2007-01-16 12:23:08 +00:00
|
|
|
echo "where:"
|
2010-09-28 23:23:54 +00:00
|
|
|
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)"
|
2008-04-24 14:30:55 +00:00
|
|
|
echo " OPTIONS - extra options to pass to QEMU"
|
2007-01-16 12:23:08 +00:00
|
|
|
exit 1
|
|
|
|
else
|
2010-09-28 23:23:54 +00:00
|
|
|
KERNEL=$1
|
2008-04-24 14:30:55 +00:00
|
|
|
shift
|
2007-01-16 12:23:08 +00:00
|
|
|
fi
|
|
|
|
|
2007-01-29 17:03:29 +00:00
|
|
|
if [ "x$MACHINE" = "x" ]; then
|
2010-09-28 23:23:54 +00:00
|
|
|
MACHINE=`basename $KERNEL | sed -r -e 's#.*-([a-z]+[0-9\-]*)-?[0-9]*..*#\1#'`
|
2007-01-29 17:03:29 +00:00
|
|
|
fi
|
|
|
|
|
2008-04-24 14:30:55 +00:00
|
|
|
if [ "x$1" = "x" ]; then
|
2010-09-28 23:23:54 +00:00
|
|
|
FSTYPE="nfs"
|
|
|
|
echo "Error: NFS booting without an explicit ROOTFS path is not yet supported"
|
|
|
|
exit 1
|
2007-01-16 12:23:08 +00:00
|
|
|
else
|
2010-09-28 23:23:54 +00:00
|
|
|
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"
|
2008-04-23 09:58:18 +00:00
|
|
|
fi
|
2008-04-24 14:30:55 +00:00
|
|
|
shift
|
2007-01-16 12:23:08 +00:00
|
|
|
fi
|
|
|
|
|
2010-08-24 15:16:47 +00:00
|
|
|
# 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
|
|
|
|
|
2007-01-16 13:49:34 +00:00
|
|
|
INTERNAL_SCRIPT=`which poky-qemu-internal`
|
2008-01-31 17:42:44 +00:00
|
|
|
|
2007-01-17 15:55:35 +00:00
|
|
|
. $INTERNAL_SCRIPT
|