mirror of
git://git.yoctoproject.org/poky.git
synced 2025-07-19 21:09:03 +02:00
runqemu: Improve error handling/exit codes
runqemu-internal is sourced so should be returning with an error code in case of errors. runqemu needs to deal with this. This patch fixes up the various error paths so we're consistent and get a sane exit status for runqemu which helps a lot in its use in the qemu runtime testing on the autobuilder. (From OE-Core rev: 22a54741167dd6cc011a1b98787c82cc992158ed) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
a9390e0f9e
commit
7911ec5de9
|
@ -422,3 +422,4 @@ INTERNAL_SCRIPT=`which runqemu-internal`
|
|||
fi
|
||||
|
||||
. $INTERNAL_SCRIPT
|
||||
exit $?
|
||||
|
|
|
@ -184,7 +184,7 @@ if [ "$TAP" = "" ]; then
|
|||
if [ $? -ne 0 ]; then
|
||||
# Re-run standalone to see verbose errors
|
||||
sudo $QEMUIFUP $USERID $GROUPID $OECORE_NATIVE_SYSROOT
|
||||
return
|
||||
return 1
|
||||
fi
|
||||
LOCKFILE="$LOCKDIR/$tap"
|
||||
echo "Acquiring lockfile for $tap..."
|
||||
|
@ -256,20 +256,20 @@ case "$MACHINE" in
|
|||
"spitz") ;;
|
||||
*)
|
||||
echo "Error: Unsupported machine type $MACHINE"
|
||||
return
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ ! -f "$KERNEL" ]; then
|
||||
echo "Error: Kernel image file $KERNEL doesn't exist"
|
||||
cleanup
|
||||
return
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ "$FSTYPE" != "nfs" -a ! -f "$ROOTFS" ]; then
|
||||
echo "Error: Image file $ROOTFS doesn't exist"
|
||||
cleanup
|
||||
return
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ "$FSTYPE" = "nfs" ]; then
|
||||
|
@ -289,7 +289,7 @@ if [ "$FSTYPE" = "nfs" ]; then
|
|||
runqemu-export-rootfs restart $ROOTFS
|
||||
if [ $? != 0 ]; then
|
||||
cleanup
|
||||
return
|
||||
return 1
|
||||
fi
|
||||
NFSRUNNING="true"
|
||||
fi
|
||||
|
@ -312,7 +312,7 @@ if [ "$MACHINE" = "qemuarm" -o "$MACHINE" = "qemuarmv6" -o "$MACHINE" = "qemuarm
|
|||
if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then
|
||||
echo "Error: NFS mount point $ROOTFS doesn't exist"
|
||||
cleanup
|
||||
return
|
||||
return 1
|
||||
fi
|
||||
KERNCMDLINE="root=/dev/nfs nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
|
||||
QEMUOPTIONS="$QEMU_NETWORK_CMD -M versatilepb --no-reboot $QEMU_UI_OPTIONS"
|
||||
|
@ -336,7 +336,7 @@ if [ "$MACHINE" = "qemux86" ]; then
|
|||
if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then
|
||||
echo "Error: NFS mount point $ROOTFS doesn't exist."
|
||||
cleanup
|
||||
return
|
||||
return 1
|
||||
fi
|
||||
KERNCMDLINE="root=/dev/nfs nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
|
||||
QEMUOPTIONS="$QEMU_NETWORK_CMD $QEMU_UI_OPTIONS"
|
||||
|
@ -360,7 +360,7 @@ if [ "$MACHINE" = "qemux86-64" ]; then
|
|||
if [ ! -d "$ROOTFS" ]; then
|
||||
echo "Error: NFS mount point $ROOTFS doesn't exist."
|
||||
cleanup
|
||||
return
|
||||
return 1
|
||||
fi
|
||||
KERNCMDLINE="root=/dev/nfs nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
|
||||
QEMUOPTIONS="$QEMU_NETWORK_CMD $QEMU_UI_OPTIONS"
|
||||
|
@ -401,7 +401,7 @@ if [ "$MACHINE" = "qemumips" -o "$MACHINE" = "qemumipsel" -o "$MACHINE" = "qemum
|
|||
if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then
|
||||
echo "Error: NFS mount point $ROOTFS doesn't exist"
|
||||
cleanup
|
||||
return
|
||||
return 1
|
||||
fi
|
||||
KERNCMDLINE="root=/dev/nfs console=ttyS0 console=tty nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
|
||||
QEMUOPTIONS="$QEMU_NETWORK_CMD -M $MACHINE_SUBTYPE -no-reboot $QEMU_UI_OPTIONS"
|
||||
|
@ -422,7 +422,7 @@ if [ "$MACHINE" = "qemuppc" ]; then
|
|||
if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then
|
||||
echo "Error: NFS mount point $ROOTFS doesn't exist"
|
||||
cleanup
|
||||
return
|
||||
return 1
|
||||
fi
|
||||
KERNCMDLINE="root=/dev/nfs console=ttyS0 console=tty nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
|
||||
QEMUOPTIONS="$QEMU_NETWORK_CMD -cpu $CPU_SUBTYPE -M $MACHINE_SUBTYPE -no-reboot $QEMU_UI_OPTIONS"
|
||||
|
@ -442,7 +442,7 @@ if [ "$MACHINE" = "qemush4" ]; then
|
|||
if [ "$NFS_SERVER" = "192.168.7.1" -a ! -d "$NFS_DIR" ]; then
|
||||
echo "Error: NFS mount point $ROOTFS doesn't exist"
|
||||
cleanup
|
||||
return
|
||||
return 1
|
||||
fi
|
||||
KERNCMDLINE="root=/dev/nfs console=ttySC1 noiotrap earlyprintk=sh-sci.1 console=tty nfsroot=$NFS_SERVER:$NFS_DIR,$UNFS_OPTS rw $KERNEL_NETWORK_CMD mem=$QEMU_MEMORY"
|
||||
QEMUOPTIONS="$QEMU_NETWORK_CMD -M $MACHINE_SUBTYPE -no-reboot $QEMU_UI_OPTIONS -monitor null -serial vc -serial stdio"
|
||||
|
@ -469,7 +469,7 @@ fi
|
|||
if [ "x$QEMUOPTIONS" = "x" ]; then
|
||||
echo "Error: Unable to support this combination of options"
|
||||
cleanup
|
||||
return
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ "x$CROSSPATH" = "x" ]; then
|
||||
|
@ -482,7 +482,7 @@ QEMUBIN=`which $QEMU 2> /dev/null`
|
|||
if [ ! -x "$QEMUBIN" ]; then
|
||||
echo "Error: No QEMU binary '$QEMU' could be found."
|
||||
cleanup
|
||||
return
|
||||
return 1
|
||||
fi
|
||||
|
||||
NEED_GL=`ldd $QEMUBIN/$QEMU 2>&1 | grep libGLU`
|
||||
|
@ -498,7 +498,7 @@ if [ "$NEED_GL" != "" ]; 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.
|
||||
Fedora package names are: mesa-libGL-devel mesa-libGLU-devel."
|
||||
exit 1;
|
||||
return 1;
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -508,7 +508,7 @@ do_quit() {
|
|||
kill `cat $PIDFILE`
|
||||
fi
|
||||
cleanup
|
||||
return
|
||||
return 1
|
||||
}
|
||||
|
||||
DISTCCD=`which distccd 2> /dev/null`
|
||||
|
@ -562,8 +562,10 @@ echo "Running $QEMU..."
|
|||
# -no-reboot is a mandatory option - see bug #100
|
||||
echo $QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT --append '"'$KERNCMDLINE $SCRIPT_KERNEL_OPT'"'
|
||||
LD_PRELOAD="$GL_LD_PRELOAD" $QEMUBIN -kernel $KERNEL $QEMUOPTIONS $SERIALOPTS -no-reboot $SCRIPT_QEMU_OPT $SCRIPT_QEMU_EXTRA_OPT --append "$KERNCMDLINE $SCRIPT_KERNEL_OPT"
|
||||
|
||||
ret=$?
|
||||
|
||||
cleanup
|
||||
|
||||
trap - INT TERM QUIT
|
||||
|
||||
return $ret
|
||||
|
|
Loading…
Reference in New Issue
Block a user