diff mbox series

[PATCHv2,1/3] arch: add support for loongarch64

Message ID ZkOOD/8NqH3cTjlP@waldemar-brodkorb.de
State New
Headers show
Series [PATCHv2,1/3] arch: add support for loongarch64 | expand

Commit Message

Waldemar Brodkorb May 14, 2024, 4:15 p.m. UTC
Loongarch is a RISC microprocessor from Loongarch Technologies.
- at the moment we only support lp64d ABI
- binutils 2.40 is too old so disable it for loongarch64
- gcc 12.x is too old to compile a Linux kernel, so disable it for
  loongarch64
- gdb versions work fine 

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
---
v1->v2:
 - added me to DEVELOPERS file requested by Thomas P.
 - check older binutils/gcc/gdb for support requested by Thomas P.
---
 DEVELOPERS                      |  1 +
 arch/Config.in                  | 12 ++++++++++++
 arch/Config.in.loongarch64      | 14 ++++++++++++++
 package/binutils/Config.in.host |  1 +
 package/gcc/Config.in.host      |  2 ++
 package/glibc/Config.in         |  1 +
 package/musl/Config.in          |  1 +
 7 files changed, 32 insertions(+)
 create mode 100644 arch/Config.in.loongarch64
diff mbox series

Patch

diff --git a/DEVELOPERS b/DEVELOPERS
index a9deddb343..9e299e7e66 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -3203,6 +3203,7 @@  N:	Wade Berrier <wberrier@gmail.com>
 F:	package/ngrep/
 
 N:	Waldemar Brodkorb <wbx@openadk.org>
+F:	arch/Config.in.loongarch64
 F:	board/qemu/riscv32-virt/
 F:	configs/qemu_riscv32_nommu_virt_defconfig
 F:	package/asterisk/
diff --git a/arch/Config.in b/arch/Config.in
index f39c33ef7f..070a4aca3a 100644
--- a/arch/Config.in
+++ b/arch/Config.in
@@ -77,6 +77,14 @@  config BR2_i386
 	  Intel i386 architecture compatible microprocessor
 	  http://en.wikipedia.org/wiki/I386
 
+config BR2_loongarch64
+	bool "loongarch64"
+	select BR2_ARCH_IS_64
+	select BR2_USE_MMU
+	help
+	  Loongarch is a RISC microprocessor from Loongarch Technologies.
+	  https://en.wikipedia.org/wiki/Loongson
+
 config BR2_m68k
 	bool "m68k"
 	# MMU support is set by the subarchitecture file, arch/Config.in.m68k
@@ -374,6 +382,10 @@  if BR2_arm || BR2_armeb || BR2_aarch64 || BR2_aarch64_be
 source "arch/Config.in.arm"
 endif
 
+if BR2_loongarch64
+source "arch/Config.in.loongarch64"
+endif
+
 if BR2_m68k
 source "arch/Config.in.m68k"
 endif
diff --git a/arch/Config.in.loongarch64 b/arch/Config.in.loongarch64
new file mode 100644
index 0000000000..2b5bac095d
--- /dev/null
+++ b/arch/Config.in.loongarch64
@@ -0,0 +1,14 @@ 
+config BR2_ARCH
+	default "loongarch64"
+
+config BR2_NORMALIZED_ARCH
+	default "loongarch"
+
+config BR2_ENDIAN
+	default "LITTLE"
+
+config BR2_READELF_ARCH_NAME
+	default "LoongArch"
+
+# vim: ft=kconfig
+# -*- mode:kconfig; -*-
diff --git a/package/binutils/Config.in.host b/package/binutils/Config.in.host
index cb65f5f5e4..89e36d6047 100644
--- a/package/binutils/Config.in.host
+++ b/package/binutils/Config.in.host
@@ -14,6 +14,7 @@  choice
 
 config BR2_BINUTILS_VERSION_2_40_X
 	bool "binutils 2.40"
+	depends on !BR2_loongarch64
 
 config BR2_BINUTILS_VERSION_2_41_X
 	bool "binutils 2.41"
diff --git a/package/gcc/Config.in.host b/package/gcc/Config.in.host
index 2324561a3e..a0377cc0a3 100644
--- a/package/gcc/Config.in.host
+++ b/package/gcc/Config.in.host
@@ -30,6 +30,8 @@  config BR2_GCC_VERSION_12_X
 	depends on !BR2_POWERPC_CPU_HAS_SPE
 	# ARC HS48 rel 31 only supported by gcc arc fork.
 	depends on !BR2_archs4x_rel31
+	# too old to compile Linux Kernel
+	depends on !BR2_loongarch64
 	select BR2_TOOLCHAIN_GCC_AT_LEAST_12
 
 config BR2_GCC_VERSION_13_X
diff --git a/package/glibc/Config.in b/package/glibc/Config.in
index 81c64083f4..5385e2a855 100644
--- a/package/glibc/Config.in
+++ b/package/glibc/Config.in
@@ -5,6 +5,7 @@  config BR2_PACKAGE_GLIBC_ARCH_SUPPORTS
 	default y if BR2_aarch64
 	default y if BR2_aarch64_be
 	default y if BR2_i386
+	default y if BR2_loongarch64
 	default y if BR2_m68k_m68k
 	default y if BR2_mips
 	default y if BR2_mipsel
diff --git a/package/musl/Config.in b/package/musl/Config.in
index a6e2af054c..70475326f5 100644
--- a/package/musl/Config.in
+++ b/package/musl/Config.in
@@ -5,6 +5,7 @@  config BR2_PACKAGE_MUSL_ARCH_SUPPORTS
 	default y if BR2_arm
 	default y if BR2_armeb
 	default y if BR2_i386
+	default y if BR2_loongarch64
 	default y if BR2_m68k_m68k
 	default y if BR2_microblaze
 	default y if BR2_mips