# whether we have virtio support
kvm_virtio=
+# guest visible console device name
+console=ttyS0
+
# need to restore build root owner for non-root builds
browner=0
RSYNCDEST=
RSYNCDONE=
SIGNDUMMY=
+HOST_ARCH=
# list of archs which need emulator initialization
: ${EMULATOR_ARCHS:="armv4l armv5el armv6el armv7el armv7hl armv8el mips mipsel mips64 mips64el ppc ppc64 sh4 sparc sparc64 s390 s390x"}
perl -e 'syscall('$PERSONALITY_SYSCALL', 0); exec(@ARGV) || die("$ARGV[0]: $!\n")' "$@"
}
+check_for_ppc()
+{
+ local uname
+
+ uname=$(uname -m)
+
+ if [ "$uname" != "ppc" -a "$uname" != "ppc64" ]; then
+ return
+ fi
+
+ export HOST_ARCH=ppc
+
+ # XXX is this ok for ppc32 hosts? do we care?
+ export kvm_bin="/usr/bin/qemu-system-ppc64"
+ export console=hvc0
+ # XXX check host CPU and adjust guest CPU accordingly
+ export KVM_OPTIONS="-enable-kvm -M pseries -cpu 970mp -m 512 -mem-path /hugetlbfs"
+ export VM_KERNEL=/root/obs_kernel/vmlinux
+ export VM_INITRD=/root/obs_kernel/initrd
+
+ # XXX complain when hugetlbfs is not mounted
+}
+
#### main ####
trap fail_exit EXIT
*i?86*) PERSONALITY_SYSCALL=136 ;;
esac
+check_for_ppc
+
shopt -s nullglob
if detect_vm_2nd_stage ; then
fi
if [ "$VM_TYPE" = 'kvm' -a -z "$RUNNING_IN_VM" ]; then
- if [ ! -r /dev/kvm -o ! -x "$qemu_bin"-kvm ]; then
+ if [ ! -r /dev/kvm -o ! -x "$kvm_bin" ]; then
echo "host doesn't support kvm"
echo "either the kvm kernel-module is not loaded or kvm is not installed or hardware virtualization is deactivated in the BIOS."
cleanup_and_exit 3
fi
fi
+ if [ "$HOST_ARCH" = ppc ]; then
+ # KVM on PPC can not run virtio yet, so we need to use the default vio
+ kvm_virtio=
+ fi
+
if [ "$kvm_virtio" = 1 ]; then
VM_SWAPDEV=/dev/vdb
qemu_rootdev=/dev/vda
set -- $qemu_bin -no-reboot -nographic -net none $KVM_OPTIONS \
-kernel $vm_kernel \
-initrd $vm_initrd \
- -append "root=$qemu_rootdev panic=1 quiet no-kvmclock rw elevator=noop console=ttyS0 init=$vm_init_script" \
+ -append "root=$qemu_rootdev panic=1 quiet no-kvmclock rw elevator=noop console=$console init=$vm_init_script" \
${MEMSIZE:+-m $MEMSIZE} \
"${qemu_args[@]}"