Skip to contentSkip to conversation

toolchain/toolchain-buildroot: enable uclibc for riscv64

PATCH New Mark Corbin 3 participants 10 messages May 10, 2020 – Jul 27, 2020 RISC-V

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/3 toolchain/toolchain-buildroot: enable uclibc for riscv64

We can enable uclibc for RISC-V 64 bit now that it has been bumped from v1.0.32 to v1.0.34.

Uclibc has had basic support for RISC-V 64 bit since v1.0.31, but shared library and TLS/NPTL support has only been available since v1.0.33.

This update has been tested using qemu_riscv64_virt_defconfig and the Buildroot host QEMU.

---
Changes v1 -> v2:
- use BR2_RISCV_64 instead of (BR2_riscv && BR2_ARCH_IS_64) (Thomas P)

---
 package/uclibc/Config.in                |  1 +
 toolchain/toolchain-buildroot/Config.in | 13 +++++++------
 2 files changed, 8 insertions(+), 6 deletions(-)
package/uclibc/Config.in +1 -0
index de2885bc92..f4d4f06462 100644
@@ -101,6 +101,7 @@ config BR2_UCLIBC_TARGET_ARCH
 	default "mips"	   if BR2_mips || BR2_mipsel || BR2_mips64 || BR2_mips64el
 	default "or1k"     if BR2_or1k
 	default "powerpc"  if BR2_powerpc
+	default "riscv64"  if BR2_RISCV_64
 	default "sh"	   if BR2_sh
 	default "sparc"	   if BR2_sparc
 	default "xtensa"   if BR2_xtensa
toolchain/toolchain-buildroot/Config.in +7 -6
index 8c33b2b4dd..3b2da333a2 100644
@@ -27,12 +27,13 @@ choice
 
 config BR2_TOOLCHAIN_BUILDROOT_UCLIBC
 	bool "uClibc-ng"
-	depends on BR2_aarch64 || BR2_aarch64_be || BR2_arcle   || BR2_arceb  || \
-		   BR2_arm     || BR2_armeb    || \
-		   BR2_i386    || BR2_m68k   || BR2_microblaze || \
-		   BR2_mips    || BR2_mipsel || BR2_mips64 || BR2_mips64el || \
-		   BR2_or1k    || BR2_powerpc || BR2_sh2a   || BR2_sh4	   || \
-		   BR2_sh4eb   || BR2_sparc   || BR2_xtensa || BR2_x86_64
+	depends on BR2_aarch64 || BR2_aarch64_be || BR2_arcle      || BR2_arceb    || \
+		   BR2_arm     || BR2_armeb      || \
+		   BR2_i386    || BR2_m68k       || BR2_microblaze || \
+		   BR2_mips    || BR2_mipsel     || BR2_mips64     || BR2_mips64el || \
+		   BR2_or1k    || BR2_powerpc    || BR2_RISCV_64   || \
+		   BR2_sh2a    || BR2_sh4	 || BR2_sh4eb      || BR2_sparc    || \
+		   BR2_xtensa  || BR2_x86_64
 	select BR2_TOOLCHAIN_USES_UCLIBC
 	help
 	  This option selects uClibc-ng as the C library for the
Signature · 1 line
2.20.1
#1 lore raw

PATCH v2 2/3 support/config-fragments: add RISC-V 64-bit uclibc autobuild config

Add a RISC-V 64-bit autobuild configuration for the internal toolchain with uclibc.

---
Changes v1 -> v2:
- acknowledge that this only adds a uclibc autobuilder configuration and not a generic one (Thomas P)

---
 .../config-fragments/autobuild/br-riscv64-full-internal.config  | 2 ++
 1 file changed, 2 insertions(+)
 create mode 100644 support/config-fragments/autobuild/br-riscv64-full-internal.config
support/config-fragments/autobuild/br-riscv64-full-internal.config new file +2 -0
new file mode 100644
index 0000000000..c729eb55e9
@@ -0,0 +1,2 @@
+BR2_riscv=y
+BR2_TOOLCHAIN_BUILDROOT_CXX=y
Signature · 1 line
2.20.1
#2 lore raw

PATCH v2 2/3 support/config-fragments: add RISC-V 64-bit uclibc autobuild config

Le 10/05/2020 ? 17:43, Mark Corbin a ?crit?:

Quoted 20 lines

Add a RISC-V 64-bit autobuild configuration for the internal toolchain with uclibc.

---
Changes v1 -> v2:
- acknowledge that this only adds a uclibc autobuilder configuration and not a generic one (Thomas P)

---
 .../config-fragments/autobuild/br-riscv64-full-internal.config  | 2 ++
 1 file changed, 2 insertions(+)
 create mode 100644 support/config-fragments/autobuild/br-riscv64-full-internal.config
support/config-fragments/autobuild/br-riscv64-full-internal.config new file +0 -0
new file mode 100644
index 0000000000..c729eb55e9

support/config-fragments/autobuild/br-riscv64-full-internal.config line 2

Quoted 2 lines
support/config-fragments/autobuild/br-riscv64-full-internal.config new file +2 -0
@@ -0,0 +1,2 @@
+BR2_riscv=y
+BR2_TOOLCHAIN_BUILDROOT_CXX=y

With the first patch fixed:

Best regards,
Romain

#3 lore raw

PATCH v2 2/3 support/config-fragments: add RISC-V 64-bit uclibc autobuild config

In reply to Mark Corbin
Quoted 19 lines · On Sun, 10 May 2020 16:43:46 +0100 Mark Corbin <[email protected]> wrote:

Add a RISC-V 64-bit autobuild configuration for the internal toolchain with uclibc.

---
Changes v1 -> v2:
- acknowledge that this only adds a uclibc autobuilder configuration and not a generic one (Thomas P)

---
 .../config-fragments/autobuild/br-riscv64-full-internal.config  | 2 ++
 1 file changed, 2 insertions(+)
 create mode 100644 support/config-fragments/autobuild/br-riscv64-full-internal.config
support/config-fragments/autobuild/br-riscv64-full-internal.config new file +0 -0
new file mode 100644
index 0000000000..c729eb55e9

support/config-fragments/autobuild/br-riscv64-full-internal.config line 2

Quoted 2 lines
support/config-fragments/autobuild/br-riscv64-full-internal.config new file +2 -0
@@ -0,0 +1,2 @@
+BR2_riscv=y
+BR2_TOOLCHAIN_BUILDROOT_CXX=y

This was clearly not a "full" defconfig: you didn't had wchar/locale enabled, so I've added that.

Also, you had forgotten to update the CSV file that lists the toolchain used by the autobuilders, support/config-fragments/autobuild/toolchain-configs.csv, so I did that.

Applied with those changes. Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#4 lore raw

PATCH v2 3/3 support/config-fragments: use external riscv64 musl toolchain

In reply to Mark Corbin

Move to an external RISC-V 64 bit musl toolchain to ease the load on the autobuilders.

---
 .../autobuild/br-riscv64-internal-musl.config            | 3 ---
 .../config-fragments/autobuild/br-riscv64-musl.config    | 9 +++++++++
 2 files changed, 9 insertions(+), 3 deletions(-)
 delete mode 100644 support/config-fragments/autobuild/br-riscv64-internal-musl.config
 create mode 100644 support/config-fragments/autobuild/br-riscv64-musl.config
support/config-fragments/autobuild/br-riscv64-internal-musl.config deleted +0 -3
deleted file mode 100644
index 89e7afb276..0000000000
@@ -1,3 +0,0 @@
-BR2_riscv=y
-BR2_TOOLCHAIN_BUILDROOT_MUSL=y
-BR2_TOOLCHAIN_BUILDROOT_CXX=y
support/config-fragments/autobuild/br-riscv64-musl.config new file +9 -0
new file mode 100644
index 0000000000..fd6ef822aa
@@ -0,0 +1,9 @@
+BR2_riscv=y
+BR2_TOOLCHAIN_EXTERNAL=y
+BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
+BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y
+BR2_TOOLCHAIN_EXTERNAL_URL="http://autobuild.buildroot.net/toolchains/tarballs/br-riscv64-musl-2020.02.tar.bz2"
+BR2_TOOLCHAIN_EXTERNAL_GCC_9=y
+BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_19=y
+BR2_TOOLCHAIN_EXTERNAL_CUSTOM_MUSL=y
+BR2_TOOLCHAIN_EXTERNAL_CXX=y
Signature · 1 line
2.20.1
#5 lore raw

PATCH v2 3/3 support/config-fragments: use external riscv64 musl toolchain

Hi Mark,

Le 10/05/2020 ? 17:43, Mark Corbin a ?crit?:

Quoted 2 lines

Move to an external RISC-V 64 bit musl toolchain to ease the load on the autobuilders.

[toolchain downloaded and busybox built with this toolchain]

Best regards,
Romain

Quoted 34 lines
---
 .../autobuild/br-riscv64-internal-musl.config            | 3 ---
 .../config-fragments/autobuild/br-riscv64-musl.config    | 9 +++++++++
 2 files changed, 9 insertions(+), 3 deletions(-)
 delete mode 100644 support/config-fragments/autobuild/br-riscv64-internal-musl.config
 create mode 100644 support/config-fragments/autobuild/br-riscv64-musl.config
support/config-fragments/autobuild/br-riscv64-internal-musl.config deleted +0 -3
deleted file mode 100644
index 89e7afb276..0000000000
@@ -1,3 +0,0 @@
-BR2_riscv=y
-BR2_TOOLCHAIN_BUILDROOT_MUSL=y
-BR2_TOOLCHAIN_BUILDROOT_CXX=y
support/config-fragments/autobuild/br-riscv64-musl.config new file +9 -0
new file mode 100644
index 0000000000..fd6ef822aa
@@ -0,0 +1,9 @@
+BR2_riscv=y
+BR2_TOOLCHAIN_EXTERNAL=y
+BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
+BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y
+BR2_TOOLCHAIN_EXTERNAL_URL="http://autobuild.buildroot.net/toolchains/tarballs/br-riscv64-musl-2020.02.tar.bz2"
+BR2_TOOLCHAIN_EXTERNAL_GCC_9=y
+BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_19=y
+BR2_TOOLCHAIN_EXTERNAL_CUSTOM_MUSL=y
+BR2_TOOLCHAIN_EXTERNAL_CXX=y
#6 lore raw

PATCH v2 3/3 support/config-fragments: use external riscv64 musl toolchain

In reply to Mark Corbin
Quoted 10 lines · On Sun, 10 May 2020 16:43:47 +0100 Mark Corbin <[email protected]> wrote:

Move to an external RISC-V 64 bit musl toolchain to ease the load on the autobuilders.

---
 .../autobuild/br-riscv64-internal-musl.config            | 3 ---
 .../config-fragments/autobuild/br-riscv64-musl.config    | 9 +++++++++
 2 files changed, 9 insertions(+), 3 deletions(-)
 delete mode 100644 support/config-fragments/autobuild/br-riscv64-internal-musl.config
 create mode 100644 support/config-fragments/autobuild/br-riscv64-musl.config

Here as well, you had forgotten to update support/config-fragments/autobuild/toolchain-configs.csv, so I did that when applying. Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#7 lore raw

PATCH v2 1/3 toolchain/toolchain-buildroot: enable uclibc for riscv64

In reply to Mark Corbin

Hi Mark,

Le 10/05/2020 ? 17:43, Mark Corbin a ?crit?:

Quoted 9 lines

We can enable uclibc for RISC-V 64 bit now that it has been bumped from v1.0.32 to v1.0.34.

Uclibc has had basic support for RISC-V 64 bit since v1.0.31, but shared library and TLS/NPTL support has only been available since v1.0.33.

This update has been tested using qemu_riscv64_virt_defconfig and the Buildroot host QEMU.

Since uclibc-ng is the default libc in Buildroot, enabling riscv64 change implicitly the libc used by qemu_riscv64_virt_defconfig.

Before this patch qemu_riscv64_virt_defconfig used glibc, after it use uclibc-ng (like other defconfig does).

Maybe add a commit before this one enabling explicitly glibc in qemu_riscv64_virt_defconfig, then add this commit and finally a third commit switching qemu_riscv64_virt_defconfig from glibc to uclibc-ng.

Anyway it's good to see new architecture supported in uclibc-ng.

Best regards,
Romain

Quoted 48 lines

---
Changes v1 -> v2:
- use BR2_RISCV_64 instead of (BR2_riscv && BR2_ARCH_IS_64) (Thomas P)

---
 package/uclibc/Config.in                |  1 +
 toolchain/toolchain-buildroot/Config.in | 13 +++++++------
 2 files changed, 8 insertions(+), 6 deletions(-)
package/uclibc/Config.in +1 -0
index de2885bc92..f4d4f06462 100644
@@ -101,6 +101,7 @@ config BR2_UCLIBC_TARGET_ARCH
 	default "mips"	   if BR2_mips || BR2_mipsel || BR2_mips64 || BR2_mips64el
 	default "or1k"     if BR2_or1k
 	default "powerpc"  if BR2_powerpc
+	default "riscv64"  if BR2_RISCV_64
 	default "sh"	   if BR2_sh
 	default "sparc"	   if BR2_sparc
 	default "xtensa"   if BR2_xtensa
toolchain/toolchain-buildroot/Config.in +7 -6
index 8c33b2b4dd..3b2da333a2 100644
@@ -27,12 +27,13 @@ choice
 
 config BR2_TOOLCHAIN_BUILDROOT_UCLIBC
 	bool "uClibc-ng"
-	depends on BR2_aarch64 || BR2_aarch64_be || BR2_arcle   || BR2_arceb  || \
-		   BR2_arm     || BR2_armeb    || \
-		   BR2_i386    || BR2_m68k   || BR2_microblaze || \
-		   BR2_mips    || BR2_mipsel || BR2_mips64 || BR2_mips64el || \
-		   BR2_or1k    || BR2_powerpc || BR2_sh2a   || BR2_sh4	   || \
-		   BR2_sh4eb   || BR2_sparc   || BR2_xtensa || BR2_x86_64
+	depends on BR2_aarch64 || BR2_aarch64_be || BR2_arcle      || BR2_arceb    || \
+		   BR2_arm     || BR2_armeb      || \
+		   BR2_i386    || BR2_m68k       || BR2_microblaze || \
+		   BR2_mips    || BR2_mipsel     || BR2_mips64     || BR2_mips64el || \
+		   BR2_or1k    || BR2_powerpc    || BR2_RISCV_64   || \
+		   BR2_sh2a    || BR2_sh4	 || BR2_sh4eb      || BR2_sparc    || \
+		   BR2_xtensa  || BR2_x86_64
 	select BR2_TOOLCHAIN_USES_UCLIBC
 	help
 	  This option selects uClibc-ng as the C library for the
#8 lore raw

PATCH v2 1/3 toolchain/toolchain-buildroot: enable uclibc for riscv64

Le 13/07/2020 ? 23:50, Romain Naour a ?crit?:

Quoted 16 lines

Hi Mark,

Le 10/05/2020 ? 17:43, Mark Corbin a ?crit?:

Quoted 9 lines

We can enable uclibc for RISC-V 64 bit now that it has been bumped from v1.0.32 to v1.0.34.

Uclibc has had basic support for RISC-V 64 bit since v1.0.31, but shared library and TLS/NPTL support has only been available since v1.0.33.

This update has been tested using qemu_riscv64_virt_defconfig and the Buildroot host QEMU.

Since uclibc-ng is the default libc in Buildroot, enabling riscv64 change implicitly the libc used by qemu_riscv64_virt_defconfig.

Quoted 6 lines

Before this patch qemu_riscv64_virt_defconfig used glibc, after it use uclibc-ng (like other defconfig does).

Maybe add a commit before this one enabling explicitly glibc in qemu_riscv64_virt_defconfig, then add this commit and finally a third commit switching qemu_riscv64_virt_defconfig from glibc to uclibc-ng.

Same for hifive_unleashed_defconfig.

Best regards,
Romain

Quoted 55 lines

Anyway it's good to see new architecture supported in uclibc-ng.

Best regards,
Romain

Quoted 48 lines

---
Changes v1 -> v2:
- use BR2_RISCV_64 instead of (BR2_riscv && BR2_ARCH_IS_64) (Thomas P)

---
 package/uclibc/Config.in                |  1 +
 toolchain/toolchain-buildroot/Config.in | 13 +++++++------
 2 files changed, 8 insertions(+), 6 deletions(-)
package/uclibc/Config.in +1 -0
index de2885bc92..f4d4f06462 100644
@@ -101,6 +101,7 @@ config BR2_UCLIBC_TARGET_ARCH
 	default "mips"	   if BR2_mips || BR2_mipsel || BR2_mips64 || BR2_mips64el
 	default "or1k"     if BR2_or1k
 	default "powerpc"  if BR2_powerpc
+	default "riscv64"  if BR2_RISCV_64
 	default "sh"	   if BR2_sh
 	default "sparc"	   if BR2_sparc
 	default "xtensa"   if BR2_xtensa
toolchain/toolchain-buildroot/Config.in +7 -6
index 8c33b2b4dd..3b2da333a2 100644
@@ -27,12 +27,13 @@ choice
 
 config BR2_TOOLCHAIN_BUILDROOT_UCLIBC
 	bool "uClibc-ng"
-	depends on BR2_aarch64 || BR2_aarch64_be || BR2_arcle   || BR2_arceb  || \
-		   BR2_arm     || BR2_armeb    || \
-		   BR2_i386    || BR2_m68k   || BR2_microblaze || \
-		   BR2_mips    || BR2_mipsel || BR2_mips64 || BR2_mips64el || \
-		   BR2_or1k    || BR2_powerpc || BR2_sh2a   || BR2_sh4	   || \
-		   BR2_sh4eb   || BR2_sparc   || BR2_xtensa || BR2_x86_64
+	depends on BR2_aarch64 || BR2_aarch64_be || BR2_arcle      || BR2_arceb    || \
+		   BR2_arm     || BR2_armeb      || \
+		   BR2_i386    || BR2_m68k       || BR2_microblaze || \
+		   BR2_mips    || BR2_mipsel     || BR2_mips64     || BR2_mips64el || \
+		   BR2_or1k    || BR2_powerpc    || BR2_RISCV_64   || \
+		   BR2_sh2a    || BR2_sh4	 || BR2_sh4eb      || BR2_sparc    || \
+		   BR2_xtensa  || BR2_x86_64
 	select BR2_TOOLCHAIN_USES_UCLIBC
 	help
 	  This option selects uClibc-ng as the C library for the
#9 lore raw

PATCH v2 1/3 toolchain/toolchain-buildroot: enable uclibc for riscv64

In reply to Mark Corbin
Quoted 11 lines · On Sun, 10 May 2020 16:43:45 +0100 Mark Corbin <[email protected]> wrote:

We can enable uclibc for RISC-V 64 bit now that it has been bumped from v1.0.32 to v1.0.34.

Uclibc has had basic support for RISC-V 64 bit since v1.0.31, but shared library and TLS/NPTL support has only been available since v1.0.33.

This update has been tested using qemu_riscv64_virt_defconfig and the Buildroot host QEMU.

Quoted 8 lines

---
Changes v1 -> v2:
- use BR2_RISCV_64 instead of (BR2_riscv && BR2_ARCH_IS_64) (Thomas P)

---
 package/uclibc/Config.in                |  1 +
 toolchain/toolchain-buildroot/Config.in | 13 +++++++------
 2 files changed, 8 insertions(+), 6 deletions(-)

Applied to master, thanks.

Romain: in the end, I didn't change the existing defconfigs. We usually don't change/check them when we update gcc, glibc or binutils for example. The compiler/C library is pretty much independent from the specific board, so I didn't think it was worth changing the HiFive Unleashed board to use glibc.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com