-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #109 from nathanchance/loongarch
Initial LoongArch support
- Loading branch information
Showing
11 changed files
with
261 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
44cced15a58505c93a87b215a632eba25f65560da64782fea50111f62b5ae86c buildroot-2023.02.2.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
BR2_loongarch64=y | ||
BR2_BINUTILS_VERSION_2_39_X=y | ||
BR2_GCC_VERSION_12_X=y | ||
BR2_TARGET_GENERIC_ROOT_PASSWD="root" | ||
BR2_TARGET_GENERIC_GETTY_PORT="ttyS0" | ||
BR2_ROOTFS_OVERLAY="../overlay-reboot" | ||
BR2_TARGET_ROOTFS_CPIO=y | ||
# BR2_TARGET_ROOTFS_TAR is not set |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
193 changes: 193 additions & 0 deletions
193
...12_duanzhiwei_buildroot_add_basic_support_for_loongarch_architecture_toolchain_only.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,193 @@ | ||
From git@z Thu Jan 1 00:00:00 1970 | ||
Subject: [PATCH v3] buildroot: Add basic support for LoongArch architecture | ||
(toolchain only) | ||
From: Zhiwei Duan <duanzhiwei@loongson.cn> | ||
Date: Mon, 12 Dec 2022 16:34:57 +0800 | ||
Message-Id: <20221212083457.8308-1-duanzhiwei@loongson.cn> | ||
MIME-Version: 1.0 | ||
Content-Type: text/plain; charset="utf-8" | ||
Content-Transfer-Encoding: 7bit | ||
|
||
With this patch, the buildroot can compile the rootfs of the loongarch architecture. | ||
Both external toolchain and buildroot toolchain can compile rootfs. | ||
buildroot toolchain: binutils>=2.38 GCC>=12 Linux>=5.19 glibc>=2.36. | ||
|
||
Signed-off-by: Zhiwei Duan <duanzhiwei@loongson.cn> | ||
Link: https://lore.kernel.org/r/20221212083457.8308-1-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.20.1 | ||
|
||
_______________________________________________ | ||
buildroot mailing list | ||
buildroot@buildroot.org | ||
https://lists.buildroot.org/mailman/listinfo/buildroot | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
20230609-194440 |
Binary file not shown.