Kbuild: QEMU target.

This commit adds support for the qemu target.
This target will generate the kernel binary and will
launch a qemu instance running the binary.
Currently, only the x86 generic pc and the arm tilm3s6965
BSPs are supported with emulation.

Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
Change-Id: I9e71d3ce2fba98572830475a2e15e3fceb0216b4
This commit is contained in:
Juan Manuel Cruz 2015-04-30 14:14:29 -05:00 committed by Anas Nashif
commit e7de0f65b4
4 changed files with 32 additions and 1 deletions

View file

@ -373,6 +373,8 @@ DEPMOD = /sbin/depmod
PERL = perl
PYTHON = python
CHECK = sparse
QEMU_BIN_PATH ?= /usr/bin
QEMU = $(QEMU_BIN_PATH)/$(QEMU_$(SRCARCH))
CHECKFLAGS := -Wbitwise -Wno-return-void $(CF)
CFLAGS_MODULE =
@ -1296,6 +1298,7 @@ help:
@echo 'Other generic targets:'
@echo ' all - Build all targets marked with [*]'
@echo '* tinymountain - Build the bare kernel'
@echo ' qemu - Build the bare kernel and runs the emulation with qemu'
@echo '* modules - Build all modules'
@echo ' modules_install - Install all modules to INSTALL_MOD_PATH (default: /)'
@echo ' firmware_install- Install all firmware to INSTALL_FW_PATH'
@ -1548,6 +1551,12 @@ tools/%: FORCE
$(Q)mkdir -p $(objtree)/tools
$(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(filter --j% -j,$(MAKEFLAGS))" O=$(objtree) subdir=tools -C $(src)/tools/ $*
QEMU_FLAGS = $ $(QEMU_FLAGS_$(SRCARCH))
qemu: tinymountain
@echo '[QEMU] CPU: $(QEMU_CPU_TYPE_$(SRCARCH))'
$(Q)$(QEMU) $(QEMU_FLAGS) -kernel tinymountain.elf
# Single targets
# ---------------------------------------------------------------------------
# Single targets are compatible with:

View file

@ -25,6 +25,10 @@ mrproper: clean
$(Q)$(MAKE) -C $(TIMO_BASE) O=$(PROJECT_BASE) \
PROJECT=$(PROJECT_BASE) VPFILE=$(VPFILE) $@
qemu: FORCE
$(Q)$(MAKE) -C $(TIMO_BASE) O=$(PROJECT_BASE) \
PROJECT=$(PROJECT_BASE) VPFILE=$(VPFILE) qemu
PHONY += FORCE
FORCE:

View file

@ -12,3 +12,10 @@ arm_FLAGS += -DVXMICRO_ARCH_arm
arm_FLAGS += -DVXMICRO_ARCH=arm
arm_FLAGS += $(SECTION_GC_FLAG)
arm_FLAGS += $(LTO_FLAG-$(CONFIG_LTO))
QEMU_CPU_TYPE_arm = cortex-m3
QEMU_FLAGS_arm = -cpu $(QEMU_CPU_TYPE_arm) \
-machine lm3s6965evb -nographic
QEMU_arm = qemu-system-arm
export QEMU_FLAGS_arm QEMU_arm

View file

@ -20,4 +20,15 @@ ISA_FLAG_pentium4 = $(call cc-option,-march=pentium4,)
ISA_FLAG_minuteia = $(call cc-option,-march=pentium,)
ISA_FLAG_atom_n28xx = $(call cc-option,-march=atom,) $(call cc-option,-mtune=atom,)
export ISA_FLAG_pentium4 ISA_FLAG_minuteia ISA_FLAG_atom_n28xx
QEMU_BIOS ?= /usr/share/qemu
QEMU_CPU_TYPE_x86 = qemu32
QEMU_FLAGS_x86 = -m 32 -cpu $(QEMU_CPU_TYPE_x86) \
-no-reboot -nographic -display none -net none \
-clock dynticks -no-acpi -balloon none -no-hpet \
-L $(QEMU_BIOS) -bios bios.bin \
-serial mon:stdio -machine type=pc-0.14
QEMU_x86 = qemu-system-i386
export ISA_FLAG_pentium4 ISA_FLAG_minuteia ISA_FLAG_atom_n28xx \
QEMU_FLAGS_x86 QEMU_x86 QEMU_CPU_TYPE_x86