arch: add support for RISC-V 32-bit (riscv32) architecture
PATCH v4 1/3 arch: add support for RISC-V 32-bit (riscv32) architecture
This enables a riscv32 system to be built with a Buildroot generated toolchain (gcc >= 7.x, binutils >= 2.30, glibc only).
This requires a custom version of glibc 2.26 from the riscv-glibc repository. Note that there are no tags in this repository, so the glibc version just consists of the 40 character commit id string.
Thanks to Fabrice Bellard for pointing me towards the 32-bit glibc repository and for providing the necessary patch to get it to build.
---
Changes v3 -> v4:
- added choice for selecting 32-bit or 64-bit in Config.in.riscv This provides a new variable BR2_RISCV_32
Changes v2 -> v3:
- updated the autobuild configuration for RISC-V 64-bit as the default RISC-V configuration is now 32-bit
Changes v1 -> v2:
- regenerated the glibc patch correctly (Romain)
- modified the conditional test for RISC-V 32-bit in glibc.mk to use the more consistent style for multiple variables (Romain)
--- arch/Config.in.riscv | 31 +++++++++- arch/arch.mk.riscv | 4 +- configs/qemu_riscv64_virt_defconfig | 1 + ...C-V-32-bit-build-of-riscv-glibc-2.26.patch | 59 +++++++++++++++++++ .../glibc.hash | 7 +++ package/glibc/glibc.mk | 7 +++ .../br-riscv64-internal-glibc.config | 1 + 7 files changed, 106 insertions(+), 4 deletions(-) create mode 100644 package/glibc/4e2943456e690d89f48e6e710757dd09404b0c9a/0001-Fix-RISC-V-32-bit-build-of-riscv-glibc-2.26.patch create mode 100644 package/glibc/4e2943456e690d89f48e6e710757dd09404b0c9a/glibc.hash
arch/Config.in.riscv +28 -3
@@ -65,14 +65,35 @@ config BR2_RISCV_ISA_CUSTOM_RVC select BR2_RISCV_ISA_RVC endif +choice + prompt "Target Architecture Size" + default BR2_RISCV_64 + +config BR2_RISCV_32 + bool "32-bit" + config BR2_RISCV_64 - bool - default y + bool "64-bit" select BR2_ARCH_IS_64 +endchoice + choice prompt "Target ABI" - default BR2_RISCV_ABI_LP64 + default BR2_RISCV_ABI_ILP32 if !BR2_ARCH_IS_64 + default BR2_RISCV_ABI_LP64 if BR2_ARCH_IS_64 + +config BR2_RISCV_ABI_ILP32 + bool "ilp32" + depends on !BR2_ARCH_IS_64 + +config BR2_RISCV_ABI_ILP32F + bool "ilp32f" + depends on !BR2_ARCH_IS_64 && BR2_RISCV_ISA_RVF + +config BR2_RISCV_ABI_ILP32D + bool "ilp32d" + depends on !BR2_ARCH_IS_64 && BR2_RISCV_ISA_RVD config BR2_RISCV_ABI_LP64 bool "lp64"
@@ -88,12 +109,16 @@ config BR2_RISCV_ABI_LP64D endchoice config BR2_ARCH + default "riscv32" if !BR2_ARCH_IS_64 default "riscv64" if BR2_ARCH_IS_64 config BR2_ENDIAN default "LITTLE" config BR2_GCC_TARGET_ABI + default "ilp32" if BR2_RISCV_ABI_ILP32 + default "ilp32f" if BR2_RISCV_ABI_ILP32F + default "ilp32d" if BR2_RISCV_ABI_ILP32D default "lp64" if BR2_RISCV_ABI_LP64 default "lp64f" if BR2_RISCV_ABI_LP64F default "lp64d" if BR2_RISCV_ABI_LP64D
arch/arch.mk.riscv +3 -1
@@ -5,8 +5,10 @@ ifeq ($(BR2_riscv),y) -ifeq ($(BR2_ARCH_IS_64),y) +ifeq ($(BR2_RISCV_64),y) GCC_TARGET_ARCH := rv64i +else +GCC_TARGET_ARCH := rv32i endif ifeq ($(BR2_RISCV_ISA_RVM),y)
configs/qemu_riscv64_virt_defconfig +1 -0
@@ -1,5 +1,6 @@ # Architecture BR2_riscv=y +BR2_RISCV_64=y # System BR2_SYSTEM_DHCP="eth0"
package/glibc/4e2943456e690d89f48e6e710757dd09404b0c9a/0001-Fix-RISC-V-32-bit-build-of-riscv-glibc-2.26.patch new file +59 -0
59 lines not on this page · raw message
package/glibc/4e2943456e690d89f48e6e710757dd09404b0c9a/glibc.hash new file +7 -0
@@ -0,0 +1,7 @@ +# Locally calculated (fetched from Github) +sha256 a40f908125135bad2cf92c18d07ad25b3091b161b3a5d3aea46c23ffd2ac90b8 glibc-4e2943456e690d89f48e6e710757dd09404b0c9a.tar.gz + +# Hashes for license files +sha256 8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643 COPYING +sha256 dc626520dcd53a22f727af3ee42c770e56c97a64fe3adb063799d8ab032fe551 COPYING.LIB +sha256 61abdd6930c9c599062d89e916b3e7968783879b6be0ee1c6229dd6169def431 LICENSES
package/glibc/glibc.mk +7 -0
@@ -7,6 +7,9 @@ ifeq ($(BR2_arc),y) GLIBC_VERSION = arc-2018.03-release GLIBC_SITE = $(call github,foss-for-synopsys-dwc-arc-processors,glibc,$(GLIBC_VERSION)) +else ifeq ($(BR2_RISCV_32),y) +GLIBC_VERSION = 4e2943456e690d89f48e6e710757dd09404b0c9a +GLIBC_SITE = $(call github,riscv,riscv-glibc,$(GLIBC_VERSION)) else # Generate version string using: # git describe --match 'glibc-*' --abbrev=40 origin/release/MAJOR.MINOR/master
@@ -79,7 +82,11 @@ GLIBC_CONF_ENV = \ # Override the default library locations of /lib64/<abi> and # /usr/lib64/<abi>/ for RISC-V. ifeq ($(BR2_riscv),y) +ifeq ($(BR2_RISCV_64),y) GLIBC_CONF_ENV += libc_cv_slibdir=/lib64 libc_cv_rtlddir=/lib +else +GLIBC_CONF_ENV += libc_cv_slibdir=/lib32 libc_cv_rtlddir=/lib +endif endif # Even though we use the autotools-package infrastructure, we have to
support/config-fragments/autobuild/br-riscv64-internal-glibc.config +1 -0
@@ -1,2 +1,3 @@ BR2_riscv=y +BR2_RISCV_64=y BR2_TOOLCHAIN_BUILDROOT_GLIBC=y
Signature · 1 line
2.17.1
PATCH v4 2/3 configs/qemu: add qemu_riscv32_virt_defconfig
Add RISC-V 32-bit defconfig for QEMU virt machine.
Tested with QEMU 2.12.1
---
Changes v3 -> v4:
- set new variable BR2_RISCV_32 in qemu_riscv32_virt_defconfig
--- board/qemu/riscv32-virt/linux.config | 23 +++++++++++++++++++++++ board/qemu/riscv32-virt/readme.txt | 7 +++++++ configs/qemu_riscv32_virt_defconfig | 25 +++++++++++++++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 board/qemu/riscv32-virt/linux.config create mode 100644 board/qemu/riscv32-virt/readme.txt create mode 100644 configs/qemu_riscv32_virt_defconfig
board/qemu/riscv32-virt/linux.config new file +23 -0
@@ -0,0 +1,23 @@ +CONFIG_ARCH_RV32I=y +CONFIG_SMP=y +CONFIG_NR_CPUS=8 +CONFIG_PCI=y +CONFIG_SYSVIPC=y +CONFIG_NET=y +CONFIG_PACKET=y +CONFIG_UNIX=y +CONFIG_INET=y +# CONFIG_WIRELESS is not set +CONFIG_VIRTIO_BLK=y +CONFIG_NETDEVICES=y +CONFIG_VIRTIO_NET=y +# CONFIG_ETHERNET is not set +# CONFIG_WLAN is not set +CONFIG_SERIAL_8250=y +CONFIG_SERIAL_8250_CONSOLE=y +CONFIG_SERIAL_OF_PLATFORM=y +CONFIG_VIRT_DRIVERS=y +CONFIG_VIRTIO_MMIO=y +CONFIG_EXT2_FS=y +CONFIG_EXT4_FS=y +CONFIG_TMPFS=y
board/qemu/riscv32-virt/readme.txt new file +7 -0
@@ -0,0 +1,7 @@ +Run the emulation with: + + qemu-system-riscv32 -M virt -kernel output/images/bbl -append "root=/dev/vda ro console=ttyS0" -drive file=output/images/rootfs.ext2,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 -netdev user,id=net0 -device virtio-net-device,netdev=net0 -nographic + +The login prompt will appear in the terminal that started Qemu. + +Tested with QEMU 2.12.1
configs/qemu_riscv32_virt_defconfig new file +25 -0
@@ -0,0 +1,25 @@ +# Architecture +BR2_riscv=y +BR2_RISCV_32=y + +# System +BR2_SYSTEM_DHCP="eth0" + +# Filesystem +BR2_TARGET_ROOTFS_EXT2=y +BR2_TARGET_GENERIC_GETTY=y +BR2_TARGET_GENERIC_GETTY_PORT="ttyS0" + +# Linux headers same as kernel, a 4.15 series +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_15=y + +# Kernel +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_GIT=y +BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/riscv/riscv-linux.git" +BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="fe92d7905c6ea0ebeabeb725b8040754ede7c220" +BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y +BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/riscv32-virt/linux.config" + +# Bootloader +BR2_TARGET_RISCV_PK=y
Signature · 1 line
2.17.1
PATCH v4 2/3 configs/qemu: add qemu_riscv32_virt_defconfig
Mark,
Quoted 6 lines · Mark Corbin
Add RISC-V 32-bit defconfig for QEMU virt machine.
Tested with QEMU 2.12.1
Signed-off-by Mark Corbin <[email protected]>
(Tested v3 before the variable rework)
Quoted 93 lines
---
Changes v3 -> v4:
- set new variableBR2_RISCV_32inqemu_riscv32_virt_defconfig--- board/qemu/riscv32-virt/linux.config | 23 +++++++++++++++++++++++ board/qemu/riscv32-virt/readme.txt | 7 +++++++ configs/qemu_riscv32_virt_defconfig | 25 +++++++++++++++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 board/qemu/riscv32-virt/linux.config create mode 100644 board/qemu/riscv32-virt/readme.txt create mode 100644 configs/qemu_riscv32_virt_defconfigboard/qemu/riscv32-virt/linux.config new file +23
-0@@ -0,0 +1,23 @@ +CONFIG_ARCH_RV32I=y +CONFIG_SMP=y +CONFIG_NR_CPUS=8 +CONFIG_PCI=y +CONFIG_SYSVIPC=y +CONFIG_NET=y +CONFIG_PACKET=y +CONFIG_UNIX=y +CONFIG_INET=y +# CONFIG_WIRELESS is not set +CONFIG_VIRTIO_BLK=y +CONFIG_NETDEVICES=y +CONFIG_VIRTIO_NET=y +# CONFIG_ETHERNET is not set +# CONFIG_WLAN is not set +CONFIG_SERIAL_8250=y +CONFIG_SERIAL_8250_CONSOLE=y +CONFIG_SERIAL_OF_PLATFORM=y +CONFIG_VIRT_DRIVERS=y +CONFIG_VIRTIO_MMIO=y +CONFIG_EXT2_FS=y +CONFIG_EXT4_FS=y +CONFIG_TMPFS=yboard/qemu/riscv32-virt/readme.txt new file +7
-0@@ -0,0 +1,7 @@ +Run the emulation with: + + qemu-system-riscv32 -M virt -kernel output/images/bbl -append "root=/dev/vda ro console=ttyS0" -drive file=output/images/rootfs.ext2,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 -netdev user,id=net0 -device virtio-net-device,netdev=net0 -nographic + +The login prompt will appear in the terminal that started Qemu. + +Tested with QEMU 2.12.1configs/qemu_riscv32_virt_defconfig new file +25
-1@@ -0,0 +1,25 @@ +# Architecture +BR2_riscv=y +BR2_RISCV_32=y + +# System +BR2_SYSTEM_DHCP="eth0" + +# Filesystem +BR2_TARGET_ROOTFS_EXT2=y +BR2_TARGET_GENERIC_GETTY=y +BR2_TARGET_GENERIC_GETTY_PORT="ttyS0" + +# Linux headers same as kernel, a 4.15 series +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_15=y + +# Kernel +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_GIT=y +BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/riscv/riscv-linux.git" +BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="fe92d7905c6ea0ebeabeb725b8040754ede7c220" +BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y +BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/riscv32-virt/linux.config" + +# Bootloader +BR2_TARGET_RISCV_PK=y --2.17.1
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 8 lines
Matthew L Weber / Pr Software Engineer Airborne Information Systems / RC Linux Secure Platforms MS 131-100, C Ave NE, Cedar Rapids, IA, 52498, USA www.rockwellcollins.com Note: Any Export License Required Information and License Restricted Third Party Intellectual Property (TPIP) content must be encrypted and sent to matthew.weber at corp.rockwellcollins.com.
Thomas Petazzoni
AppliedPATCH v4 2/3 configs/qemu: add qemu_riscv32_virt_defconfig
In reply to Mark CorbinHello,
Quoted 9 lines · Mark Corbin
Add RISC-V 32-bit defconfig for QEMU virt machine.
Tested with QEMU 2.12.1
Signed-off-by Mark Corbin <[email protected]>---
Changes v3 -> v4:
- set new variableBR2_RISCV_32inqemu_riscv32_virt_defconfig
Quoted 8 lines
--- board/qemu/riscv32-virt/linux.config | 23 +++++++++++++++++++++++ board/qemu/riscv32-virt/readme.txt | 7 +++++++ configs/qemu_riscv32_virt_defconfig | 25 +++++++++++++++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 board/qemu/riscv32-virt/linux.config create mode 100644 board/qemu/riscv32-virt/readme.txt create mode 100644 configs/qemu_riscv32_virt_defconfig
Applied to master, thanks.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH v4 3/3 support/config-fragments: add RISC-V 32-bit to autobuild configs
In reply to Mark CorbinAdd a minimal RISC-V 32-bit autobuild configuration for the internal toolchain with glibc.
---
Changes v3 -> v4:
- set new variable BR2_RISCV_32 in br-riscv32-internal-glibc.config
--- .../autobuild/br-riscv32-internal-glibc.config | 3 +++ support/config-fragments/autobuild/toolchain-configs.csv | 1 + 2 files changed, 4 insertions(+) create mode 100644 support/config-fragments/autobuild/br-riscv32-internal-glibc.config
support/config-fragments/autobuild/br-riscv32-internal-glibc.config new file +3 -0
@@ -0,0 +1,3 @@ +BR2_riscv=y +BR2_RISCV_32=y +BR2_TOOLCHAIN_BUILDROOT_GLIBC=y
support/config-fragments/autobuild/toolchain-configs.csv +1 -0
@@ -51,6 +51,7 @@ support/config-fragments/autobuild/br-powerpc64le-power8-glibc.config,x86_64 support/config-fragments/autobuild/br-powerpc64-power7-glibc.config,x86_64 support/config-fragments/autobuild/br-powerpc-e500mc-full.config,x86_64 support/config-fragments/autobuild/br-powerpc-internal-full.config,any +support/config-fragments/autobuild/br-riscv32-internal-glibc.config,any support/config-fragments/autobuild/br-riscv64-internal-glibc.config,any support/config-fragments/autobuild/br-sh4-full.config,x86_64 support/config-fragments/autobuild/br-sparc-uclibc.config,x86_64
Signature · 1 line
2.17.1
PATCH v4 3/3 support/config-fragments: add RISC-V 32-bit to autobuild configs
Mark,
Quoted 5 lines · Mark Corbin
Add a minimal RISC-V 32-bit autobuild configuration for the internal toolchain with glibc.
Signed-off-by Mark Corbin <[email protected]>
(Tested v3 before the variable rework)
Quoted 38 lines
---
Changes v3 -> v4:
- set new variableBR2_RISCV_32in br-riscv32-internal-glibc.config--- .../autobuild/br-riscv32-internal-glibc.config | 3 +++ support/config-fragments/autobuild/toolchain-configs.csv | 1 + 2 files changed, 4 insertions(+) create mode 100644 support/config-fragments/autobuild/br-riscv32-internal-glibc.configsupport/config-fragments/autobuild/br-riscv32-internal-glibc.config new file +3
-0@@ -0,0 +1,3 @@ +BR2_riscv=y +BR2_RISCV_32=y +BR2_TOOLCHAIN_BUILDROOT_GLIBC=ysupport/config-fragments/autobuild/toolchain-configs.csv +1
-1@@ -51,6 +51,7 @@ support/config-fragments/autobuild/br-powerpc64le-power8-glibc.config,x86_64 support/config-fragments/autobuild/br-powerpc64-power7-glibc.config,x86_64 support/config-fragments/autobuild/br-powerpc-e500mc-full.config,x86_64 support/config-fragments/autobuild/br-powerpc-internal-full.config,any +support/config-fragments/autobuild/br-riscv32-internal-glibc.config,any support/config-fragments/autobuild/br-riscv64-internal-glibc.config,any support/config-fragments/autobuild/br-sh4-full.config,x86_64 support/config-fragments/autobuild/br-sparc-uclibc.config,x86_64 --2.17.1
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 8 lines
Matthew L Weber / Pr Software Engineer Airborne Information Systems / RC Linux Secure Platforms MS 131-100, C Ave NE, Cedar Rapids, IA, 52498, USA www.rockwellcollins.com Note: Any Export License Required Information and License Restricted Third Party Intellectual Property (TPIP) content must be encrypted and sent to matthew.weber at corp.rockwellcollins.com.
Thomas Petazzoni
AppliedPATCH v4 3/3 support/config-fragments: add RISC-V 32-bit to autobuild configs
In reply to Mark CorbinHello,
Quoted 5 lines · Mark Corbin
Add a minimal RISC-V 32-bit autobuild configuration for the internal toolchain with glibc.
Signed-off-by Mark Corbin <[email protected]>
Quoted 8 lines
---
Changes v3 -> v4:
- set new variableBR2_RISCV_32in br-riscv32-internal-glibc.config--- .../autobuild/br-riscv32-internal-glibc.config | 3 +++ support/config-fragments/autobuild/toolchain-configs.csv | 1 + 2 files changed, 4 insertions(+) create mode 100644 support/config-fragments/autobuild/br-riscv32-internal-glibc.config
Applied to master, thanks.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH v4 1/3 arch: add support for RISC-V 32-bit (riscv32) architecture
In reply to Mark CorbinMark,
Quoted 4 lines · Mark Corbin
This enables a riscv32 system to be built with a Buildroot generated toolchain (gcc >= 7.x, binutils >= 2.30, glibc only).
Quoted 8 lines
This requires a custom version of glibc 2.26 from the riscv-glibc repository. Note that there are no tags in this repository, so the glibc version just consists of the 40 character commit id string.
Thanks to Fabrice Bellard for pointing me towards the 32-bit glibc repository and for providing the necessary patch to get it to build.
Signed-off-by Mark Corbin <[email protected]>
(Tested v3 before the variable rework)
Quoted 231 lines
---
Changes v3 -> v4:
- added choice for selecting 32-bit or 64-bit in Config.in.riscv This provides a new variableBR2_RISCV_32Changes v2 -> v3:
- updated the autobuild configuration for RISC-V 64-bit as the default RISC-V configuration is now 32-bitChanges v1 -> v2:
- regenerated the glibc patch correctly (Romain)
- modified the conditional test for RISC-V 32-bit in glibc.mk to use the more consistent style for multiple variables (Romain)--- arch/Config.in.riscv | 31 +++++++++- arch/arch.mk.riscv | 4 +- configs/qemu_riscv64_virt_defconfig | 1 + ...C-V-32-bit-build-of-riscv-glibc-2.26.patch | 59 +++++++++++++++++++ .../glibc.hash | 7 +++ package/glibc/glibc.mk | 7 +++ .../br-riscv64-internal-glibc.config | 1 + 7 files changed, 106 insertions(+), 4 deletions(-) create mode 100644 package/glibc/4e2943456e690d89f48e6e710757dd09404b0c9a/0001-Fix-RISC-V-32-bit-build-of-riscv-glibc-2.26.patch create mode 100644 package/glibc/4e2943456e690d89f48e6e710757dd09404b0c9a/glibc.hasharch/Config.in.riscv +28
-3@@ -65,14 +65,35 @@ config BR2_RISCV_ISA_CUSTOM_RVC select BR2_RISCV_ISA_RVC endif +choice + prompt "Target Architecture Size" + default BR2_RISCV_64 + +config BR2_RISCV_32 + bool "32-bit" + config BR2_RISCV_64 - bool - default y + bool "64-bit" select BR2_ARCH_IS_64 +endchoice + choice prompt "Target ABI" - default BR2_RISCV_ABI_LP64 + default BR2_RISCV_ABI_ILP32 if !BR2_ARCH_IS_64 + default BR2_RISCV_ABI_LP64 if BR2_ARCH_IS_64 + +config BR2_RISCV_ABI_ILP32 + bool "ilp32" + depends on !BR2_ARCH_IS_64 + +config BR2_RISCV_ABI_ILP32F + bool "ilp32f" + depends on !BR2_ARCH_IS_64 && BR2_RISCV_ISA_RVF + +config BR2_RISCV_ABI_ILP32D + bool "ilp32d" + depends on !BR2_ARCH_IS_64 && BR2_RISCV_ISA_RVD config BR2_RISCV_ABI_LP64 bool "lp64"@@ -88,12 +109,16 @@ config BR2_RISCV_ABI_LP64D endchoice config BR2_ARCH + default "riscv32" if !BR2_ARCH_IS_64 default "riscv64" if BR2_ARCH_IS_64 config BR2_ENDIAN default "LITTLE" config BR2_GCC_TARGET_ABI + default "ilp32" if BR2_RISCV_ABI_ILP32 + default "ilp32f" if BR2_RISCV_ABI_ILP32F + default "ilp32d" if BR2_RISCV_ABI_ILP32D default "lp64" if BR2_RISCV_ABI_LP64 default "lp64f" if BR2_RISCV_ABI_LP64F default "lp64d" if BR2_RISCV_ABI_LP64Darch/arch.mk.riscv +3
-1@@ -5,8 +5,10 @@ ifeq ($(BR2_riscv),y) -ifeq ($(BR2_ARCH_IS_64),y) +ifeq ($(BR2_RISCV_64),y) GCC_TARGET_ARCH := rv64i +else +GCC_TARGET_ARCH := rv32i endif ifeq ($(BR2_RISCV_ISA_RVM),y)configs/qemu_riscv64_virt_defconfig +1
-0@@ -1,5 +1,6 @@ # Architecture BR2_riscv=y +BR2_RISCV_64=y # System BR2_SYSTEM_DHCP="eth0"package/glibc/4e2943456e690d89f48e6e710757dd09404b0c9a/0001-Fix-RISC-V-32-bit-build-of-riscv-glibc-2.26.patch new file +59
-0@@ -0,0 +1,59 @@ +From 4909cfbbe8dd512b8fc0892859549c26e1b14d30 Mon Sep 17 00:00:00 2001 +From: Mark Corbin <[email protected]> +Date: Sun, 21 Oct 2018 10:38:18 +0100 +Subject: [PATCH 1/1] Fix RISC-V 32-bit build of riscv-glibc 2.26 + +This patch fixes two build errors with the 32-bit version of +glibc-2.26 from the riscv-glibc repository. + +A void reference to 'refsym' has been added to dl-runtime.c to avoid +an 'unused variable' error when building with '-Werror'. + +Some data types were hard-coded for 64-bit in ldsodefs.h. These have +been modified to allow 32-bit builds. + +This patch was provided by Fabrice Bellard as part of his RISC-V +Buildroot development source. + +Signed-off-by: Mark Corbin <[email protected]> +--- + elf/dl-runtime.c | 1 + + sysdeps/riscv/ldsodefs.h | 4 ++-- + 2 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/elf/dl-runtime.c b/elf/dl-runtime.c +index 51d3819d4a..e728e8907e 100644 +--- a/elf/dl-runtime.c ++++ b/elf/dl-runtime.c +@@ -146,6 +146,7 @@ _dl_fixup ( + if (__glibc_unlikely (GLRO(dl_bind_not))) + return value; + ++ (void)refsym; + return elf_machine_fixup_plt (l, result, refsym, sym, reloc, rel_addr, value); + } + +diff --git a/sysdeps/riscv/ldsodefs.h b/sysdeps/riscv/ldsodefs.h +index db993df80a..91e7a8c88f 100644 +--- a/sysdeps/riscv/ldsodefs.h ++++ b/sysdeps/riscv/ldsodefs.h +@@ -25,14 +25,14 @@ struct La_riscv_regs; + struct La_riscv_retval; + + #define ARCH_PLTENTER_MEMBERS \ +- Elf64_Addr (*riscv_gnu_pltenter) (Elf64_Sym *, unsigned int, \ ++ ElfW(Addr) (*riscv_gnu_pltenter) (ElfW(Sym) *, unsigned int, \ + uintptr_t *, uintptr_t *, \ + const struct La_riscv_regs *, \ + unsigned int *, const char *name, \ + long int *framesizep); + + #define ARCH_PLTEXIT_MEMBERS \ +- unsigned int (*riscv_gnu_pltexit) (Elf64_Sym *, unsigned int, \ ++ unsigned int (*riscv_gnu_pltexit) (ElfW(Sym) *, unsigned int, \ + uintptr_t *, uintptr_t *, \ + const struct La_riscv_regs *, \ + struct La_riscv_retval *, \ +-- +2.17.1 +package/glibc/4e2943456e690d89f48e6e710757dd09404b0c9a/glibc.hash new file +7
-0@@ -0,0 +1,7 @@ +# Locally calculated (fetched from Github) +sha256 a40f908125135bad2cf92c18d07ad25b3091b161b3a5d3aea46c23ffd2ac90b8 glibc-4e2943456e690d89f48e6e710757dd09404b0c9a.tar.gz + +# Hashes for license files +sha256 8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643 COPYING +sha256 dc626520dcd53a22f727af3ee42c770e56c97a64fe3adb063799d8ab032fe551 COPYING.LIB +sha256 61abdd6930c9c599062d89e916b3e7968783879b6be0ee1c6229dd6169def431 LICENSESpackage/glibc/glibc.mk +7
-0@@ -7,6 +7,9 @@ ifeq ($(BR2_arc),y) GLIBC_VERSION = arc-2018.03-release GLIBC_SITE = $(call github,foss-for-synopsys-dwc-arc-processors,glibc,$(GLIBC_VERSION)) +else ifeq ($(BR2_RISCV_32),y) +GLIBC_VERSION = 4e2943456e690d89f48e6e710757dd09404b0c9a +GLIBC_SITE = $(call github,riscv,riscv-glibc,$(GLIBC_VERSION)) else # Generate version string using: # git describe --match 'glibc-*' --abbrev=40 origin/release/MAJOR.MINOR/master@@ -79,7 +82,11 @@ GLIBC_CONF_ENV = \ # Override the default library locations of /lib64/<abi> and # /usr/lib64/<abi>/ for RISC-V. ifeq ($(BR2_riscv),y) +ifeq ($(BR2_RISCV_64),y) GLIBC_CONF_ENV += libc_cv_slibdir=/lib64 libc_cv_rtlddir=/lib +else +GLIBC_CONF_ENV += libc_cv_slibdir=/lib32 libc_cv_rtlddir=/lib +endif endif # Even though we use the autotools-package infrastructure, we have tosupport/config-fragments/autobuild/br-riscv64-internal-glibc.config +1
-1@@ -1,2 +1,3 @@ BR2_riscv=y +BR2_RISCV_64=y BR2_TOOLCHAIN_BUILDROOT_GLIBC=y --2.17.1
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 8 lines
Matthew L Weber / Pr Software Engineer Airborne Information Systems / RC Linux Secure Platforms MS 131-100, C Ave NE, Cedar Rapids, IA, 52498, USA www.rockwellcollins.com Note: Any Export License Required Information and License Restricted Third Party Intellectual Property (TPIP) content must be encrypted and sent to matthew.weber at corp.rockwellcollins.com.
Thomas Petazzoni
AppliedPATCH v4 1/3 arch: add support for RISC-V 32-bit (riscv32) architecture
In reply to Mark CorbinHello,
Quoted 7 lines · Mark Corbin
This enables a riscv32 system to be built with a Buildroot generated toolchain (gcc >= 7.x, binutils >= 2.30, glibc only).
This requires a custom version of glibc 2.26 from the riscv-glibc repository. Note that there are no tags in this repository, so the glibc version just consists of the 40 character commit id string.
Quoted 8 lines
Thanks to Fabrice Bellard for pointing me towards the 32-bit glibc repository and for providing the necessary patch to get it to build.
Signed-off-by Mark Corbin <[email protected]>---
Changes v3 -> v4:
- added choice for selecting 32-bit or 64-bit in Config.in.riscv This provides a new variableBR2_RISCV_32
Applied to master, thanks.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH v4 1/3 arch: add support for RISC-V 32-bit (riscv32) architecture
Hello Thomas
Quoted 13 lines · Thomas Petazzoni
Hello,
Quoted 10 lines · Mark Corbin
This enables a riscv32 system to be built with a Buildroot generated toolchain (gcc >= 7.x, binutils >= 2.30, glibc only).
This requires a custom version of glibc 2.26 from the riscv-glibc repository. Note that there are no tags in this repository, so the glibc version just consists of the 40 character commit id string.
Thanks to Fabrice Bellard for pointing me towards the 32-bit glibc repository and for providing the necessary patch to get it to build.
Quoted 6 lines
Quoted 5 lines
Signed-off-by Mark Corbin <[email protected]>---
Changes v3 -> v4:
- added choice for selecting 32-bit or 64-bit in Config.in.riscv This provides a new variableBR2_RISCV_32Applied to master, thanks.
Will you be adding the riscv32 autobuilder configuration patch too?
Thanks
Mark
Signature · 3 lines
Mark Corbin Embecosm Ltd. https://www.embecosm.com
PATCH v4 1/3 arch: add support for RISC-V 32-bit (riscv32) architecture
Hello,
Quoted 2 lines · Mark Corbin
Quoted 1 line
Applied to master, thanks.
Will you be adding the riscv32 autobuilder configuration patch too?
Sure, this patch is still pending, I'll take care of it soon.
Thanks,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH v4 1/3 arch: add support for RISC-V 32-bit (riscv32) architecture
In reply to Mark CorbinHello Mark,
Quoted 7 lines · Mark Corbin
This enables a riscv32 system to be built with a Buildroot generated toolchain (gcc >= 7.x, binutils >= 2.30, glibc only).
This requires a custom version of glibc 2.26 from the riscv-glibc repository. Note that there are no tags in this repository, so the glibc version just consists of the 40 character commit id string.
Quoted 8 lines
Thanks to Fabrice Bellard for pointing me towards the 32-bit glibc repository and for providing the necessary patch to get it to build.
Signed-off-by Mark Corbin <[email protected]>---
Changes v3 -> v4:
- added choice for selecting 32-bit or 64-bit in Config.in.riscv This provides a new variableBR2_RISCV_32
I'm sure you noticed through the autobuilder e-mails, but I wanted to point out that riscv32 is causing a number of build issues:
http://autobuild.buildroot.net/?arch=riscv32
Most of the ones I looked at are due to missing mcontext_t definition in glibc. Is this something you could have a look at ?
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH v4 1/3 arch: add support for RISC-V 32-bit (riscv32) architecture
Hello Thomas
Quoted 18 lines · Thomas Petazzoni
Hello Mark,
Quoted 7 lines · Mark Corbin
This enables a riscv32 system to be built with a Buildroot generated toolchain (gcc >= 7.x, binutils >= 2.30, glibc only).
This requires a custom version of glibc 2.26 from the riscv-glibc repository. Note that there are no tags in this repository, so the glibc version just consists of the 40 character commit id string.
Quoted 8 lines
Thanks to Fabrice Bellard for pointing me towards the 32-bit glibc repository and for providing the necessary patch to get it to build.
Signed-off-by Mark Corbin <[email protected]>---
Changes v3 -> v4:
- added choice for selecting 32-bit or 64-bit in Config.in.riscv This provides a new variableBR2_RISCV_32
Quoted 4 lines
I'm sure you noticed through the autobuilder e-mails, but I wanted to point out that riscv32 is causing a number of build issues:
Yes, I've seen these. I have re-checked the default qemu build and that still seems to work without any problems.
Quoted 3 lines
Most of the ones I looked at are due to missing
mcontext_tdefinition in glibc. Is this something you could have a look at ?
I'll take a look as soon as I can.
Regards
Mark
Signature · 3 lines
Mark Corbin Embecosm Ltd. https://www.embecosm.com