From f93688cbd5f4380f639dc0b4206ef592efb5d939 Mon Sep 17 00:00:00 2001 From: Yongrong Wang Date: Thu, 29 Feb 2024 17:39:19 +0800 Subject: [PATCH] openamp/Kconfig: add CONFIG_OPENAMP_ENABLE_VIRTIO_ONLY to enable virtio only OPENAMP_VIRTIO_DEVICE_ONLY and OPENAMP_VIRTIO_DRIVER_ONLY can be used to comment some unused code in OpenAMP library to save code size. Signed-off-by: Yongrong Wang Signed-off-by: Bowen Wang --- openamp/Kconfig | 8 ++++++++ openamp/open-amp.cmake | 8 ++++++++ openamp/open-amp.defs | 8 ++++++++ 3 files changed, 24 insertions(+) diff --git a/openamp/Kconfig b/openamp/Kconfig index f4e02c735a..d9b0d072c6 100644 --- a/openamp/Kconfig +++ b/openamp/Kconfig @@ -22,4 +22,12 @@ config OPENAMP_DEBUG bool "Enable OpenAMP Debug" default n +config OPENAMP_VIRTIO_DEVICE_ONLY + bool "Enable VIRTIO_DEVICE_ONLY" + default n + +config OPENAMP_VIRTIO_DRIVER_ONLY + bool "Enable VIRTIO_DRIVER_ONLY" + default n + endif # OPENAMP diff --git a/openamp/open-amp.cmake b/openamp/open-amp.cmake index 3fea5fde9b..154a0e0293 100644 --- a/openamp/open-amp.cmake +++ b/openamp/open-amp.cmake @@ -99,6 +99,14 @@ endif() add_compile_definitions(elf_load=remoteproc_elf_load) +if(CONFIG_OPENAMP_VIRTIO_DEVICE_ONLY) + add_compile_definitions(VIRTIO_DEVICE_ONLY) +endif() + +if(CONFIG_OPENAMP_VIRTIO_DRIVER_ONLY) + add_compile_definitions(VIRTIO_DRIVER_ONLY) +endif() + set(WITH_LIBMETAL_FIND OFF) if(NOT CMAKE_SYSTEM_PROCESSOR) diff --git a/openamp/open-amp.defs b/openamp/open-amp.defs index 6985eedb86..73aeb7f43a 100644 --- a/openamp/open-amp.defs +++ b/openamp/open-amp.defs @@ -32,6 +32,14 @@ endif CFLAGS += -Delf_load=remoteproc_elf_load +ifeq ($(CONFIG_OPENAMP_VIRTIO_DEVICE_ONLY),y) + CFLAGS += -DVIRTIO_DEVICE_ONLY +endif + +ifeq ($(CONFIG_OPENAMP_VIRTIO_DRIVER_ONLY),y) + CFLAGS += -DVIRTIO_DRIVER_ONLY +endif + CSRCS += open-amp/lib/remoteproc/elf_loader.c CSRCS += open-amp/lib/remoteproc/remoteproc.c CSRCS += open-amp/lib/remoteproc/remoteproc_virtio.c