From 0b5a8cb562e54828994fbb59a34417e55bdccac6 Mon Sep 17 00:00:00 2001 From: Nour-eddine Taleb Date: Mon, 17 May 2021 13:44:30 +0100 Subject: [PATCH 1/2] tools: labs: qemu: add support for x86_64 host machines Signed-off-by: Nour-eddine Taleb --- tools/labs/qemu/Makefile | 23 ++++++++++++++++------- tools/labs/qemu/qemu.sh | 4 +++- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/tools/labs/qemu/Makefile b/tools/labs/qemu/Makefile index e336618074885d..c24c94b13ec70e 100644 --- a/tools/labs/qemu/Makefile +++ b/tools/labs/qemu/Makefile @@ -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 \ @@ -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 @@ -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) + echo "CONFIG_64BIT=y" >> $^ + echo "CONFIG_IA32_EMULATION=y" >> $^ +endif cp $^ $@ $(MAKE) -C $(KDIR) olddefconfig diff --git a/tools/labs/qemu/qemu.sh b/tools/labs/qemu/qemu.sh index 4735f227ae2d1b..e27ec55cb8a0bb 100755 --- a/tools/labs/qemu/qemu.sh +++ b/tools/labs/qemu/qemu.sh @@ -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 ;; From 37783550ffb88dce45f5afb1cba162d15b8e1aa3 Mon Sep 17 00:00:00 2001 From: Nour-eddine Taleb Date: Mon, 17 May 2021 18:28:14 +0100 Subject: [PATCH 2/2] tools: labs: qemu: x86_64 append new configs, after copy, not before for x86_64 we add extra configs to kernel .config, after we copy the default config file, to avoid messing with default lab configs Signed-off-by: Nour-eddine Taleb --- tools/labs/qemu/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/labs/qemu/Makefile b/tools/labs/qemu/Makefile index c24c94b13ec70e..64100dcc23f233 100644 --- a/tools/labs/qemu/Makefile +++ b/tools/labs/qemu/Makefile @@ -43,11 +43,11 @@ 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 + cp $^ $@ ifeq ($(ARCH),x86_64) - echo "CONFIG_64BIT=y" >> $^ - echo "CONFIG_IA32_EMULATION=y" >> $^ + echo "CONFIG_64BIT=y" >> $@ + echo "CONFIG_IA32_EMULATION=y" >> $@ endif - cp $^ $@ $(MAKE) -C $(KDIR) olddefconfig zImage: $(ZIMAGE)