All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2] buildroot: Add basic support for LoongArch architecture (toolchain only)
@ 2022-12-05  9:37 duan
  2022-12-05 12:39 ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 2+ messages in thread
From: duan @ 2022-12-05  9:37 UTC (permalink / raw)
  To: buildroot

From: Zhiwei Duan <duanzhiwei@loongson.cn>


With this patch, the buildroot can compile the rootfs of the loongarch 
architecture.

Both external toolchain and buildroot toolchain can compile rootfs.

Signed-off-by: Zhiwei Duan <duanzhiwei@loongson.cn>
---
  arch/Config.in               | 16 +++++++++++
  arch/Config.in.loongarch     | 52 ++++++++++++++++++++++++++++++++++++
  package/glibc/Config.in      |  1 +
  support/gnuconfig/config.sub | 11 ++++++--
  toolchain/Config.in          |  2 +-
  5 files changed, 79 insertions(+), 3 deletions(-)
  create mode 100644 arch/Config.in.loongarch

diff --git a/arch/Config.in b/arch/Config.in
index 1c0c400a98..88f805bb1e 100644
--- a/arch/Config.in
+++ b/arch/Config.in
@@ -251,6 +251,17 @@ config BR2_xtensa
        http://en.wikipedia.org/wiki/Xtensa
        http://www.tensilica.com/

+config BR2_loongarch64
+    bool "LOONGARCH64 (little endian)"
+    select BR2_ARCH_IS_64
+    select BR2_USE_MMU
+    help
+      LOONGARCH is a RISC microprocessor from LOONGARCH Technologies. 
Little
+      endian.
+      https://www.loongson.cn/
+      #http://en.wikipedia.org/wiki/MIPS_Technologies
+
+
  endchoice

  # For some architectures or specific cores, our internal toolchain
@@ -414,6 +425,11 @@ if BR2_xtensa
  source "arch/Config.in.xtensa"
  endif

+if BR2_loongarch64
+source "arch/Config.in.loongarch"
+endif
+
+
  # Set up target binary format
  choice
      prompt "Target Binary Format"
diff --git a/arch/Config.in.loongarch b/arch/Config.in.loongarch
new file mode 100644
index 0000000000..bf86490cff
--- /dev/null
+++ b/arch/Config.in.loongarch
@@ -0,0 +1,52 @@
+# loongarch config
+config BR2_LOONGARCH_CPU_LOONGARCH64
+    bool
+    select BR2_LOONGARCH_NAN_LEGACY
+
+choice
+    prompt "Target Architecture Variant"
+    default BR2_loongarch_64 if BR2_loongarch64
+    depends on BR2_loongarch64
+    help
+      Specific CPU variant to use
+
+config BR2_loongarch_64
+    bool "Generic LOONGARCH64"
+    depends on BR2_ARCH_IS_64
+    select BR2_LOONGARCH_CPU_LOONGARCH64
+endchoice
+
+config BR2_LOONGARCH_NAN_LEGACY
+    bool
+
+#config BR2_GCC_TARGET_NAN
+#    default "legacy"    if BR2_LOONGARCH_NAN_LEGACY
+
+config BR2_ARCH
+    default "loongarch64"    if BR2_loongarch64
+
+config BR2_NORMALIZED_ARCH
+    default "loongarch"
+
+config BR2_ENDIAN
+    default "LITTLE"    if BR2_loongarch64
+
+config BR2_GCC_TARGET_ARCH
+    default "loongarch64"    if BR2_loongarch_64
+
+config BR2_READELF_ARCH_NAME
+    default "LoongArch"
+
+config BR2_LOONGARCH_SOFT_FLOAT
+        bool "Use soft-float"
+        #default y
+        select BR2_SOFT_FLOAT
+        help
+          If your target CPU does not have a Floating Point Unit (FPU)
+          or a kernel FPU emulator, but you still wish to support
+          floating point functions, then everything will need to be
+          compiled with soft floating point support (-msoft-float).
+
+
+# vim: ft=kconfig
+# -*- mode:kconfig; -*-
diff --git a/package/glibc/Config.in b/package/glibc/Config.in
index 71c50504ac..d8325610f5 100644
--- a/package/glibc/Config.in
+++ b/package/glibc/Config.in
@@ -21,6 +21,7 @@ config BR2_PACKAGE_GLIBC_ARCH_SUPPORTS
      default y if BR2_microblaze
      default y if BR2_nios2
      default y if BR2_arc && BR2_ARC_ATOMIC_EXT
+    default y if BR2_loongarch64
      depends on !BR2_powerpc_SPE
      depends on BR2_RISCV_ISA_RVA || !BR2_riscv
      depends on BR2_USE_MMU
diff --git a/support/gnuconfig/config.sub b/support/gnuconfig/config.sub
index 9bc49a7e92..c751ddf15a 100755
--- a/support/gnuconfig/config.sub
+++ b/support/gnuconfig/config.sub
@@ -164,7 +164,7 @@ case $1 in
                          basic_os=$field2
                          ;;
                      # Manufacturers
-                    dec* | mips* | sequent* | encore* | pc533* | sgi* | 
sony* \
+                    dec* | mips* | loongarch* | sequent* | encore* | 
pc533* | sgi* | sony* \
                      | att* | 7300* | 3300* | delta* | motorola* | 
sun[234]* \
                      | unicom* | ibm* | next | hp | isi* | apollo | 
altos* \
                      | convergent* | ncr* | news | 32* | 3600* | 3100* \
@@ -632,6 +632,11 @@ case $1 in
                  basic_machine=ymp-cray
                  basic_os=unicos
                  ;;
+            loongarch)
+                basic_machine=loongarch-loongson
+                basic_os=
+                ;;
+
              *)
                  basic_machine=$1
                  basic_os=
@@ -1211,6 +1216,7 @@ case $cpu-$vendor in
              | mipsisa64sr71k | mipsisa64sr71kel \
              | mipsr5900 | mipsr5900el \
              | mipstx39 | mipstx39el \
+            | loongarch | loongarch64 \
              | mmix \
              | mn10200 | mn10300 \
              | moxie \
@@ -1253,7 +1259,8 @@ case $cpu-$vendor in
              | x86 | x86_64 | xc16x | xgate | xps100 \
              | xstormy16 | xtensa* \
              | ymp \
-            | z8k | z80)
+            | z8k | z80 \
+            | loongarch | loongarch64)
                  ;;

              *)
diff --git a/toolchain/Config.in b/toolchain/Config.in
index 4947ab3aae..a4939af6fb 100644
--- a/toolchain/Config.in
+++ b/toolchain/Config.in
@@ -24,7 +24,7 @@ config BR2_TOOLCHAIN_USES_UCLIBC
      # architectures
      select BR2_TOOLCHAIN_HAS_UCONTEXT if BR2_ARM_CPU_HAS_ARM || BR2_i386 \
          || BR2_mips || BR2_mipsel || BR2_mips64 || BR2_mips64el \
-        || BR2_sparc || BR2_x86_64
+        || BR2_sparc || BR2_x86_64 || BR2_loongarch64
      select BR2_TOOLCHAIN_SUPPORTS_PIE if !BR2_m68k && !BR2_microblaze 
&& !BR2_STATIC_LIBS

  config BR2_TOOLCHAIN_USES_MUSL
-- 
2.30.2

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-12-05 12:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-05  9:37 [Buildroot] [PATCH v2] buildroot: Add basic support for LoongArch architecture (toolchain only) duan
2022-12-05 12:39 ` Thomas Petazzoni via buildroot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.