Bladeren bron

add basic support for qemu-aarch64

Waldemar Brodkorb 10 jaren geleden
bovenliggende
commit
429bcaddee

+ 19 - 0
target/aarch64/Makefile

@@ -9,6 +9,15 @@ include $(ADK_TOPDIR)/mk/image.mk
 
 KERNEL:=${LINUX_DIR}/arch/arm64/boot/Image
 
+QEMU_ARGS:=${ADK_QEMU_ARGS}
+QEMU_ARGS+=-M virt -cpu cortex-a57 -smp 1
+ifeq ($(ADK_TARGET_QEMU_WITH_VIRTIO),y)
+QEMU_ARGS+=-net nic,model=virtio -net user
+endif
+ifeq ($(ADK_TARGET_FS),archive)
+QEMU_ARGS+=-drive file=qemu-${ADK_TARGET_CPU_ARCH}.img,if=virtio,index=0
+endif
+
 # target helper text
 ifeq ($(ADK_TARGET_FS),archive)
 targethelp:
@@ -18,6 +27,10 @@ ifeq ($(ADK_TARGET_FS),initramfs)
 targethelp:
 	@echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
 	@echo 'The initramfs image is: ${FW_DIR}/${INITRAMFS}'
+ifeq ($(ADK_TARGET_QEMU),y)
+	@echo "Start qemu with following command line:"
+	@echo 'qemu-system-${ADK_TARGET_CPU_ARCH} ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL) -initrd ${FW_DIR}/${INITRAMFS}'
+endif
 endif
 ifeq ($(ADK_TARGET_FS),initramfsarchive)
 targethelp:
@@ -31,11 +44,16 @@ ifeq ($(ADK_TARGET_SYSTEM_ARM_FM),y)
 	@echo 'Start emulator via:'
 	@echo 'Foundation_v8 --image=$(FW_DIR)/${TARGET_KERNEL}'
 endif
+ifeq ($(ADK_TARGET_QEMU),y)
+	@echo "Start qemu with following command line:"
+	@echo 'qemu-system-${ADK_TARGET_CPU_ARCH} ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL)'
+endif
 endif
 
 kernel-strip:
 
 kernel-install: kernel-strip
+ifeq ($(ADK_TARGET_SYSTEM_ARM_FM),y)
 	cd $(ADK_TOPDIR) && \
 		make -f Makefile \
 		-C package/boot-wrapper-aarch64 clean
@@ -44,6 +62,7 @@ kernel-install: kernel-strip
 		-C package/boot-wrapper-aarch64 package
 	${CP} ${LINUX_DIR}/linux-system.axf \
 		$(FW_DIR)/$(TARGET_KERNEL)
+endif
 
 # filesystem specific targets
 ifeq ($(ADK_TARGET_FS),archive)

+ 4 - 0
target/aarch64/kernel/qemu-aarch64

@@ -0,0 +1,4 @@
+CONFIG_ARM64=y
+CONFIG_ARCH_VEXPRESS=y
+CONFIG_SERIAL_AMBA_PL011=y
+CONFIG_SERIAL_AMBA_PL011_CONSOLE=y

+ 11 - 0
target/aarch64/systems/qemu-aarch64

@@ -0,0 +1,11 @@
+config ADK_TARGET_SYSTEM_QEMU_AARCH64
+	bool "Qemu Emulator"
+	select ADK_aarch64
+	select ADK_qemu_aarch64
+	select ADK_little
+	select ADK_LINUX_64
+	select ADK_TARGET_QEMU
+	select ADK_TARGET_KERNEL_IMAGE
+	help
+	  Qemu Emulator for AARCH64 architecture.
+

+ 1 - 0
target/config/Config.in.kernel

@@ -34,6 +34,7 @@ config ADK_TARGET_KERNEL_MINICONFIG
 	default "arm-fm" if ADK_TARGET_SYSTEM_ARM_FM
 	default "qemu-microblaze-s3adsp1800" if ADK_TARGET_QEMU_MICROBLAZE_MODEL_S3ADSP1800
 	default "qemu-microblaze-ml605" if ADK_TARGET_QEMU_MICROBLAZE_MODEL_ML605
+	default "qemu-aarch64" if ADK_TARGET_SYSTEM_QEMU_AARCH64
 	default "qemu-arm-versatilepb" if ADK_TARGET_QEMU_ARM_MODEL_VERSATILEPB
 	default "qemu-arm-vexpress-a9" if ADK_TARGET_QEMU_ARM_MODEL_VEXPRESS_A9
 	default "qemu-arm-spitz" if ADK_TARGET_QEMU_ARM_MODEL_SPITZ

+ 2 - 0
target/config/Config.in.qemuopts

@@ -81,9 +81,11 @@ endchoice
 choice
 prompt "Qemu Emulation using VirtIO drivers"
 depends on ADK_TARGET_SYSTEM_QEMU_SPARC64 || \
+		ADK_TARGET_SYSTEM_QEMU_AARCH64 || \
 		ADK_TARGET_SYSTEM_QEMU_X86 || \
 		ADK_TARGET_SYSTEM_QEMU_X86_64
 default ADK_TARGET_QEMU_WITH_VIRTIO if ADK_TARGET_SYSTEM_QEMU_SPARC64
+default ADK_TARGET_QEMU_WITH_VIRTIO if ADK_TARGET_SYSTEM_QEMU_AARCH64
 
 config ADK_TARGET_QEMU_WITHOUT_VIRTIO
 	boolean "disabled"

+ 1 - 1
toolchain/gcc/Makefile

@@ -44,7 +44,7 @@ else
 GCC_CONFOPTS+=         --disable-tls --disable-threads --disable-libatomic
 endif
 
-ifneq ($(ADK_LINUX_ALPHA)$(ADK_LINUX_XTENSA)$(ADK_LINUX_M68K),y)
+ifneq ($(ADK_LINUX_AARCH64)$(ADK_LINUX_ALPHA)$(ADK_LINUX_XTENSA)$(ADK_LINUX_M68K),y)
 GCC_FINAL_CONFOPTS+=	--enable-cxx-flags='$(TARGET_CXXFLAGS)'
 endif