Skip to contentSkip to conversation

package/glibc: Update glibc 32-bit RISC-V version

PATCH New Alistair Francis 4 participants 15 messages Mar 18, 2019 – Mar 19, 2019 RISC-V

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/5 package/glibc: Update glibc 32-bit RISC-V version

---
 .../glibc.hash                                |  2 +-
 ...C-V-32-bit-build-of-riscv-glibc-2.26.patch | 59 -------------------
 ...rror-that-breaks-RISC-V-architecture.patch | 39 ------------
 package/glibc/glibc.mk                        |  2 +-
 4 files changed, 2 insertions(+), 100 deletions(-)
 rename package/glibc/{4e2943456e690d89f48e6e710757dd09404b0c9a => 06983fe52cfe8e4779035c27e8cc5d2caab31531}/glibc.hash (71%)
 delete mode 100644 package/glibc/4e2943456e690d89f48e6e710757dd09404b0c9a/0001-Fix-RISC-V-32-bit-build-of-riscv-glibc-2.26.patch
 delete mode 100644 package/glibc/4e2943456e690d89f48e6e710757dd09404b0c9a/0002-Fix-mcontext_t-error-that-breaks-RISC-V-architecture.patch
package/glibc/06983fe52cfe8e4779035c27e8cc5d2caab31531/glibc.hash renamed from package/glibc/4e2943456e690d89f48e6e710757dd09404b0c9a/glibc.hash +1 -1
similarity index 71%
rename from package/glibc/4e2943456e690d89f48e6e710757dd09404b0c9a/glibc.hash
rename to package/glibc/06983fe52cfe8e4779035c27e8cc5d2caab31531/glibc.hash
index 3eb5e04e96..09ddc7be72 100644
@@ -1,5 +1,5 @@
 # Locally calculated (fetched from Github)
-sha256 a40f908125135bad2cf92c18d07ad25b3091b161b3a5d3aea46c23ffd2ac90b8  glibc-4e2943456e690d89f48e6e710757dd09404b0c9a.tar.gz
+sha256 703877c0df77fce00719fe55cc62b07bb8d5f44fdb704bbb1b0bf2cf38afe10a  glibc-06983fe52cfe8e4779035c27e8cc5d2caab31531.tar.gz
 
 # Hashes for license files
 sha256 8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643 COPYING
package/glibc/4e2943456e690d89f48e6e710757dd09404b0c9a/0001-Fix-RISC-V-32-bit-build-of-riscv-glibc-2.26.patch deleted +0 -59

59 lines not on this page · raw message

package/glibc/4e2943456e690d89f48e6e710757dd09404b0c9a/0002-Fix-mcontext_t-error-that-breaks-RISC-V-architecture.patch deleted +0 -39
deleted file mode 100644
index 961d5a1cb6..0000000000
@@ -1,39 +0,0 @@
-From 6b4520e13c2ed7fca725d5f5c879854cd7c96c19 Mon Sep 17 00:00:00 2001
-From: Mark Corbin <[email protected]>
-Date: Mon, 4 Feb 2019 10:35:27 +0000
-Subject: [PATCH] Fix mcontext_t error that breaks RISC-V architecture
- package builds
-
-The riscv-glibc repository version of glibc 2.26 will build for
-RISC-V 32bit, but when many packages are built against the resulting
-library an 'unknown type name mcontext_t' error is reported. The
-definition of mcontext_h in the ucontext.h header file needs to be
-moved outside of the '#ifdef __USE_MISC' structure to fix this
-issue.
-
-Signed-off-by: Mark Corbin <[email protected]>
----
- sysdeps/unix/sysv/linux/riscv/sys/ucontext.h | 3 +--
- 1 file changed, 1 insertion(+), 2 deletions(-)
-
-diff --git a/sysdeps/unix/sysv/linux/riscv/sys/ucontext.h b/sysdeps/unix/sysv/linux/riscv/sys/ucontext.h
-index 8f02f09106..b9dd04564a 100644
---- a/sysdeps/unix/sysv/linux/riscv/sys/ucontext.h
-+++ b/sysdeps/unix/sysv/linux/riscv/sys/ucontext.h
-@@ -48,12 +48,11 @@ typedef greg_t gregset_t[NGREG];
- 
- /* Container for floating-point state.  */
- typedef union __riscv_fp_state fpregset_t;
-+#endif
- 
- /* Context to describe whole processor state.  */
- typedef struct sigcontext mcontext_t;
- 
--#endif
--
- /* Userlevel context.  */
- typedef struct ucontext
-   {
--- 
-2.19.1
-
package/glibc/glibc.mk +1 -1
index cb867d4d5b..5ee53df2b2 100644
@@ -8,7 +8,7 @@ ifeq ($(BR2_arc),y)
 GLIBC_VERSION =  arc-2018.09-release
 GLIBC_SITE = $(call github,foss-for-synopsys-dwc-arc-processors,glibc,$(GLIBC_VERSION))
 else ifeq ($(BR2_RISCV_32),y)
-GLIBC_VERSION = 4e2943456e690d89f48e6e710757dd09404b0c9a
+GLIBC_VERSION = 06983fe52cfe8e4779035c27e8cc5d2caab31531
 GLIBC_SITE = $(call github,riscv,riscv-glibc,$(GLIBC_VERSION))
 else
 # Generate version string using:
Signature · 1 line
2.21.0
#1 lore raw

PATCH v2 2/5 configs: qemu_riscv32_virt: Upgrade to 4.20 kernel

---
 configs/qemu_riscv32_virt_defconfig | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
configs/qemu_riscv32_virt_defconfig +3 -3
index fb37da6a89..6f9a61b11c 100644
@@ -10,14 +10,14 @@ BR2_TARGET_GENERIC_GETTY_PORT="ttyS0"
 # Filesystem
 BR2_TARGET_ROOTFS_EXT2=y
 
-# Linux headers same as kernel, a 4.15 series
-BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_15=y
+# Linux headers same as kernel, a 4.20 series
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_20=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_CUSTOM_REPO_VERSION="8fe28cb58bcb235034b64cbbb7550a8a43fd88be"
 BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
 BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/riscv32-virt/linux.config"
 
Signature · 1 line
2.21.0
#2 lore raw

PATCH v2 2/5 configs: qemu_riscv32_virt: Upgrade to 4.20 kernel

Quoted 4 lines · On Mon, 18 Mar 2019 21:02:02 +0000 Alistair Francis <[email protected]>…
---
 configs/qemu_riscv32_virt_defconfig | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Applied to master, thanks.

Thomas

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

PATCH v2 2/5 configs: qemu_riscv32_virt: Upgrade to 4.20 kernel

In reply to Alistair Francis

Hello Alistair

Quoted 14 lines · Alistair Francis
---
 configs/qemu_riscv32_virt_defconfig | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
configs/qemu_riscv32_virt_defconfig +0 -1
index fb37da6a89..6f9a61b11c 100644
@@ -10,14 +10,14 @@ BR2_TARGET_GENERIC_GETTY_PORT="ttyS0"
 # Filesystem
 BR2_TARGET_ROOTFS_EXT2=y
 
-# Linux headers same as kernel, a 4.15 series

configs/qemu_riscv32_virt_defconfig BR2_TARGET_GENERIC_GETTY_PORT="ttyS0" · line 20

Quoted 10 lines
configs/qemu_riscv32_virt_defconfig +3 -2
-BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_15=y
+# Linux headers same as kernel, a 4.20 series
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_20=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_CUSTOM_REPO_VERSION="8fe28cb58bcb235034b64cbbb7550a8a43fd88be"

I wasn't sure that the 4.20 kernel worked for riscv32 under qemu which is probably why it wasn't bumped from 4.15 in January when the qemu_riscv64_virt_defconfig kernel version was.

How did you manage to test this? I've tried both qemu 2.12.0 and 3.1.0 and neither version will boot the resulting kernel.

Regards

Mark

Signature · 3 lines
Mark Corbin
Embecosm Ltd.
https://www.embecosm.com
#4 lore raw

PATCH v2 2/5 configs: qemu_riscv32_virt: Upgrade to 4.20 kernel

Quoted 33 lines · Mark Corbin

Hello Alistair

Quoted 14 lines · Alistair Francis
---
 configs/qemu_riscv32_virt_defconfig | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
configs/qemu_riscv32_virt_defconfig +0 -1
index fb37da6a89..6f9a61b11c 100644
@@ -10,14 +10,14 @@ BR2_TARGET_GENERIC_GETTY_PORT="ttyS0"
 # Filesystem
 BR2_TARGET_ROOTFS_EXT2=y
 
-# Linux headers same as kernel, a 4.15 series

configs/qemu_riscv32_virt_defconfig BR2_TARGET_GENERIC_GETTY_PORT="ttyS0" · line 20

Quoted 10 lines
configs/qemu_riscv32_virt_defconfig +3 -2
-BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_15=y
+# Linux headers same as kernel, a 4.20 series
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_20=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_CUSTOM_REPO_VERSION="8fe28cb58bcb235034b64cbbb7550a8a43fd88be"

I wasn't sure that the 4.20 kernel worked for riscv32 under qemu which is probably why it wasn't bumped from 4.15 in January when the qemu_riscv64_virt_defconfig kernel version was.

Quoted 2 lines

How did you manage to test this? I've tried both qemu 2.12.0 and 3.1.0 and neither version will boot the resulting kernel.

I just tested this again and here are my results. All running on QEMU 3.1.0 and using OpenSBI

With current master + my OpenSBI patches -> I can boot the 4.20 kernel, but it never gets to a login prompt.

With current master + my OpenSBI patches + defconfig update -> I can boot the 4.20 kernel and I get to a login prompt.

I did some of my original tests with an updated defconfig but I thought I tested without any changed. I'll send a patch to update the defconfig.

Alistair

Quoted 10 lines

Regards

Mark

--
Mark Corbin
Embecosm Ltd.
https://www.embecosm.com

#5 lore raw

PATCH v2 2/5 configs: qemu_riscv32_virt: Upgrade to 4.20 kernel

Quoted 44 lines · Alistair Francis
Quoted 33 lines · Mark Corbin

Hello Alistair

Quoted 14 lines · Alistair Francis
---
 configs/qemu_riscv32_virt_defconfig | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
configs/qemu_riscv32_virt_defconfig +0 -1
index fb37da6a89..6f9a61b11c 100644
@@ -10,14 +10,14 @@ BR2_TARGET_GENERIC_GETTY_PORT="ttyS0"
 # Filesystem
 BR2_TARGET_ROOTFS_EXT2=y
 
-# Linux headers same as kernel, a 4.15 series

configs/qemu_riscv32_virt_defconfig BR2_TARGET_GENERIC_GETTY_PORT="ttyS0" · line 20

Quoted 10 lines
configs/qemu_riscv32_virt_defconfig +3 -2
-BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_15=y
+# Linux headers same as kernel, a 4.20 series
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_20=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_CUSTOM_REPO_VERSION="8fe28cb58bcb235034b64cbbb7550a8a43fd88be"

I wasn't sure that the 4.20 kernel worked for riscv32 under qemu which is probably why it wasn't bumped from 4.15 in January when the qemu_riscv64_virt_defconfig kernel version was.

Quoted 2 lines

How did you manage to test this? I've tried both qemu 2.12.0 and 3.1.0 and neither version will boot the resulting kernel.

I just tested this again and here are my results. All running on QEMU 3.1.0 and using OpenSBI

With current master + my OpenSBI patches -> I can boot the 4.20 kernel, but it never gets to a login prompt.

Quoted 6 lines

With current master + my OpenSBI patches + defconfig update -> I can boot the 4.20 kernel and I get to a login prompt.

I did some of my original tests with an updated defconfig but I thought I tested without any changed. I'll send a patch to update the defconfig.

I even tested BBL with my v4 series that I'm about to send and that boots to a login prompt.

So everything should work with the updated config.

Alistair

Quoted 13 lines

Alistair

Quoted 10 lines

Regards

Mark

--
Mark Corbin
Embecosm Ltd.
https://www.embecosm.com

#6 lore raw

PATCH v2 2/5 configs: qemu_riscv32_virt: Upgrade to 4.20 kernel

In reply to Alistair Francis

Hello Alistair

Quoted 32 lines · Alistair Francis
Quoted 31 lines · Mark Corbin

Hello Alistair

Quoted 14 lines · Alistair Francis
---
 configs/qemu_riscv32_virt_defconfig | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
configs/qemu_riscv32_virt_defconfig +0 -1
index fb37da6a89..6f9a61b11c 100644
@@ -10,14 +10,14 @@ BR2_TARGET_GENERIC_GETTY_PORT="ttyS0"
 # Filesystem
 BR2_TARGET_ROOTFS_EXT2=y
 
-# Linux headers same as kernel, a 4.15 series

configs/qemu_riscv32_virt_defconfig BR2_TARGET_GENERIC_GETTY_PORT="ttyS0" · line 20

Quoted 10 lines
configs/qemu_riscv32_virt_defconfig +3 -2
-BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_15=y
+# Linux headers same as kernel, a 4.20 series
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_20=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_CUSTOM_REPO_VERSION="8fe28cb58bcb235034b64cbbb7550a8a43fd88be"

I wasn't sure that the 4.20 kernel worked for riscv32 under qemu which is probably why it wasn't bumped from 4.15 in January when the qemu_riscv64_virt_defconfig kernel version was.

Quoted 7 lines
Quoted 2 lines

How did you manage to test this? I've tried both qemu 2.12.0 and 3.1.0 and neither version will boot the resulting kernel.

I just tested this again and here are my results. All running on QEMU 3.1.0 and using OpenSBI

With current master + my OpenSBI patches -> I can boot the 4.20 kernel, but it never gets to a login prompt.

This is what happens for me when I build and test from master - no login prompt. I guess that it's because your qemu_riscv32_virt_defconfig kernel version update has been checked-in without the necessary opensbi or config updates.

Regards

Mark

Signature · 3 lines
Mark Corbin
Embecosm Ltd.
https://www.embecosm.com
#7 lore raw

PATCH v2 3/5 configs: qemu_riscv64_virt: Fix config layout

In reply to Alistair Francis

Fix the config layout, no functional change.

---
 configs/qemu_riscv64_virt_defconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
configs/qemu_riscv64_virt_defconfig +2 -2
index 65dbef4135..596edf2fcd 100644
@@ -4,11 +4,11 @@ BR2_RISCV_64=y
 
 # System
 BR2_SYSTEM_DHCP="eth0"
+BR2_TARGET_GENERIC_GETTY=y
+BR2_TARGET_GENERIC_GETTY_PORT="ttyS0"
 
 # Filesystem
 BR2_TARGET_ROOTFS_EXT2=y
-BR2_TARGET_GENERIC_GETTY=y
-BR2_TARGET_GENERIC_GETTY_PORT="ttyS0"
 
 # Linux headers same as kernel, a 4.20 series
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_20=y
Signature · 1 line
2.21.0
#8 lore raw

PATCH v2 3/5 configs: qemu_riscv64_virt: Fix config layout

Quoted 6 lines · On Mon, 18 Mar 2019 21:02:03 +0000 Alistair Francis <[email protected]>…

Fix the config layout, no functional change.

---
 configs/qemu_riscv64_virt_defconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Applied to master, thanks.

Thomas

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

PATCH v2 4/5 configs: qemu_riscv*: Build the kernel Image file

In reply to Alistair Francis
---
 configs/qemu_riscv32_virt_defconfig | 1 +
 configs/qemu_riscv64_virt_defconfig | 1 +
 linux/Config.in                     | 2 +-
 3 files changed, 3 insertions(+), 1 deletion(-)
configs/qemu_riscv32_virt_defconfig +1 -0
index 6f9a61b11c..f7e9a23106 100644
@@ -20,6 +20,7 @@ BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/riscv/riscv-linux.git"
 BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="8fe28cb58bcb235034b64cbbb7550a8a43fd88be"
 BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
 BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/riscv32-virt/linux.config"
+BR2_LINUX_KERNEL_IMAGE=y
 
 # Bootloader
 BR2_TARGET_RISCV_PK=y
configs/qemu_riscv64_virt_defconfig +1 -0
index 596edf2fcd..ae67979d29 100644
@@ -19,6 +19,7 @@ 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="8fe28cb58bcb235034b64cbbb7550a8a43fd88be"
 BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y
+BR2_LINUX_KERNEL_IMAGE=y
 
 # Bootloader
 BR2_TARGET_RISCV_PK=y
linux/Config.in +1 -1
index 818b94e1c0..dc10238053 100644
@@ -258,7 +258,7 @@ config BR2_LINUX_KERNEL_SIMPLEIMAGE
 
 config BR2_LINUX_KERNEL_IMAGE
 	bool "Image"
-	depends on BR2_aarch64
+	depends on BR2_aarch64 || BR2_riscv
 
 config BR2_LINUX_KERNEL_LINUX_BIN
 	bool "linux.bin"
Signature · 1 line
2.21.0
#10 lore raw

PATCH v2 4/5 configs: qemu_riscv*: Build the kernel Image file

Hello Alistair,

Quoted 1 line · On Mon, 18 Mar 2019 21:02:04 +0000 Alistair Francis <[email protected]>…

This commit should have a non-empty commit log, and should actually be split into to:

- One allowing to enable BR2_LINUX_KERNEL_IMAGE on RISC-V

- One moving the defconfig to using OpenSBI, which requires using the Image target if I understood correctly. As it is, the change to the defconfigs in this commit is pretty useless: the new Image is not generated. Worse: it probably breaks the defconfig because the Linux kernel build no longer installs $(BINARIES_DIR)/vmlinux, which is needed by riscv-pk. So your patch series is not bisectable.

Best regards,

Thomas

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

PATCH v2 5/5 boot: riscv: Initial commit of OpenSBI

In reply to Alistair Francis

OpenSBI is a much improved alternative to BBL (riscv-pk). Add OpenSBI support to buildroot.

OpenSBI is also set as the default boot loader for RISC-V.

---
 DEVELOPERS                          |  1 +
 board/qemu/riscv32-virt/readme.txt  | 10 ++++++---
 board/qemu/riscv64-virt/readme.txt  | 10 ++++++---
 boot/Config.in                      |  1 +
 boot/opensbi/Config.in              | 23 +++++++++++++++++++++
 boot/opensbi/opensbi.mk             | 32 +++++++++++++++++++++++++++++
 configs/qemu_riscv32_virt_defconfig |  4 +++-
 configs/qemu_riscv64_virt_defconfig |  4 +++-
 8 files changed, 77 insertions(+), 8 deletions(-)
 create mode 100644 boot/opensbi/Config.in
 create mode 100644 boot/opensbi/opensbi.mk
DEVELOPERS +1 -0
index c91325e284..72aca1a342 100644
@@ -123,6 +123,7 @@ F:	package/kvazaar/
 F:	package/v4l2loopback/
 
 N:	Alistair Francis <[email protected]>
+F:	boot/opensbi/
 F:	package/xen/
 
 N:	Alvaro G. M <[email protected]>
board/qemu/riscv32-virt/readme.txt +7 -3
index 2da99580e5..f73f4278de 100644
@@ -1,7 +1,11 @@
-Run the emulation with:
+Run Linux in 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
+  qemu-system-riscv32 -M virt -kernel output/images/fw_jump.elf -device loader,file=output/images/Image,addr=0x80400000 -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
+It is also possible to boot u-boot in QEMU. Although at the time of testing there were some issues with the OpenSBI to u-boot hand off. Run u-boot in emulation with:
+
+  qemu-system-riscv32 -M virt -kernel output/images/fw_jump.elf -device loader,file=output/images/u-boot,addr=0x80400000 -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
+
+Tested with QEMU 3.1
board/qemu/riscv64-virt/readme.txt +7 -3
index 9f6e35c867..02b6fe0506 100644
@@ -1,7 +1,11 @@
-Run the emulation with:
+Run Linux in emulation with:
 
-  qemu-system-riscv64 -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
+  qemu-system-riscv64 -M virt -kernel output/images/fw_jump.elf -device loader,file=output/images/Image,addr=0x80200000 -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
+It is also possible to boot u-boot in QEMU. Although at the time of testing there were some issues with the OpenSBI to u-boot hand off. Run u-boot in emulation with:
+
+  qemu-system-riscv64 -M virt -kernel output/images/fw_jump.elf -device loader,file=output/images/u-boot,addr=0x80200000 -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
+
+Tested with QEMU 3.1
boot/Config.in +1 -0
index 74481e7545..97bd3de6e9 100644
@@ -14,6 +14,7 @@ source "boot/lpc32xxcdl/Config.in"
 source "boot/mv-ddr-marvell/Config.in"
 source "boot/mxs-bootlets/Config.in"
 source "boot/optee-os/Config.in"
+source "boot/opensbi/Config.in"
 source "boot/riscv-pk/Config.in"
 source "boot/s500-bootloader/Config.in"
 source "boot/shim/Config.in"
boot/opensbi/Config.in new file +23 -0
new file mode 100644
index 0000000000..65d39aa664
@@ -0,0 +1,23 @@
+config BR2_TARGET_OPENSBI
+	bool "opensbi"
+	depends on BR2_riscv
+	help
+	  OpenSBI aims to provide an open-source and extensible
+	  implementation of the RISC-V SBI specification for a platform
+	  specific firmware (M-mode) and a general purpose OS, hypervisor
+	  or bootloader (S-mode or HS-mode). OpenSBI implementation can
+	  be easily extended by RISC-V platform or System-on-Chip vendors
+	  to fit a particular hadware configuration.
+
+	  https://github.com/riscv/opensbi.git
+
+if BR2_TARGET_OPENSBI
+config BR2_TARGET_OPENSBI_PLAT
+	string "OpenSBI Platform"
+	default ""
+	help
+	  Specifies the OpenSBI platform to build. If no platform is specified only
+	  the OpenSBI platform independent static library libsbi.a is built. If a
+	  platform is specified then the platform specific static library libplatsbi.a
+	  and firmware examples are built.
+endif
boot/opensbi/opensbi.mk new file +32 -0
new file mode 100644
index 0000000000..ac4b70d8a8
@@ -0,0 +1,32 @@
+################################################################################
+#
+# OpenSBI
+#
+################################################################################
+
+OPENSBI_VERSION = ca20ac0cd4c099006d4eea4d9ac7bd7b58e2ae0f
+OPENSBI_SITE = git://github.com/riscv/opensbi.git
+OPENSBI_LICENSE = BSD-2-Clause
+OPENSBI_LICENSE_FILES = COPYING.BSD
+OPENSBI_INSTALL_IMAGES = YES
+
+OPENSBI_MAKE_ENV = \
+	CROSS_COMPILE=$(TARGET_CROSS)
+
+OPENSBI_PLAT = $(call qstrip,$(BR2_TARGET_OPENSBI_PLAT))
+ifneq ($(OPENSBI_PLAT),)
+	OPENSBI_MAKE_ENV += PLATFORM=$(OPENSBI_PLAT)
+endif
+
+define OPENSBI_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(OPENSBI_MAKE_ENV) $(MAKE) -C $(@D)
+endef
+
+ifneq ($(OPENSBI_PLAT),)
+define OPENSBI_INSTALL_IMAGES_CMDS
+	$(INSTALL) -m 0644 -D $(@D)/build/platform/$(OPENSBI_PLAT)/firmware/fw_jump.bin $(BINARIES_DIR)/fw_jump.bin
+	$(INSTALL) -m 0644 -D $(@D)/build/platform/$(OPENSBI_PLAT)/firmware/fw_jump.elf $(BINARIES_DIR)/fw_jump.elf
+endef
+endif
+
+$(eval $(generic-package))
configs/qemu_riscv32_virt_defconfig +3 -1
index f7e9a23106..96d971333a 100644
@@ -23,4 +23,6 @@ BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/riscv32-virt/linux.config"
 BR2_LINUX_KERNEL_IMAGE=y
 
 # Bootloader
-BR2_TARGET_RISCV_PK=y
+BR2_TARGET_OPENSBI=y
+BR2_TARGET_OPENSBI_USE_PLAT=y
+BR2_TARGET_OPENSBI_PLAT="qemu/virt"
configs/qemu_riscv64_virt_defconfig +3 -1
index ae67979d29..05d2764003 100644
@@ -22,4 +22,6 @@ BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y
 BR2_LINUX_KERNEL_IMAGE=y
 
 # Bootloader
-BR2_TARGET_RISCV_PK=y
+BR2_TARGET_OPENSBI=y
+BR2_TARGET_OPENSBI_USE_PLAT=y
+BR2_TARGET_OPENSBI_PLAT="qemu/virt"
Signature · 1 line
2.21.0
#12 lore raw

PATCH v2 5/5 boot: riscv: Initial commit of OpenSBI

Hello Alistair,

Quoted 6 lines · On Mon, 18 Mar 2019 21:02:04 +0000 Alistair Francis <[email protected]>…

OpenSBI is a much improved alternative to BBL (riscv-pk). Add OpenSBI support to buildroot.

OpenSBI is also set as the default boot loader for RISC-V.

This should be two separate commits:

- One adding boot/opensbi/ as a new package

- One updating the defconfig to use opensbi (and the new Image kernel format)

So overall, you should have the following commits:

linux: allow BR2_LINUX_KERNEL_IMAGE on RISC-V boot/opensbi: new package configs/qemu_riscv*_virt: use opensbi instead of riscv-pk

Quoted 8 lines

N: Alvaro G. M <[email protected]>

board/qemu/riscv32-virt/readme.txt +1 -1
index 2da99580e5..f73f4278de 100644
@@ -1,7 +1,11 @@
-Run the emulation with:
+Run Linux in emulation with:

board/qemu/riscv32-virt/readme.txt line 9

Quoted 10 lines
board/qemu/riscv32-virt/readme.txt +4 -2
 
-  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
+  qemu-system-riscv32 -M virt -kernel output/images/fw_jump.elf -device loader,file=output/images/Image,addr=0x80400000 -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
+It is also possible to boot u-boot in QEMU. Although at the time of testing there were some issues with the OpenSBI to u-boot hand off. Run u-boot in emulation with:
+
+  qemu-system-riscv32 -M virt -kernel output/images/fw_jump.elf -device loader,file=output/images/u-boot,addr=0x80400000 -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 defconfig is not building U-Boot for RISC-V, so this part is not relevant in this readme.txt.

board/qemu/riscv32-virt/readme.txt

Quoted 3 lines
board/qemu/riscv32-virt/readme.txt +3 -0
+It is also possible to boot u-boot in QEMU. Although at the time of testing there were some issues with the OpenSBI to u-boot hand off. Run u-boot in emulation with:
+
+  qemu-system-riscv64 -M virt -kernel output/images/fw_jump.elf -device loader,file=output/images/u-boot,addr=0x80200000 -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

Ditto.

Quoted 18 lines
boot/opensbi/Config.in new file +12 -0
new file mode 100644
index 0000000000..65d39aa664
@@ -0,0 +1,23 @@
+config BR2_TARGET_OPENSBI
+	bool "opensbi"
+	depends on BR2_riscv
+	help
+	  OpenSBI aims to provide an open-source and extensible
+	  implementation of the RISC-V SBI specification for a platform
+	  specific firmware (M-mode) and a general purpose OS, hypervisor
+	  or bootloader (S-mode or HS-mode). OpenSBI implementation can
+	  be easily extended by RISC-V platform or System-on-Chip vendors
+	  to fit a particular hadware configuration.
+
+	  https://github.com/riscv/opensbi.git

boot/opensbi/Config.in line 22

Quoted 10 lines
boot/opensbi/Config.in new file +10 -0
+
+if BR2_TARGET_OPENSBI
+config BR2_TARGET_OPENSBI_PLAT
+	string "OpenSBI Platform"
+	default ""
+	help
+	  Specifies the OpenSBI platform to build. If no platform is specified only
+	  the OpenSBI platform independent static library libsbi.a is built. If a
+	  platform is specified then the platform specific static library libplatsbi.a
+	  and firmware examples are built.

I'm pretty sure "make check-package" would whine here about the lines being too long. Could you make sure to run "make check-package" before your next submission ?

boot/opensbi/Config.in

Quoted 3 lines
boot/opensbi/Config.in new file +3 -0
+OPENSBI_PLAT = $(call qstrip,$(BR2_TARGET_OPENSBI_PLAT))
+ifneq ($(OPENSBI_PLAT),)
+	OPENSBI_MAKE_ENV += PLATFORM=$(OPENSBI_PLAT)

No indentation here.

Thanks!

Thomas

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

PATCH v2 5/5 boot: riscv: Initial commit of OpenSBI

Quoted 17 lines · Thomas Petazzoni

Hello Alistair,

Quoted 6 lines · On Mon, 18 Mar 2019 21:02:04 +0000 Alistair Francis <[email protected]>…

OpenSBI is a much improved alternative to BBL (riscv-pk). Add OpenSBI support to buildroot.

OpenSBI is also set as the default boot loader for RISC-V.

This should be two separate commits:

- One adding boot/opensbi/ as a new package

Quoted 8 lines

- One updating the defconfig to use opensbi (and the new Image kernel format)

So overall, you should have the following commits:

linux: allow BR2_LINUX_KERNEL_IMAGE on RISC-V boot/opensbi: new package configs/qemu_riscv*_virt: use opensbi instead of riscv-pk

Done, will be fixed in v3.

Quoted 16 lines
Quoted 16 lines

N: Alvaro G. M <[email protected]>

board/qemu/riscv32-virt/readme.txt +2 -2
index 2da99580e5..f73f4278de 100644
@@ -1,7 +1,11 @@
-Run the emulation with:
+Run Linux in 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
+  qemu-system-riscv32 -M virt -kernel output/images/fw_jump.elf -device loader,file=output/images/Image,addr=0x80400000 -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.
 
Quoted 7 lines

board/qemu/riscv32-virt/readme.txt line 9

Quoted 4 lines
board/qemu/riscv32-virt/readme.txt +3 -1
-Tested with QEMU 2.12.1
+It is also possible to boot u-boot in QEMU. Although at the time of testing there were some issues with the OpenSBI to u-boot hand off. Run u-boot in emulation with:
+
+  qemu-system-riscv32 -M virt -kernel output/images/fw_jump.elf -device loader,file=output/images/u-boot,addr=0x80400000 -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 defconfig is not building U-Boot for RISC-V, so this part is not relevant in this readme.txt.

Although I think it makes sense to leave in for those who are interested in booting u-boot, I will remove it.

Quoted 31 lines

board/qemu/riscv32-virt/readme.txt

Quoted 4 lines
board/qemu/riscv32-virt/readme.txt +3 -0
+It is also possible to boot u-boot in QEMU. Although at the time of testing there were some issues with the OpenSBI to u-boot hand off. Run u-boot in emulation with:
+
+  qemu-system-riscv64 -M virt -kernel output/images/fw_jump.elf -device loader,file=output/images/u-boot,addr=0x80200000 -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

Ditto.

Quoted 24 lines
boot/opensbi/Config.in new file +18 -0
new file mode 100644
index 0000000000..65d39aa664
@@ -0,0 +1,23 @@
+config BR2_TARGET_OPENSBI
+     bool "opensbi"
+     depends on BR2_riscv
+     help
+       OpenSBI aims to provide an open-source and extensible
+       implementation of the RISC-V SBI specification for a platform
+       specific firmware (M-mode) and a general purpose OS, hypervisor
+       or bootloader (S-mode or HS-mode). OpenSBI implementation can
+       be easily extended by RISC-V platform or System-on-Chip vendors
+       to fit a particular hadware configuration.
+
+       https://github.com/riscv/opensbi.git
+
+if BR2_TARGET_OPENSBI
+config BR2_TARGET_OPENSBI_PLAT
+     string "OpenSBI Platform"
+     default ""
+     help
Quoted 8 lines

boot/opensbi/Config.in line 22

Quoted 4 lines
boot/opensbi/Config.in new file +4 -0
+       Specifies the OpenSBI platform to build. If no platform is specified only
+       the OpenSBI platform independent static library libsbi.a is built. If a
+       platform is specified then the platform specific static library libplatsbi.a
+       and firmware examples are built.

I'm pretty sure "make check-package" would whine here about the lines being too long. Could you make sure to run "make check-package" before your next submission ?

Yep, I didn't know that was an option.

Quoted 6 lines

boot/opensbi/Config.in

Quoted 4 lines
boot/opensbi/Config.in new file +3 -0
+OPENSBI_PLAT = $(call qstrip,$(BR2_TARGET_OPENSBI_PLAT))
+ifneq ($(OPENSBI_PLAT),)
+     OPENSBI_MAKE_ENV += PLATFORM=$(OPENSBI_PLAT)

No indentation here.

Fixed.

Alistair

Quoted 8 lines

Thanks!

Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

#14 lore raw

PATCH v2 1/5 package/glibc: Update glibc 32-bit RISC-V version

In reply to Alistair Francis
Quoted 10 lines · On Mon, 18 Mar 2019 21:02:02 +0000 Alistair Francis <[email protected]>…
---
 .../glibc.hash                                |  2 +-
 ...C-V-32-bit-build-of-riscv-glibc-2.26.patch | 59 -------------------
 ...rror-that-breaks-RISC-V-architecture.patch | 39 ------------
 package/glibc/glibc.mk                        |  2 +-
 4 files changed, 2 insertions(+), 100 deletions(-)
 rename package/glibc/{4e2943456e690d89f48e6e710757dd09404b0c9a => 06983fe52cfe8e4779035c27e8cc5d2caab31531}/glibc.hash (71%)
 delete mode 100644 package/glibc/4e2943456e690d89f48e6e710757dd09404b0c9a/0001-Fix-RISC-V-32-bit-build-of-riscv-glibc-2.26.patch
 delete mode 100644 package/glibc/4e2943456e690d89f48e6e710757dd09404b0c9a/0002-Fix-mcontext_t-error-that-breaks-RISC-V-architecture.patch

Applied to master, thanks.

Thomas

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