All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] configs/qemu_riscv32_nommu_virt_defconfig: New defconfig
@ 2024-05-11  7:46 Waldemar Brodkorb
  2024-05-11 20:14 ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 2+ messages in thread
From: Waldemar Brodkorb @ 2024-05-11  7:46 UTC (permalink / raw)
  To: buildroot

Add new defconfig for Qemu RISCV32 w/o MMU.

Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
---
 DEVELOPERS                                 |  2 ++
 arch/Config.in.riscv                       |  3 +--
 board/qemu/riscv32-virt/linux-nommu.config | 21 +++++++++++++++
 board/qemu/riscv32-virt/readme.txt         |  2 ++
 configs/qemu_riscv32_nommu_virt_defconfig  | 30 ++++++++++++++++++++++
 package/Makefile.in                        |  4 +--
 6 files changed, 58 insertions(+), 4 deletions(-)
 create mode 100644 board/qemu/riscv32-virt/linux-nommu.config
 create mode 100644 configs/qemu_riscv32_nommu_virt_defconfig

diff --git a/DEVELOPERS b/DEVELOPERS
index cb8a69a36a..3f14ce338b 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -3192,6 +3192,8 @@ N:	Wade Berrier <wberrier@gmail.com>
 F:	package/ngrep/
 
 N:	Waldemar Brodkorb <wbx@openadk.org>
+F:	board/qemu/riscv32-virt/
+F:	configs/qemu_riscv32_nommu_virt_defconfig
 F:	package/asterisk/
 F:	package/libjwt/
 F:	package/mksh/
diff --git a/arch/Config.in.riscv b/arch/Config.in.riscv
index d62e4ebc6c..3461f75800 100644
--- a/arch/Config.in.riscv
+++ b/arch/Config.in.riscv
@@ -51,7 +51,6 @@ choice
 
 config BR2_RISCV_32
 	bool "32-bit"
-	select BR2_USE_MMU
 
 config BR2_RISCV_64
 	bool "64-bit"
@@ -62,7 +61,7 @@ endchoice
 config BR2_RISCV_USE_MMU
 	bool "MMU support"
 	default y
-	depends on BR2_RISCV_64
+	depends on BR2_RISCV_64 || BR2_RISCV_32
 	select BR2_USE_MMU
 	help
 	  Enable this option if your RISC-V core has a MMU (Memory
diff --git a/board/qemu/riscv32-virt/linux-nommu.config b/board/qemu/riscv32-virt/linux-nommu.config
new file mode 100644
index 0000000000..784b12f18a
--- /dev/null
+++ b/board/qemu/riscv32-virt/linux-nommu.config
@@ -0,0 +1,21 @@
+CONFIG_BLK_DEV_INITRD=y
+# CONFIG_MMU is not set
+CONFIG_SOC_VIRT=y
+CONFIG_NONPORTABLE=y
+CONFIG_ARCH_RV32I=y
+CONFIG_BINFMT_FLAT=y
+CONFIG_SLOB=y
+CONFIG_NET=y
+CONFIG_PACKET=y
+CONFIG_UNIX=y
+CONFIG_INET=y
+CONFIG_NETDEVICES=y
+CONFIG_VIRTIO_BLK=y
+CONFIG_SERIAL_8250=y
+CONFIG_SERIAL_8250_CONSOLE=y
+CONFIG_SERIAL_OF_PLATFORM=y
+CONFIG_VIRTIO_MMIO=y
+CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES=y
+CONFIG_VIRTIO_NET=y
+CONFIG_EXT2_FS=y
+CONFIG_PRINTK_TIME=y
diff --git a/board/qemu/riscv32-virt/readme.txt b/board/qemu/riscv32-virt/readme.txt
index 32b4333512..555924f949 100644
--- a/board/qemu/riscv32-virt/readme.txt
+++ b/board/qemu/riscv32-virt/readme.txt
@@ -2,4 +2,6 @@ Run Linux in emulation with:
 
   qemu-system-riscv32 -M virt -bios output/images/fw_jump.elf -kernel output/images/Image -append "rootwait root=/dev/vda ro" -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_riscv32_virt_defconfig
 
+  qemu-system-riscv32 -M virt -bios none -kernel output/images/Image -append "rootwait root=/dev/vda ro" -drive file=output/images/rootfs.ext2,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 -nographic -cpu rv32,mmu=off -netdev user,id=eth0 -device virtio-net-device,netdev=eth0 # qemu_riscv32_nommu_virt_defconfig
+
 The login prompt will appear in the terminal that started Qemu.
diff --git a/configs/qemu_riscv32_nommu_virt_defconfig b/configs/qemu_riscv32_nommu_virt_defconfig
new file mode 100644
index 0000000000..4225a1b3b9
--- /dev/null
+++ b/configs/qemu_riscv32_nommu_virt_defconfig
@@ -0,0 +1,30 @@
+# Architecture
+BR2_riscv=y
+BR2_RISCV_32=y
+# BR2_RISCV_USE_MMU is not set
+
+# Linux headers same as kernel
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_6=y
+
+# System
+BR2_SYSTEM_DHCP="eth0"
+BR2_TARGET_GENERIC_GETTY=y
+
+# Filesystem
+BR2_TARGET_ROOTFS_EXT2=y
+
+# Image
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG)"
+
+# Kernel
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.6.18"
+BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
+BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/riscv32-virt/linux-nommu.config"
+BR2_LINUX_KERNEL_IMAGE=y
+
+# host-qemu for gitlab testing
+BR2_PACKAGE_HOST_QEMU=y
+BR2_PACKAGE_HOST_QEMU_SYSTEM_MODE=y
diff --git a/package/Makefile.in b/package/Makefile.in
index 3e276d23d6..2d9908b199 100644
--- a/package/Makefile.in
+++ b/package/Makefile.in
@@ -43,7 +43,7 @@ GNU_TARGET_NAME = $(ARCH)-$(TARGET_VENDOR)-$(TARGET_OS)-$(LIBC)$(ABI)
 
 # FLAT binary format needs uclinux, except RISC-V 64-bits which needs
 # the regular linux name.
-ifeq ($(BR2_BINFMT_FLAT):$(BR2_RISCV_64),y:)
+ifeq ($(BR2_BINFMT_FLAT):$(BR2_riscv),y:)
 TARGET_OS = uclinux
 else
 TARGET_OS = linux
@@ -181,7 +181,7 @@ TARGET_CXXFLAGS += -fno-dwarf2-cfi-asm
 endif
 
 ifeq ($(BR2_BINFMT_FLAT),y)
-ifeq ($(BR2_RISCV_64),y)
+ifeq ($(BR2_riscv),y)
 TARGET_CFLAGS += -fPIC
 endif
 ifeq ($(BR2_BINFMT_FLAT_ONE),y)
-- 
2.30.2

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Buildroot] [PATCH] configs/qemu_riscv32_nommu_virt_defconfig: New defconfig
  2024-05-11  7:46 [Buildroot] [PATCH] configs/qemu_riscv32_nommu_virt_defconfig: New defconfig Waldemar Brodkorb
@ 2024-05-11 20:14 ` Thomas Petazzoni via buildroot
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-05-11 20:14 UTC (permalink / raw)
  To: Waldemar Brodkorb; +Cc: buildroot

Hello Waldemar,

On Sat, 11 May 2024 09:46:07 +0200
Waldemar Brodkorb <wbx@openadk.org> wrote:

> Add new defconfig for Qemu RISCV32 w/o MMU.
> 
> Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>

Nice stuff!

Could you split this commit into two, one enabling RISC-V 32-bit noMMU,
and another adding the defconfig?

Also, in the patch adding the defconfig, fix the following
check-package warning:

WARNING: configs/qemu_riscv32_nommu_virt_defconfig:0: missing BR2_DOWNLOAD_FORCE_CHECK_HASHES

(we require this for new defconfigs)

Minor detail, the commit title should be:

	configs/qemu_riscv32_nommu_virt: new defconfig

Thanks a lot!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-05-11 20:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-11  7:46 [Buildroot] [PATCH] configs/qemu_riscv32_nommu_virt_defconfig: New defconfig Waldemar Brodkorb
2024-05-11 20:14 ` Thomas Petazzoni via buildroot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.