# # generic emulator specific functions # ################################################################ # # Copyright (c) 1995-2014 SUSE Linux Products GmbH # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 or 3 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 (see the file COPYING); if not, write to the # Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA # ################################################################ vm_verify_options_emulator() { if test -f "$BUILD_DIR/emulator/verify-options.sh"; then . "$BUILD_DIR/emulator/verify-options.sh" else VM_SWAP= fi } vm_startup_emulator() { pushd "$BUILD_DIR/emulator" if test -z "$EMULATOR_SCRIPT" ; then EMULATOR_SCRIPT=./emulator.sh elif test "${EMULATOR_SCRIPT:0:1}" != / ; then EMULATOR_SCRIPT="./$EMULATOR_SCRIPT" fi set -- "$EMULATOR_SCRIPT" "$VM_IMAGE" "$VM_SWAP" echo "$@" if ! "$@"; then popd echo "ERROR: The emulator returned with a failure" cleanup_and_exit 3 fi popd test -n "$VM_SWAP" && return # Emulators may not offer to use a second swap space. # So we just mount the filesystem. # WARNING: This is not safe against attacks. mkdir -p $BUILD_ROOT/.build.packages cd $BUILD_ROOT/.build.packages || cleanup_and_exit 1 mkdir -p .mount mount $VM_IMAGE -o loop .mount if test -e .mount/.build.packages ; then cp -a .mount/.build.packages/* . fi exitcode=`cat .mount/.build/_exitcode` umount .mount rmdir .mount cleanup_and_exit "$exitcode" } vm_kill_emulator() { if ! fuser -k -TERM "$VM_IMAGE" ; then echo "could not kill build in $VM_IMAGE" cleanup_and_exit 1 fi } vm_fixup_emulator() { # emulator may not be able to hand over kernel parameters ln -sf /.build/build $BUILD_ROOT/sbin/init } vm_attach_root_emulator() { : } vm_attach_swap_emulator() { : } vm_detach_root_emulator() { : } vm_detach_swap_emulator() { : } vm_cleanup_emulator() { : }