summaryrefslogtreecommitdiff
path: root/init_buildsystem
diff options
context:
space:
mode:
authorZhang Qiang <qiang.z.zhang@intel.com>2013-11-22 15:16:37 +0800
committerZhang Qiang <qiang.z.zhang@intel.com>2014-04-03 15:53:09 +0800
commit679670f9ccac1deaf3e8aa1a0d29aeb142570182 (patch)
treebc821486801ad15b008e179e698df69b8fff4734 /init_buildsystem
parent41cf422473435745622e2b1289d0be26a46d5d2e (diff)
downloadbuild-679670f9ccac1deaf3e8aa1a0d29aeb142570182.tar.gz
build-679670f9ccac1deaf3e8aa1a0d29aeb142570182.tar.bz2
build-679670f9ccac1deaf3e8aa1a0d29aeb142570182.zip
add back --use-system-qemu
Change-Id: Ia0b11954327407f576154552a96c406bd9e666ff
Diffstat (limited to 'init_buildsystem')
-rwxr-xr-xinit_buildsystem80
1 files changed, 80 insertions, 0 deletions
diff --git a/init_buildsystem b/init_buildsystem
index c7dc95a..750797d 100755
--- a/init_buildsystem
+++ b/init_buildsystem
@@ -430,6 +430,85 @@ validate_cache_file()
fi
}
+check_copy_qemu()
+{
+ local arch
+
+ for arch in $EMULATOR_DEVS; do
+ if test -e $BUILD_DIR/qemu-$arch; then
+ return 0
+ fi
+ done
+ return 1
+}
+
+copy_qemu()
+{
+ local path dest
+
+ echo "copying qemu"
+
+ mkdir -p $BUILD_ROOT/usr/bin
+
+ if check_copy_qemu; then
+
+ for path in $BUILD_DIR/qemu-*; do
+ if file $path | grep -q static; then
+ dest="$BUILD_ROOT/usr/bin/${path##*/}"
+ if [ -f "$path" -a ! -x "$dest" ]; then
+ echo -n " $path" # report copy
+ #echo install -m755 "$path" "$dest"
+ install -m755 "$path" "$dest"
+ fi
+ fi
+ done
+
+ else
+
+ for path in /usr/bin/qemu-*; do
+ if file $path | grep -q static; then
+ dest="$BUILD_ROOT/usr/bin/${path##*/}"
+ if [ -f "$path" -a ! -x "$dest" ]; then
+ echo -n " $path" # report copy
+ #echo install -m755 "$path" "$dest"
+ install -m755 "$path" "$dest"
+ fi
+ fi
+ done
+
+ if [ -e /usr/sbin/qemu-binfmt-conf.sh \
+ -a ! -e $BUILD_ROOT/usr/sbin/qemu-binfmt-conf.sh ]; then
+ echo " /usr/sbin/qemu-binfmt-conf.sh" # report copy
+ mkdir -p $BUILD_ROOT/usr/sbin
+ install -m755 /usr/sbin/qemu-binfmt-conf.sh $BUILD_ROOT/usr/sbin
+ fi
+
+ fi
+ echo ""
+
+ # Below for backward compatibility when /.build/initvm is not present
+
+ if [ -n "$PREPARE_VM" ]; then
+ if [ -x /bin/bash-static -a -x /bin/mount-static ]; then
+ echo " /bin/bash-static /bin/mount-static" # report copy
+ mkdir -p $BUILD_ROOT/bin
+ install -m755 /bin/bash-static $BUILD_ROOT/bin
+ install -m755 /bin/mount-static $BUILD_ROOT/bin
+ fi
+ fi
+}
+
+check_binfmt_registered()
+{
+ local arch
+ for arch in $EMULATOR_DEVS; do
+ if test -e /proc/sys/fs/binfmt_misc/$arch; then
+ return 0
+ fi
+ done
+ return 1
+}
+
fail_exit()
{
cleanup_and_exit 1
@@ -607,6 +686,7 @@ else
# register the QEMU emulator
#
if check_use_emulator; then
+ [ -n "$USE_SYSTEM_QEMU" ] && copy_qemu
echo "registering binfmt handlers for VM"
if [ -x "$BUILD_DIR/initvm.`uname -m`" -a -e "$BUILD_DIR/qemu-reg" ]; then