浏览代码

qemu-system-s390: add basic support, only virtio-net does not work as expected.

Waldemar Brodkorb 9 年之前
父节点
当前提交
09cd046e6c

+ 3 - 0
mk/image.mk

@@ -79,6 +79,9 @@ ifneq ($(ADK_TARGET_ARCH_AARCH64)$(ADK_TARGET_ARCH_X86_64)$(ADK_TARGET_ARCH_PPC6
 	test ! -d ${TARGET_DIR}/usr/lib || rm -rf ${TARGET_DIR}/usr/lib/
 	(cd ${TARGET_DIR}/usr ; ln -sf ${ADK_TARGET_LIBC_PATH} lib)
 endif
+ifeq ($(ADK_TARGET_ARCH_S390),y)
+	(cd ${TARGET_DIR}/; ln -sf lib lib64)
+endif
 
 ifeq (${ADK_PRELINK},)
 prelink:

+ 8 - 6
target/config/Config.in.cpu

@@ -609,11 +609,6 @@ config ADK_CPU_PPC64
 	select ADK_TARGET_WITH_NPTL
 	select ADK_TARGET_WITH_MMU
 
-config ADK_CPU_S390
-	bool
-	select ADK_TARGET_WITH_NPTL
-	select ADK_TARGET_WITH_MMU
-
 config ADK_CPU_SH2
 	bool
 	select ADK_TARGET_WITHOUT_MMU
@@ -673,6 +668,12 @@ config ADK_CPU_XTENSA
 	select ADK_TARGET_WITH_NPTL
 	select ADK_TARGET_WITH_MMU
 
+config ADK_CPU_Z900
+	bool
+	select ADK_LINUX_64
+	select ADK_TARGET_WITH_NPTL
+	select ADK_TARGET_WITH_MMU
+
 # CPU features
 config ADK_TARGET_CPU_WITH_FPU
 	bool
@@ -797,6 +798,7 @@ config ADK_TARGET_GCC_ARCH
 	default "nocona" if ADK_CPU_NOCONA
 	default "pentium-m" if ADK_CPU_PENTIUM_M
 	default "x86-64" if ADK_CPU_X86_64
+	default "z900" if ADK_CPU_Z900
 
 config ADK_TARGET_CPU_FLAGS
 	string
@@ -956,7 +958,7 @@ config ADK_TARGET_CPU_ARCH
 	default "ppc" if ADK_CPU_PPC_440
 	default "ppc64le" if ADK_CPU_PPC64 && ADK_TARGET_LITTLE_ENDIAN
 	default "ppc64" if ADK_CPU_PPC64 && ADK_TARGET_BIG_ENDIAN
-	default "s390" if ADK_CPU_S390
+	default "s390x" if ADK_TARGET_ARCH_S390
 	default "sh2" if ADK_CPU_SH2
 	default "sh2a" if ADK_CPU_SH2A
 	default "sh3" if ADK_CPU_SH3

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

@@ -246,6 +246,7 @@ config ADK_RUNTIME_CONSOLE_SERIAL_DEVICE
 	default "ttyAMA0" if ADK_TARGET_SYSTEM_RASPBERRY_PI2
 	default "ttyDA1" if ADK_TARGET_SYSTEM_QEMU_METAG
 	default "ttyS2" if ADK_TARGET_SYSTEM_KINETIS_K70
+	default "ttysclp0" if ADK_TARGET_SYSTEM_QEMU_S390
 	default "ttyO0" if ADK_TARGET_SYSTEM_BEAGLEBONE_BLACK
 	default "ttyS0"
 

+ 1 - 0
target/linux/config/Config.in.virtio

@@ -24,6 +24,7 @@ config ADK_KERNEL_VIRTIO_NET
 	select ADK_KERNEL_VIRTIO_MMIO
 	select ADK_KERNEL_VIRTIO_PCI
 	select ADK_KERNEL_VIRTIO_PCI_LEGACY
+	default y if ADK_TARGET_SYSTEM_QEMU_S390
 	default n
 	help
 	  Enables support for Virtio Net driver.

+ 61 - 0
target/s390/Makefile

@@ -5,3 +5,64 @@ include $(ADK_TOPDIR)/rules.mk
 include $(ADK_TOPDIR)/mk/kernel-build.mk
 include $(ADK_TOPDIR)/mk/image.mk
 
+KERNEL:=$(LINUX_DIR)/vmlinux
+
+QEMU_ARGS:=-monitor null -M s390-ccw-virtio-2.4
+QEMU_ARGS+=${ADK_QEMU_ARGS}
+QEMU_ARGS+=-netdev user,id=eth0 -device virtio-net-ccw,netdev=eth0
+
+# target helper text
+ifeq ($(ADK_TARGET_FS),archive)
+targethelp:
+	@echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSTARBALL)"
+ifeq ($(ADK_TARGET_QEMU),y)
+	@echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
+	@echo "Use following command to create a QEMU Image:"
+	@echo "./scripts/create.sh qemu-${ADK_TARGET_CPU_ARCH}.img $(FW_DIR)/$(ROOTFSTARBALL)"
+	@echo "Start qemu with following options:"
+	@echo 'qemu-system-${ADK_TARGET_CPU_ARCH} ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL) qemu-${ADK_TARGET_CPU_ARCH}.img'
+endif
+endif
+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:
+	@echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
+	@echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSUSERTARBALL)"
+endif
+ifeq ($(ADK_TARGET_FS),initramfspiggyback)
+targethelp:
+	@echo 'The kernel+initramfs file is: $(FW_DIR)/${TARGET_KERNEL}'
+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
+
+# image creation and kernel install
+kernel-strip:
+	$(TARGET_CROSS)objcopy $(OSTRIP) -S $(KERNEL) $(BUILD_DIR)/$(TARGET_KERNEL)
+
+kernel-install: kernel-strip
+	@cp $(BUILD_DIR)/$(TARGET_KERNEL) $(FW_DIR)/${TARGET_KERNEL}
+
+# filesystem specific targets
+ifeq ($(ADK_TARGET_FS),archive)
+imageinstall: $(FW_DIR)/$(ROOTFSTARBALL) targethelp
+endif
+ifeq ($(ADK_TARGET_FS),initramfs)
+imageinstall: kernel-install $(FW_DIR)/$(INITRAMFS) targethelp
+endif
+ifeq ($(ADK_TARGET_FS),initramfsarchive)
+imageinstall: kernel-install $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
+endif
+ifeq ($(ADK_TARGET_FS),initramfspiggyback)
+imageinstall: createinitramfs targethelp
+endif

+ 13 - 0
target/s390/kernel/qemu-s390

@@ -0,0 +1,13 @@
+CONFIG_S390=y
+CONFIG_MARCH_Z900=y
+CONFIG_TN3270=y
+CONFIG_TN3270_TTY=y
+CONFIG_TN3270_FS=m
+CONFIG_TN3270_CONSOLE=y
+CONFIG_TN3215=y
+CONFIG_TN3215_CONSOLE=y
+CONFIG_CCW_CONSOLE=y
+CONFIG_SCLP_TTY=y
+CONFIG_SCLP_CONSOLE=y
+CONFIG_SCLP_VT220_TTY=y
+CONFIG_SCLP_VT220_CONSOLE=y

+ 7 - 0
target/s390/systems/qemu-s390

@@ -0,0 +1,7 @@
+config ADK_TARGET_SYSTEM_QEMU_S390
+	bool "Qemu Emulator"
+	select ADK_CPU_Z900
+	select ADK_TARGET_QEMU
+	help
+	  Support for Qemu Emulator S/390 architecture.
+

+ 1 - 1
target/s390/systems/toolchain-s390

@@ -1,6 +1,6 @@
 config ADK_TARGET_SYSTEM_TOOLCHAIN_S390
 	bool "Toolchain only"
-	select ADK_CPU_S390
+	select ADK_CPU_Z900
 	select ADK_TARGET_TOOLCHAIN
 	select ADK_TARGET_PACKAGE_TXZ
 	help