From 1a426f42fe36d9f5d65182bb327e8b029f710e89 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Fri, 19 Aug 2022 13:14:58 +0200 Subject: loongarch: use special linux version, boots up now --- mk/image.mk | 2 +- mk/kernel-build.mk | 4 ++++ target/config/Config.in.kernelfmt | 4 ++++ target/linux/Config.in.kernelversion | 5 +++++ target/loongarch/Makefile | 4 ++-- target/loongarch/QEMU_EFI.fd | Bin 0 -> 4190208 bytes target/loongarch/kernel/qemu-loongarch | 3 +++ target/loongarch/systems/qemu-loongarch | 1 + 8 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 target/loongarch/QEMU_EFI.fd diff --git a/mk/image.mk b/mk/image.mk index f17f26c12..1a080557a 100644 --- a/mk/image.mk +++ b/mk/image.mk @@ -98,7 +98,7 @@ 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) +ifeq ($(ADK_TARGET_ARCH_LOONGARCH)$(ADK_TARGET_ARCH_S390),y) (cd ${TARGET_DIR}/; ln -sf lib lib64) endif diff --git a/mk/kernel-build.mk b/mk/kernel-build.mk index bae7ab168..ca77b2f76 100644 --- a/mk/kernel-build.mk +++ b/mk/kernel-build.mk @@ -27,6 +27,10 @@ ifeq ($(ADK_TARGET_KERNEL_VMLINUX_BOOTP),y) KERNEL_FILE:=bootpfile KERNEL_TARGET:=bootpfile endif +ifeq ($(ADK_TARGET_KERNEL_VMLINUX_EFI),y) +KERNEL_FILE:=vmlinux.efi +KERNEL_TARGET:=all +endif ifeq ($(ADK_TARGET_KERNEL_VMLINUX_GZ),y) KERNEL_FILE:=vmlinux KERNEL_TARGET:=all diff --git a/target/config/Config.in.kernelfmt b/target/config/Config.in.kernelfmt index 2e43dc5dc..84433dfb1 100644 --- a/target/config/Config.in.kernelfmt +++ b/target/config/Config.in.kernelfmt @@ -31,6 +31,9 @@ config ADK_TARGET_KERNEL_VMLINUX_BIN config ADK_TARGET_KERNEL_VMLINUX_BOOTP bool +config ADK_TARGET_KERNEL_VMLINUX_EFI + bool + config ADK_TARGET_KERNEL_VMLINUX_GZ bool @@ -55,6 +58,7 @@ config ADK_TARGET_KERNEL default "vmlinux.srec" if ADK_TARGET_KERNEL_VMLINUX_SREC default "vmlinux.bin" if ADK_TARGET_KERNEL_VMLINUX_BIN default "bootpfile" if ADK_TARGET_KERNEL_VMLINUX_BOOTP + default "vmlinux.efi" if ADK_TARGET_KERNEL_VMLINUX_EFI default "vmlinux.gz" if ADK_TARGET_KERNEL_VMLINUX_GZ default "xipImage" if ADK_TARGET_KERNEL_XIPIMAGE default "bzImage" if ADK_TARGET_KERNEL_BZIMAGE diff --git a/target/linux/Config.in.kernelversion b/target/linux/Config.in.kernelversion index af844978b..38cf11493 100644 --- a/target/linux/Config.in.kernelversion +++ b/target/linux/Config.in.kernelversion @@ -167,6 +167,7 @@ endchoice config ADK_TARGET_LINUX_KERNEL_GIT_REPO string "git repository" depends on ADK_TARGET_LINUX_KERNEL_VERSION_GIT + default "https://github.com/loongson/linux.git" if ADK_TARGET_LINUX_ARCH_LOONGARCH default "https://github.com/raspberrypi/linux.git" if ADK_TARGET_BOARD_BCM28XX default "git://git.code.sf.net/p/adi-linux/code" if ADK_TARGET_SYSTEM_ADSP_BF537 default "https://github.com/EmcraftSystems/linux-emcraft.git" if ADK_TARGET_SYSTEM_KINETIS_K70 @@ -183,6 +184,7 @@ config ADK_TARGET_LINUX_KERNEL_GIT_REPO config ADK_TARGET_LINUX_KERNEL_GIT_REPO_NAME string depends on ADK_TARGET_LINUX_KERNEL_VERSION_GIT + default "loongarch" if ADK_TARGET_LINUX_ARCH_LOONGARCH default "kvx" if ADK_TARGET_ARCH_KVX default "lm32" if ADK_TARGET_ARCH_LM32 default "rpi" if ADK_TARGET_BOARD_BCM28XX @@ -206,10 +208,12 @@ config ADK_TARGET_LINUX_KERNEL_GIT default "c85fbc86c61a8c8fd45ab1fe3d1bdd2df12f7962" if ADK_TARGET_SYSTEM_SOLIDRUN_IMX6 default "8624998967676862843aed1f8ee2141e98987f81" if ADK_TARGET_SYSTEM_BEAGLEBONE_BLACK default "v4.4.52-phy" if ADK_TARGET_SYSTEM_PHYTEC_WEGA + default "loongarch-next" if ADK_TARGET_LINUX_ARCH_LOONGARCH config ADK_TARGET_LINUX_KERNEL_GIT_VER string "kernel version" depends on ADK_TARGET_LINUX_KERNEL_VERSION_GIT + default "5.19" if ADK_TARGET_LINUX_ARCH_LOONGARCH default "5.10.92" if ADK_TARGET_BOARD_BCM28XX default "4.4.37" if ADK_TARGET_SYSTEM_BEAGLEBONE_BLACK default "4.4.52" if ADK_TARGET_SYSTEM_PHYTEC_WEGA @@ -221,6 +225,7 @@ config ADK_TARGET_LINUX_KERNEL_GIT_VER config ADK_TARGET_LINUX_KERNEL_GIT_TYPE string depends on ADK_TARGET_LINUX_KERNEL_VERSION_GIT + default "branch" if ADK_TARGET_LINUX_ARCH_LOONGARCH default "branch" if ADK_TARGET_SYSTEM_PHYTEC_WEGA default "hash" diff --git a/target/loongarch/Makefile b/target/loongarch/Makefile index b8569d69a..c238b5e62 100644 --- a/target/loongarch/Makefile +++ b/target/loongarch/Makefile @@ -5,9 +5,9 @@ include $(ADK_TOPDIR)/rules.mk include $(ADK_TOPDIR)/mk/kernel-build.mk include $(ADK_TOPDIR)/mk/image.mk -KERNEL:=$(LINUX_DIR)/vmlinux +KERNEL:=$(LINUX_DIR)/arch/loongarch/boot/vmlinux.efi -QEMU_ARGS:=-M virt +QEMU_ARGS:=-M virt -bios target/loongarch/QEMU_EFI.fd -append "console=ttyS0,115200" QEMU_ARGS+=-nographic # # target helper text diff --git a/target/loongarch/QEMU_EFI.fd b/target/loongarch/QEMU_EFI.fd new file mode 100644 index 000000000..d3ae20f12 Binary files /dev/null and b/target/loongarch/QEMU_EFI.fd differ diff --git a/target/loongarch/kernel/qemu-loongarch b/target/loongarch/kernel/qemu-loongarch index 582028585..579c3f26e 100644 --- a/target/loongarch/kernel/qemu-loongarch +++ b/target/loongarch/kernel/qemu-loongarch @@ -1,7 +1,10 @@ CONFIG_LOONGARCH=y CONFIG_64BIT=y CONFIG_MACH_LOONGSON64=y +CONFIG_ACPI=y +CONFIG_IRQ_DOMAIN=y CONFIG_EFI=y +CONFIG_EFI_STUB=y CONFIG_SMP=y CONFIG_SERIAL_8250=y CONFIG_SERIAL_8250_CONSOLE=y diff --git a/target/loongarch/systems/qemu-loongarch b/target/loongarch/systems/qemu-loongarch index b5f6c3d34..3b5d940de 100644 --- a/target/loongarch/systems/qemu-loongarch +++ b/target/loongarch/systems/qemu-loongarch @@ -2,6 +2,7 @@ config ADK_TARGET_SYSTEM_QEMU_LOONGARCH bool "Qemu Emulator" select ADK_TARGET_QEMU select ADK_TARGET_CPU_LOONGARCH + select ADK_TARGET_KERNEL_VMLINUX_EFI help Support for Qemu Emulator Loongarch architecture. -- cgit v1.2.3