Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools: labs: qemu: add support for x86_64 host machines #286

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions tools/labs/qemu/Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
QEMU_DISPLAY ?= none
ARCH ?= x86
IMG_ARCH := $(ARCH)

ifeq ($(ARCH),x86)
b = b
else ifeq ($(ARCH),x86_64)
b = b
IMG_ARCH = x86
endif

ZIMAGE = $(KDIR)/arch/$(ARCH)/boot/$(b)zImage
KCONFIG = $(KDIR)/.config
NTTCP = $(KDIR)/tools/labs/templates/assignments/6-e100/nttcp

YOCTO_URL = http://downloads.yoctoproject.org/releases/yocto/yocto-2.3/machines/qemu/qemu$(ARCH)/
YOCTO_IMAGE = core-image-minimal-qemu$(ARCH).ext4
#YOCTO_IMAGE = core-image-minimal-dev-qemu$(ARCH).ext4
#YOCTO_IMAGE = core-image-sato-dev-qemu$(ARCH).ext4
#YOCTO_IMAGE = core-image-sato-qemu$(ARCH).ext4
#YOCTO_IMAGE = core-image-sato-sdk-qemu$(ARCH).ext4
YOCTO_URL = http://downloads.yoctoproject.org/releases/yocto/yocto-2.3/machines/qemu/qemu$(IMG_ARCH)/
YOCTO_IMAGE = core-image-minimal-qemu$(IMG_ARCH).ext4
#YOCTO_IMAGE = core-image-minimal-dev-qemu$(IMG_ARCH).ext4
#YOCTO_IMAGE = core-image-sato-dev-qemu$(IMG_ARCH).ext4
#YOCTO_IMAGE = core-image-sato-qemu$(IMG_ARCH).ext4
#YOCTO_IMAGE = core-image-sato-sdk-qemu$(IMG_ARCH).ext4

QEMU_OPTS = -kernel $(ZIMAGE) \
-device virtio-serial \
Expand All @@ -25,7 +30,7 @@ QEMU_OPTS = -kernel $(ZIMAGE) \
-drive file=disk1.img,if=virtio,format=raw \
-drive file=disk2.img,if=virtio,format=raw \
--append "root=/dev/vda loglevel=15 console=hvc0" \
--display $(QEMU_DISPLAY) -s -m 256
--display $(QEMU_DISPLAY) -s -m 512

ifdef ENABLE_KVM
QEMU_OPTS += -enable-kvm -cpu host
Expand All @@ -38,6 +43,10 @@ boot: .modinst tap0 tap1 pipe1.in pipe1.out pipe2.in pipe2.out disk1.img disk2.i
TEMPDIR := $(shell mktemp -u)

$(KCONFIG): qemu/kernel_config.x86
ifeq ($(ARCH),x86_64)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will change the source file, I think it is better to move this block after the copy below and update ^@

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, that's a great notice, I will fix it.

echo "CONFIG_64BIT=y" >> $^
echo "CONFIG_IA32_EMULATION=y" >> $^
endif
cp $^ $@
$(MAKE) -C $(KDIR) olddefconfig

Expand Down
4 changes: 3 additions & 1 deletion tools/labs/qemu/qemu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
# allocation is dynamic, it is preferable to have a stable path to
# avoid visual inspection of the qemu output when connecting to the
# serial console.

case $ARCH in
x86)
qemu=qemu-system-i386
;;
x86_64)
qemu=qemu-system-x86_64
;;
arm)
qemu=qemu-system-arm
;;
Expand Down