[PATCH 7/7] RISC-V: qemu-virt: add overlay for environment and state

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Like we do on ARM, let's add state and environment to RISC-V QEMU Virt
as well.

Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 arch/riscv/Kconfig.socs                      | 10 ++++++++++
 arch/riscv/configs/virt32_defconfig          |  4 ++++
 arch/riscv/configs/virt64_defconfig          |  4 ++++
 common/boards/qemu-virt/Makefile             |  3 +++
 common/boards/qemu-virt/board.c              |  1 +
 common/boards/qemu-virt/overlay-of-flash.dts |  5 +++++
 6 files changed, 27 insertions(+)

diff --git a/arch/riscv/Kconfig.socs b/arch/riscv/Kconfig.socs
index b12c795041b0..9f2a4f825ebb 100644
--- a/arch/riscv/Kconfig.socs
+++ b/arch/riscv/Kconfig.socs
@@ -23,6 +23,16 @@ config SOC_VIRT
 	  Generates an image tht can be be booted by QEMU. The image is called
 	  barebox-dt-2nd.img
 
+config BOARD_RISCV_VIRT
+	depends on SOC_VIRT
+	bool "QEMU Virt Machine"
+	select OF_OVERLAY
+	select BOARD_QEMU_VIRT
+	default y
+	help
+	  Enables environment and state on top of QEMU RISC-V Virt machine
+	  cfi-flash.
+
 config BOARD_RISCVEMU
 	depends on SOC_VIRT
 	bool "TinyEMU Virt Machine (riscvemu)"
diff --git a/arch/riscv/configs/virt32_defconfig b/arch/riscv/configs/virt32_defconfig
index 6a8443d6d565..1d7b70fc0fbc 100644
--- a/arch/riscv/configs/virt32_defconfig
+++ b/arch/riscv/configs/virt32_defconfig
@@ -69,11 +69,14 @@ CONFIG_CMD_OF_FIXUP_STATUS=y
 CONFIG_CMD_OF_OVERLAY=y
 CONFIG_CMD_OFTREE=y
 CONFIG_CMD_TIME=y
+CONFIG_CMD_STATE=y
 CONFIG_CMD_DHRYSTONE=y
 CONFIG_NET=y
 CONFIG_NET_NFS=y
 CONFIG_NET_NETCONSOLE=y
 CONFIG_NET_FASTBOOT=y
+CONFIG_OF_BAREBOX_DRIVERS=y
+CONFIG_OF_BAREBOX_ENV_IN_FS=y
 CONFIG_DRIVER_SERIAL_NS16550=y
 CONFIG_VIRTIO_CONSOLE=y
 CONFIG_DRIVER_NET_VIRTIO=y
@@ -94,6 +97,7 @@ CONFIG_FRAMEBUFFER_CONSOLE=y
 CONFIG_DRIVER_VIDEO_BOCHS_PCI=y
 CONFIG_DRIVER_VIDEO_SIMPLEFB_CLIENT=y
 CONFIG_CLOCKSOURCE_DUMMY_RATE=60000
+CONFIG_STATE_DRV=y
 CONFIG_EEPROM_AT24=y
 CONFIG_HWRNG=y
 CONFIG_HW_RANDOM_VIRTIO=y
diff --git a/arch/riscv/configs/virt64_defconfig b/arch/riscv/configs/virt64_defconfig
index 604292d4f4fd..8c66e3e574ff 100644
--- a/arch/riscv/configs/virt64_defconfig
+++ b/arch/riscv/configs/virt64_defconfig
@@ -70,11 +70,14 @@ CONFIG_CMD_OF_FIXUP_STATUS=y
 CONFIG_CMD_OF_OVERLAY=y
 CONFIG_CMD_OFTREE=y
 CONFIG_CMD_TIME=y
+CONFIG_CMD_STATE=y
 CONFIG_CMD_DHRYSTONE=y
 CONFIG_NET=y
 CONFIG_NET_NFS=y
 CONFIG_NET_NETCONSOLE=y
 CONFIG_NET_FASTBOOT=y
+CONFIG_OF_BAREBOX_DRIVERS=y
+CONFIG_OF_BAREBOX_ENV_IN_FS=y
 CONFIG_DRIVER_SERIAL_NS16550=y
 CONFIG_VIRTIO_CONSOLE=y
 CONFIG_DRIVER_NET_VIRTIO=y
@@ -95,6 +98,7 @@ CONFIG_FRAMEBUFFER_CONSOLE=y
 CONFIG_DRIVER_VIDEO_BOCHS_PCI=y
 CONFIG_DRIVER_VIDEO_SIMPLEFB_CLIENT=y
 CONFIG_CLOCKSOURCE_DUMMY_RATE=60000
+CONFIG_STATE_DRV=y
 CONFIG_EEPROM_AT24=y
 CONFIG_HWRNG=y
 CONFIG_HW_RANDOM_VIRTIO=y
diff --git a/common/boards/qemu-virt/Makefile b/common/boards/qemu-virt/Makefile
index f10d39138578..88184e9a7969 100644
--- a/common/boards/qemu-virt/Makefile
+++ b/common/boards/qemu-virt/Makefile
@@ -2,3 +2,6 @@
 
 obj-y += board.o
 obj-y += overlay-of-flash.dtb.o
+ifeq ($(CONFIG_RISCV),y)
+DTC_CPP_FLAGS_overlay-of-flash.dtb := -DRISCV_VIRT=1
+endif
diff --git a/common/boards/qemu-virt/board.c b/common/boards/qemu-virt/board.c
index f10608e30343..4064409c80d3 100644
--- a/common/boards/qemu-virt/board.c
+++ b/common/boards/qemu-virt/board.c
@@ -54,6 +54,7 @@ static int virt_probe(struct device_d *dev)
 
 static const struct of_device_id virt_of_match[] = {
 	{ .compatible = "linux,dummy-virt", .data = arm_virt_init },
+	{ .compatible = "riscv-virtio" },
 	{ /* Sentinel */},
 };
 BAREBOX_DEEP_PROBE_ENABLE(virt_of_match);
diff --git a/common/boards/qemu-virt/overlay-of-flash.dts b/common/boards/qemu-virt/overlay-of-flash.dts
index ed6ad0072b55..a271a455105f 100644
--- a/common/boards/qemu-virt/overlay-of-flash.dts
+++ b/common/boards/qemu-virt/overlay-of-flash.dts
@@ -1,8 +1,13 @@
 /dts-v1/;
 /plugin/;
 
+#ifdef RISCV_VIRT
+#define PARTS_TARGET_PATH	"/soc/flash@20000000"
+#define ENV_DEVICE_PATH		"/soc/flash@20000000/partitions/partition@3c00000"
+#else
 #define PARTS_TARGET_PATH	"/flash@0"
 #define ENV_DEVICE_PATH		"/flash@0/partitions/partition@3c00000"
+#endif
 
 / {
 	fragment@0 {
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux