runqemu factor archs more

This commit is contained in:
Ciro Santilli
2017-06-28 21:46:46 +01:00
parent 88f1211409
commit e480b0fc64

52
runqemu
View File

@@ -43,45 +43,47 @@ done
shift "$(($OPTIND - 1))" shift "$(($OPTIND - 1))"
extra_flags="$extra_flags $@" extra_flags="$extra_flags $@"
images_dir='buildroot/output/images' buildroot_out_dir='./buildroot/output'
images_dir="$buildroot_out_dir/images"
qemu_common="\
$debug_qemu \
$buildroot_out_dir/host/usr/bin/qemu-system-$arch \
-m 128M \
-monitor telnet::45454,server,nowait \
-net user \
-smp 1 \
"
case "$arch" in case "$arch" in
x86_64) x86_64)
if $kgdb; then if $kgdb; then
extra_append="$extra_append kgdboc=ttyS0,115200" extra_append="$extra_append kgdboc=ttyS0,115200"
fi fi
cmd="$debug_qemu ./buildroot/output/host/usr/bin/qemu-system-x86_64 \ cmd="$qemu_common \
-M pc \ -M pc \
-append 'root=/dev/vda $extra_append' \ -append 'root=/dev/vda $extra_append' \
-device edu \ -drive file=${images_dir}/rootfs.ext2,if=virtio,format=raw \
-drive file=${images_dir}/rootfs.ext2,if=virtio,format=raw \ -kernel ${images_dir}/bzImage \
-kernel ${images_dir}/bzImage \ -net nic,model=virtio \
-monitor telnet::45454,server,nowait \ $extra_flags
-m 128M \ "
-net nic,model=virtio \ ;;
-net user \
-smp 1 \
$extra_flags
"
;;
arm) arm)
if $kgdb; then if $kgdb; then
extra_append="$extra_append kgdboc=ttyAMA0,115200" extra_append="$extra_append kgdboc=ttyAMA0,115200"
fi fi
cmd="qemu-system-arm \ cmd="$qemu_common \
-M versatilepb \ -M versatilepb \
-append 'root=/dev/sda $extra_append' \ -append 'root=/dev/sda $extra_append' \
-drive file=${images_dir}/rootfs.ext2,if=scsi,format=raw \ -drive file=${images_dir}/rootfs.ext2,if=scsi,format=raw \
-dtb ${images_dir}/versatile-pb.dtb \ -dtb ${images_dir}/versatile-pb.dtb \
-kernel ${images_dir}/zImage \ -kernel ${images_dir}/zImage \
-m 128M \
-monitor telnet::45454,server,nowait \
-net nic,model=rtl8139 \ -net nic,model=rtl8139 \
-net user \
-serial stdio \ -serial stdio \
-smp 1 \ $extra_flags
$extra_flags" "
;; ;;
esac esac
echo "$cmd"
if "$debug" && ! "$nographic" && [ ! "$arch" = 'arm' ]; then if "$debug" && ! "$nographic" && [ ! "$arch" = 'arm' ]; then
eval "$cmd" &>/dev/null & eval "$cmd" &>/dev/null &
# TODO: Ctrl +C gets sent to QEMU? Why? Does not happen if I run # TODO: Ctrl +C gets sent to QEMU? Why? Does not happen if I run