board/qemu/riscv32-virt: Update linux config
PATCH v4 1/5 board/qemu/riscv32-virt: Update linux config
Update the Linux defconfig. This defconfig is the in tree defconfig with 32-bit support enabled.
--- board/qemu/riscv32-virt/linux.config | 85 +++++++++++++++++++++++++--- 1 file changed, 78 insertions(+), 7 deletions(-)
board/qemu/riscv32-virt/linux.config +78 -7
@@ -1,23 +1,94 @@ +CONFIG_32BIT=y +CONFIG_PAGE_OFFSET=0xC0000000 +CONFIG_PGTABLE_LEVELS=2 CONFIG_ARCH_RV32I=y +# CONFIG_ARCH_RV64I is not set +CONFIG_MAXPHYSMEM_2GB=y +CONFIG_LBDAF=y +# CONFIG_SCSI_NSP32 is not set +CONFIG_GENERIC_ATOMIC64=y +CONFIG_GENERIC_LIB_ASHLDI3=y +CONFIG_GENERIC_LIB_ASHRDI3=y +CONFIG_GENERIC_LIB_LSHRDI3=y +CONFIG_GENERIC_LIB_UCMPDI2=y +CONFIG_GENERIC_LIB_UMODDI3=y +CONFIG_SYSVIPC=y +CONFIG_POSIX_MQUEUE=y +CONFIG_IKCONFIG=y +CONFIG_IKCONFIG_PROC=y +CONFIG_CGROUPS=y +CONFIG_CGROUP_SCHED=y +CONFIG_CFS_BANDWIDTH=y +CONFIG_CGROUP_BPF=y +CONFIG_NAMESPACES=y +CONFIG_USER_NS=y +CONFIG_CHECKPOINT_RESTORE=y +CONFIG_BLK_DEV_INITRD=y +CONFIG_EXPERT=y +CONFIG_BPF_SYSCALL=y CONFIG_SMP=y -CONFIG_NR_CPUS=8 CONFIG_PCI=y -CONFIG_SYSVIPC=y +CONFIG_PCIE_XILINX=y +CONFIG_MODULES=y +CONFIG_MODULE_UNLOAD=y CONFIG_NET=y CONFIG_PACKET=y CONFIG_UNIX=y CONFIG_INET=y -# CONFIG_WIRELESS is not set +CONFIG_IP_MULTICAST=y +CONFIG_IP_ADVANCED_ROUTER=y +CONFIG_IP_PNP=y +CONFIG_IP_PNP_DHCP=y +CONFIG_IP_PNP_BOOTP=y +CONFIG_IP_PNP_RARP=y +CONFIG_NETLINK_DIAG=y +CONFIG_DEVTMPFS=y +CONFIG_BLK_DEV_LOOP=y CONFIG_VIRTIO_BLK=y +CONFIG_BLK_DEV_SD=y +CONFIG_BLK_DEV_SR=y +CONFIG_ATA=y +CONFIG_SATA_AHCI=y +CONFIG_SATA_AHCI_PLATFORM=y CONFIG_NETDEVICES=y CONFIG_VIRTIO_NET=y -# CONFIG_ETHERNET is not set -# CONFIG_WLAN is not set +CONFIG_MACB=y +CONFIG_E1000E=y +CONFIG_R8169=y +CONFIG_MICROSEMI_PHY=y +CONFIG_INPUT_MOUSEDEV=y CONFIG_SERIAL_8250=y CONFIG_SERIAL_8250_CONSOLE=y CONFIG_SERIAL_OF_PLATFORM=y -CONFIG_VIRT_DRIVERS=y +CONFIG_HVC_RISCV_SBI=y +# CONFIG_PTP_1588_CLOCK is not set +CONFIG_DRM=y +CONFIG_DRM_RADEON=y +CONFIG_FRAMEBUFFER_CONSOLE=y +CONFIG_USB=y +CONFIG_USB_XHCI_HCD=y +CONFIG_USB_XHCI_PLATFORM=y +CONFIG_USB_EHCI_HCD=y +CONFIG_USB_EHCI_HCD_PLATFORM=y +CONFIG_USB_OHCI_HCD=y +CONFIG_USB_OHCI_HCD_PLATFORM=y +CONFIG_USB_STORAGE=y +CONFIG_USB_UAS=y CONFIG_VIRTIO_MMIO=y -CONFIG_EXT2_FS=y +CONFIG_SIFIVE_PLIC=y +CONFIG_RAS=y CONFIG_EXT4_FS=y +CONFIG_EXT4_FS_POSIX_ACL=y +CONFIG_AUTOFS4_FS=y +CONFIG_MSDOS_FS=y +CONFIG_VFAT_FS=y CONFIG_TMPFS=y +CONFIG_TMPFS_POSIX_ACL=y +CONFIG_NFS_FS=y +CONFIG_NFS_V4=y +CONFIG_NFS_V4_1=y +CONFIG_NFS_V4_2=y +CONFIG_ROOT_NFS=y +CONFIG_CRYPTO_USER_API_HASH=y +CONFIG_PRINTK_TIME=y +# CONFIG_RCU_TRACE is not set
Signature · 1 line
2.21.0
PATCH v4 2/5 linux: Enable BR2_LINUX_KERNEL_IMAGE on RISC-V
We will need to build Image files for OpenSBI so allow that now.
--- linux/Config.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
linux/Config.in +1 -1
@@ -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
Thomas Petazzoni
AppliedPATCH v4 2/5 linux: Enable BR2_LINUX_KERNEL_IMAGE on RISC-V
Quoted 6 lines · On Tue, 19 Mar 2019 18:15:47 +0000 Alistair Francis <[email protected]>…
We will need to build Image files for OpenSBI so allow that now.
Signed-off-by Alistair Francis <[email protected]>--- linux/Config.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Applied to master, thanks.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH v4 3/5 boot/opensbi: Initial commit of OpenSBI for RISC-V
In reply to Alistair FrancisOpenSBI is a much improved alternative to BBL (riscv-pk). Add OpenSBI support to buildroot.
--- DEVELOPERS | 1 + boot/Config.in | 1 + boot/opensbi/Config.in | 25 +++++++++++++++++++++++++ boot/opensbi/opensbi.mk | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 59 insertions(+) create mode 100644 boot/opensbi/Config.in create mode 100644 boot/opensbi/opensbi.mk
DEVELOPERS +1 -0
@@ -122,6 +122,7 @@ F: package/kvazaar/ F: package/v4l2loopback/ N: Alistair Francis <[email protected]> +F: boot/opensbi/ F: package/xen/ N: Alvaro G. M <[email protected]>
boot/Config.in +1 -0
@@ -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 +25 -0
@@ -0,0 +1,25 @@ +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
@@ -0,0 +1,32 @@ +################################################################################ +# +# OpenSBI +# +################################################################################ + +OPENSBI_VERSION = v0.3 +OPENSBI_SITE = $(call github,riscv,opensbi,$(OPENSBI_VERSION)) +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))
Signature · 1 line
2.21.0
PATCH v4 3/5 boot/opensbi: Initial commit of OpenSBI for RISC-V
Hello,
I was about to apply this patch, but there is still an issue (see below). Since a new iteration will be needed, I'll point out some minor nits as well that I would have normally fixed myself when applying, but that you can fix together with the more significant issue.
First minor nit: the commit title should be "boot/opensbi: new package"
boot/opensbi/opensbi.mk line 3
Quoted 9 lines · On Tue, 19 Mar 2019 18:15:48 +0000 Alistair Francis <[email protected]>…
boot/opensbi/opensbi.mk new file +3
-0@@ -0,0 +1,32 @@ +################################################################################ +# +# OpenSBI
opensbi in lower-case
Quoted 17 lines
boot/opensbi/opensbi.mk new file +17
-0+# +################################################################################ + +OPENSBI_VERSION = v0.3 +OPENSBI_SITE = $(call github,riscv,opensbi,$(OPENSBI_VERSION)) +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 +
boot/opensbi/opensbi.mk line 30
Quoted 10 lines
boot/opensbi/opensbi.mk new file +10
-0+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
So the issue that I have is that this package doesn't install anything when OPENSBI_PLAT is empty. It doesn't install any image, it doesn't install any library to STAGING_DIR.
Should the libplatsbi.a library be installed in $(STAGING_DIR)/usr/lib ? This location is normally for regular Linux user-space libraries, which I suppose libplatsbi.a is not. Perhaps it should be in another location ?
In any case, it should be installed somewhere, otherwise the package is pretty meaningless when OPENSBI_PLAT is empty.
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH v4 3/5 boot/opensbi: Initial commit of OpenSBI for RISC-V
Quoted 58 lines · Thomas Petazzoni
Hello,
I was about to apply this patch, but there is still an issue (see below). Since a new iteration will be needed, I'll point out some minor nits as well that I would have normally fixed myself when applying, but that you can fix together with the more significant issue.
First minor nit: the commit title should be "boot/opensbi: new package"
boot/opensbi/opensbi.mk line 3
Quoted 9 lines · On Tue, 19 Mar 2019 18:15:48 +0000 Alistair Francis <[email protected]>…
boot/opensbi/opensbi.mk new file +3
-0@@ -0,0 +1,32 @@ +################################################################################ +# +# OpenSBIopensbi in lower-case
Quoted 17 lines
boot/opensbi/opensbi.mk new file +17
-0+# +################################################################################ + +OPENSBI_VERSION = v0.3 +OPENSBI_SITE = $(call github,riscv,opensbi,$(OPENSBI_VERSION)) +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 +boot/opensbi/opensbi.mk line 30
Quoted 10 lines
boot/opensbi/opensbi.mk new file +10
-0+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 +endifSo the issue that I have is that this package doesn't install anything when
OPENSBI_PLATis empty. It doesn't install any image, it doesn't install any library toSTAGING_DIR.
Quoted 7 lines
Should the libplatsbi.a library be installed in $(STAGING_DIR)/usr/lib ? This location is normally for regular Linux user-space libraries, which I suppose libplatsbi.a is not. Perhaps it should be in another location ?
In any case, it should be installed somewhere, otherwise the package is pretty meaningless when
OPENSBI_PLATis empty.
Fixed in v5.
Alistair
Quoted 8 lines
Thanks!
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
PATCH v4 4/5 configs: qemu_riscv*_virt: Use OpenSBI by default
In reply to Alistair FrancisUse OpenSBI by default instead of riscv-pk (BBL).
--- board/qemu/riscv32-virt/readme.txt | 6 +++--- board/qemu/riscv64-virt/readme.txt | 6 +++--- configs/qemu_riscv32_virt_defconfig | 5 ++++- configs/qemu_riscv64_virt_defconfig | 5 ++++- 4 files changed, 14 insertions(+), 8 deletions(-)
board/qemu/riscv32-virt/readme.txt +3 -3
@@ -1,7 +1,7 @@ -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 +Tested with QEMU 3.1
board/qemu/riscv64-virt/readme.txt +3 -3
@@ -1,7 +1,7 @@ -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 +Tested with QEMU 3.1
configs/qemu_riscv32_virt_defconfig +4 -1
@@ -20,6 +20,9 @@ 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 +BR2_TARGET_OPENSBI=y +BR2_TARGET_OPENSBI_USE_PLAT=y +BR2_TARGET_OPENSBI_PLAT="qemu/virt"
configs/qemu_riscv64_virt_defconfig +4 -1
@@ -19,6 +19,9 @@ 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 +BR2_TARGET_OPENSBI=y +BR2_TARGET_OPENSBI_USE_PLAT=y +BR2_TARGET_OPENSBI_PLAT="qemu/virt"
Signature · 1 line
2.21.0
PATCH v4 5/5 boot/riscv-pk: Deprecate riscv-pk and BBL
In reply to Alistair Francis--- boot/riscv-pk/Config.in | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
boot/riscv-pk/Config.in +4 -1
@@ -3,10 +3,13 @@ comment "riscv-pk needs a Linux kernel to be built" depends on !BR2_LINUX_KERNEL config BR2_TARGET_RISCV_PK - bool "riscv-pk" + bool "riscv-pk (deprecated)" depends on BR2_riscv depends on BR2_LINUX_KERNEL help + The RISC-V Proxy Kernel (pk) and Boot Loader (BBL) have + been deprecated. Please use OpenSBI instead. + The RISC-V Proxy Kernel (pk) package contains the Berkeley Boot Loader (BBL) which has been designed to boot a Linux kernel on a RISC-V processor.
Signature · 1 line
2.21.0
PATCH v4 1/5 board/qemu/riscv32-virt: Update linux config
In reply to Alistair FrancisHello,
Quoted 4 lines · On Tue, 19 Mar 2019 18:15:46 +0000 Alistair Francis <[email protected]>…
Update the Linux defconfig. This defconfig is the in tree defconfig with 32-bit support enabled.
Signed-off-by Alistair Francis <[email protected]>
If it's just the in-tree defconfig + one option to enable 32-bit support, what about using the in-tree defconfig directly + a small config fragment to enable 32-bit support ?
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH v4 1/5 board/qemu/riscv32-virt: Update linux config
Quoted 6 lines · Thomas Petazzoni
Hello,
On Tue, 19 Mar 2019 18:15:46 +0000 Alistair Francis <[email protected]> wrote:
Quoted 8 lines
Quoted 4 lines
Update the Linux defconfig. This defconfig is the in tree defconfig with 32-bit support enabled.
Signed-off-by Alistair Francis <[email protected]>If it's just the in-tree defconfig + one option to enable 32-bit support, what about using the in-tree defconfig directly + a small config fragment to enable 32-bit support ?
That would be great! That's what we do in OpenEmbedded. I couldn't figure out how to enable that though. How can I append a config to the arch defconfig?
Alistair
Quoted 8 lines
Thanks!
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com