From patchwork Thu Aug 4 12:04:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1663644 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=qaEyl8rm; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ventanamicro.com header.i=@ventanamicro.com header.a=rsa-sha256 header.s=google header.b=SCiaqL+E; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lz6qb3PMvz9sFs for ; Thu, 4 Aug 2022 22:05:15 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=XQGZ5rjWpqPg5X4vKL810M/BeN5qjob+fQ0W1otsTS8=; b=qaEyl8rmPttyuc Ua/g0A9SzgcdlimMLrAVVI0Z2Vney2JW3sYx+XNT0VADm34po+qcH51VBZ3EVbVk33B1PZA2pwZYQ SaxJSXGBwvZ50oxysqvnyod8LnjZVoiZy2LDAIS2ibX0AeEqSA8njQj1hYio7nqINvdGidj6fnKAG PJYkyg33uvqNXZ9vGU5dn6vwIiYlTOiYE9oLbaVirCwHs+vvfEVcwH4BOSA81RqoIxvSYdIlLwvRS wouzyYg6ioYGu0weM1f+7J4kNI1fqivKZj2MpCT1gAEw2A5ieYv2tqO6dOVspXegXlVSVJR4R8UJc xpebfmuAUpns/+X4FsHg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oJZb3-005mbn-NQ; Thu, 04 Aug 2022 12:05:01 +0000 Received: from mail-oi1-x235.google.com ([2607:f8b0:4864:20::235]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oJZaz-005mYe-Ov for opensbi@lists.infradead.org; Thu, 04 Aug 2022 12:04:59 +0000 Received: by mail-oi1-x235.google.com with SMTP id c185so22981148oia.7 for ; Thu, 04 Aug 2022 05:04:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=zZtG5ykbQb91IeZokTImwZvxlUbJgCaffne+YECrNdg=; b=SCiaqL+EfRedC8xI/7hV3SddHS1UTvRIvD5Aw3BlMlwRIejk9ZNTTDvXDpfDVbkVBR erJXZY9I8pBvRnKmrPRwI23TyiYAfwZbLusVbhEsLubbbCJ1p4EQLmge0bm6jM/0KF3w 56+QOgNZqwFy5EcKUTe79G+lAZo08bDYys5bKu7Cr+2l3YyVDshskUqLrRSytaICG1vB Kpl7q2mL9hFOc3viqBHkLfeuuAo3hJx5dZkktC2Q/jU2E1+zucYYDDt7ujWBq4JF4mtx L+7WsYJTzkirpwge2qJkYcDwayVRc705VOEtqS3h4riJkogd2Iskt6tPvfOLKBspDCsy 4HRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=zZtG5ykbQb91IeZokTImwZvxlUbJgCaffne+YECrNdg=; b=xJsMhThEJtbm8UeM31d8jbvaj71Gyr9xzNfm04421ZdS1xK5bvrczNHq/X+NXAOzl6 /SHtlglGMeSgjO1Db+uyR3YeXqz9vJyo1FKMUWZFnt52D7Z3rIekxiTFFc3NaCLBuh/7 CNLRL9J7KnAXlX8ltLAyEa7/CNQ+MKLDOpJYKZLF9vh6my2BeR8t5o53zi73Emt3xf7o QltGjMy2x6AZD4SCcw1KGx9kd2VEBQWtg+NSssPevcbhVzT6b8cG5ML0WAxZmQqwFig0 Z/ALv8+CohfYiwNAhgA+89xuXH5EpUuaSqo57AmUstrA/lCQYNX0uC5QSJwgphVjlVhE nbgw== X-Gm-Message-State: ACgBeo0YlEhRCoA+dKkOoPvIxiVN1IIjOabqwZcnRANEOtOueECcoa8B kNBgyGrd4HPqSXqxdn7RHgYzpw== X-Google-Smtp-Source: AA6agR43ad1H67iYqG96lMocavvppV8zgz+b9UrSeC3ePZxxXxs65ZNTdvSvBMk/g9sysod3aMZRZA== X-Received: by 2002:a05:6808:1644:b0:2f7:4de5:3c53 with SMTP id az4-20020a056808164400b002f74de53c53mr3689485oib.225.1659614696142; Thu, 04 Aug 2022 05:04:56 -0700 (PDT) Received: from anup-ubuntu64-vm.. ([103.97.165.210]) by smtp.gmail.com with ESMTPSA id r13-20020a056871088d00b000f5f4ad194bsm93184oaq.25.2022.08.04.05.04.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Aug 2022 05:04:55 -0700 (PDT) From: Anup Patel To: Atish Patra , Alistair Francis Cc: Andrew Jones , David Abdurachmanov , Heinrich Schuchardt , Andreas Schwab , Mark Kettenis , Emmanuel Vadot , Anup Patel , opensbi@lists.infradead.org, Anup Patel Subject: [PATCH v6 02/17] Makefile: Add initial kconfig support for each platform Date: Thu, 4 Aug 2022 17:34:14 +0530 Message-Id: <20220804120429.59444-3-apatel@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220804120429.59444-1-apatel@ventanamicro.com> References: <20220804120429.59444-1-apatel@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220804_050457_840862_3CCE7BE8 X-CRM114-Status: GOOD ( 15.00 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: We extend the top-level makefile to allow kconfig based configuration for each platform where each platform has it's own set of configs with "defconfig" being the default config. Signed-off-by: Anup Patel Tested-by: Andrew Jones --- Kconfig | 23 +++++++++ Makefile | 57 +++++++++++++++++++++-- firmware/Kconfig | 1 + lib/utils/ [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:235 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org We extend the top-level makefile to allow kconfig based configuration for each platform where each platform has it's own set of configs with "defconfig" being the default config. Signed-off-by: Anup Patel Tested-by: Andrew Jones --- Kconfig | 23 +++++++++ Makefile | 57 +++++++++++++++++++++-- firmware/Kconfig | 1 + lib/utils/Kconfig | 1 + platform/andes/ae350/Kconfig | 5 ++ platform/andes/ae350/configs/defconfig | 0 platform/fpga/ariane/Kconfig | 5 ++ platform/fpga/ariane/configs/defconfig | 0 platform/fpga/openpiton/Kconfig | 5 ++ platform/fpga/openpiton/configs/defconfig | 0 platform/generic/Kconfig | 5 ++ platform/generic/configs/defconfig | 0 platform/kendryte/k210/Kconfig | 5 ++ platform/kendryte/k210/configs/defconfig | 0 platform/nuclei/ux600/Kconfig | 5 ++ platform/nuclei/ux600/configs/defconfig | 0 platform/template/Kconfig | 5 ++ platform/template/configs/defconfig | 0 18 files changed, 114 insertions(+), 3 deletions(-) create mode 100644 Kconfig create mode 100644 firmware/Kconfig create mode 100644 lib/utils/Kconfig create mode 100644 platform/andes/ae350/Kconfig create mode 100644 platform/andes/ae350/configs/defconfig create mode 100644 platform/fpga/ariane/Kconfig create mode 100644 platform/fpga/ariane/configs/defconfig create mode 100644 platform/fpga/openpiton/Kconfig create mode 100644 platform/fpga/openpiton/configs/defconfig create mode 100644 platform/generic/Kconfig create mode 100644 platform/generic/configs/defconfig create mode 100644 platform/kendryte/k210/Kconfig create mode 100644 platform/kendryte/k210/configs/defconfig create mode 100644 platform/nuclei/ux600/Kconfig create mode 100644 platform/nuclei/ux600/configs/defconfig create mode 100644 platform/template/Kconfig create mode 100644 platform/template/configs/defconfig diff --git a/Kconfig b/Kconfig new file mode 100644 index 0000000..b3213a9 --- /dev/null +++ b/Kconfig @@ -0,0 +1,23 @@ +# SPDX-License-Identifier: BSD-2-Clause + +mainmenu "OpenSBI $(OPENSBI_PLATFORM) Configuration" + +config OPENSBI_SRC_DIR + string + option env="OPENSBI_SRC_DIR" + +config OPENSBI_PLATFORM + string + option env="OPENSBI_PLATFORM" + +config OPENSBI_PLATFORM_SRC_DIR + string + option env="OPENSBI_PLATFORM_SRC_DIR" + +menu "Platform Options" +source "$(OPENSBI_PLATFORM_SRC_DIR)/Kconfig" +endmenu + +source "$(OPENSBI_SRC_DIR)/lib/utils/Kconfig" + +source "$(OPENSBI_SRC_DIR)/firmware/Kconfig" diff --git a/Makefile b/Makefile index f619ef7..677ea83 100644 --- a/Makefile +++ b/Makefile @@ -52,6 +52,9 @@ ifdef PLATFORM_DIR else platform_parent_dir=$(src_dir)/platform endif +ifndef PLATFORM_DEFCONFIG +PLATFORM_DEFCONFIG=defconfig +endif # Check if verbosity is ON for build process CMD_PREFIX_DEFAULT := @ @@ -70,6 +73,20 @@ export libsbi_dir=$(CURDIR)/lib/sbi export libsbiutils_dir=$(CURDIR)/lib/utils export firmware_dir=$(CURDIR)/firmware +# Setup variables for kconfig +ifdef PLATFORM +export PYTHONDONTWRITEBYTECODE=1 +export KCONFIG_DIR=$(platform_build_dir)/kconfig +export KCONFIG_AUTOLIST=$(KCONFIG_DIR)/auto.list +export KCONFIG_AUTOHEADER=$(KCONFIG_DIR)/autoconf.h +export KCONFIG_AUTOCMD=$(KCONFIG_DIR)/auto.conf.cmd +export KCONFIG_CONFIG=$(KCONFIG_DIR)/.config +# Additional exports for include paths in Kconfig files +export OPENSBI_SRC_DIR=$(src_dir) +export OPENSBI_PLATFORM=$(PLATFORM) +export OPENSBI_PLATFORM_SRC_DIR=$(platform_src_dir) +endif + # Find library version OPENSBI_VERSION_MAJOR=`grep "define OPENSBI_VERSION_MAJOR" $(include_dir)/sbi/sbi_version.h | sed 's/.*MAJOR.*\([0-9][0-9]*\)/\1/'` OPENSBI_VERSION_MINOR=`grep "define OPENSBI_VERSION_MINOR" $(include_dir)/sbi/sbi_version.h | sed 's/.*MINOR.*\([0-9][0-9]*\)/\1/'` @@ -183,8 +200,36 @@ libsbi-object-mks=$(shell if [ -d $(libsbi_dir) ]; then find $(libsbi_dir) -inam libsbiutils-object-mks=$(shell if [ -d $(libsbiutils_dir) ]; then find $(libsbiutils_dir) -iname "objects.mk" | sort -r; fi) firmware-object-mks=$(shell if [ -d $(firmware_dir) ]; then find $(firmware_dir) -iname "objects.mk" | sort -r; fi) -# Include platform specifig config.mk +# The "make all" rule should always be first rule +.PHONY: all +all: + +# Include platform specific .config and config.mk ifdef PLATFORM +.PHONY: menuconfig +menuconfig: $(platform_src_dir)/Kconfig $(src_dir)/Kconfig + $(CMD_PREFIX)mkdir -p $(KCONFIG_DIR) + $(CMD_PREFIX)$(src_dir)/scripts/Kconfiglib/menuconfig.py $(src_dir)/Kconfig + $(CMD_PREFIX)$(src_dir)/scripts/Kconfiglib/genconfig.py --header-path $(KCONFIG_AUTOHEADER) --sync-deps $(KCONFIG_DIR) --file-list $(KCONFIG_AUTOLIST) $(src_dir)/Kconfig + +.PHONY: savedefconfig +savedefconfig: $(platform_src_dir)/Kconfig $(src_dir)/Kconfig + $(CMD_PREFIX)mkdir -p $(KCONFIG_DIR) + $(CMD_PREFIX)$(src_dir)/scripts/Kconfiglib/savedefconfig.py --kconfig $(src_dir)/Kconfig --out $(KCONFIG_DIR)/defconfig + +$(KCONFIG_CONFIG): $(platform_src_dir)/configs/$(PLATFORM_DEFCONFIG) $(platform_src_dir)/Kconfig $(src_dir)/Kconfig + $(CMD_PREFIX)mkdir -p $(KCONFIG_DIR) + $(CMD_PREFIX)$(src_dir)/scripts/Kconfiglib/defconfig.py --kconfig $(src_dir)/Kconfig $(platform_src_dir)/configs/$(PLATFORM_DEFCONFIG) + $(CMD_PREFIX)$(src_dir)/scripts/Kconfiglib/genconfig.py --header-path $(KCONFIG_AUTOHEADER) --sync-deps $(KCONFIG_DIR) --file-list $(KCONFIG_AUTOLIST) $(src_dir)/Kconfig + +$(KCONFIG_AUTOCMD): $(KCONFIG_CONFIG) + $(CMD_PREFIX)mkdir -p $(KCONFIG_DIR) + $(CMD_PREFIX)echo -n "$(KCONFIG_CONFIG): " > $(KCONFIG_AUTOCMD) + $(CMD_PREFIX)cat $(KCONFIG_AUTOLIST) | tr '\n' ' ' >> $(KCONFIG_AUTOCMD) + +include $(KCONFIG_CONFIG) +include $(KCONFIG_AUTOCMD) + include $(platform_src_dir)/config.mk endif @@ -280,6 +325,9 @@ ifeq ($(BUILD_INFO),y) GENFLAGS += -DOPENSBI_BUILD_TIME_STAMP="\"$(OPENSBI_BUILD_TIME_STAMP)\"" GENFLAGS += -DOPENSBI_BUILD_COMPILER_VERSION="\"$(OPENSBI_BUILD_COMPILER_VERSION)\"" endif +ifdef PLATFORM +GENFLAGS += -include $(KCONFIG_AUTOHEADER) +endif GENFLAGS += $(libsbiutils-genflags-y) GENFLAGS += $(platform-genflags-y) GENFLAGS += $(firmware-genflags-y) @@ -419,7 +467,7 @@ targets-y += $(platform_build_dir)/lib/libplatsbi.a endif targets-y += $(firmware-bins-path-y) -# Default rule "make" should always be first rule +# The default "make all" rule .PHONY: all all: $(targets-y) @@ -456,7 +504,7 @@ $(build_dir)/%.o: $(src_dir)/%.S $(call compile_as,$@,$<) $(build_dir)/%.dep: $(src_dir)/%.carray - $(call compile_gen_dep,$@,.c,$<) + $(call compile_gen_dep,$@,.c,$< $(KCONFIG_CONFIG)) $(call compile_gen_dep,$@,.o,$(@:.dep=.c)) $(build_dir)/%.c: $(src_dir)/%.carray @@ -523,6 +571,9 @@ docs: $(build_dir)/docs/latex/refman.pdf # They should not be included for any "xxxconfig" or "xxxclean" rule all-deps-1 = $(if $(findstring config,$(MAKECMDGOALS)),,$(deps-y)) all-deps-2 = $(if $(findstring clean,$(MAKECMDGOALS)),,$(all-deps-1)) +ifdef PLATFORM +$(all-deps-2): | $(KCONFIG_CONFIG) +endif -include $(all-deps-2) # Include external dependency of firmwares after default Makefile rules diff --git a/firmware/Kconfig b/firmware/Kconfig new file mode 100644 index 0000000..d6e0506 --- /dev/null +++ b/firmware/Kconfig @@ -0,0 +1 @@ +# SPDX-License-Identifier: BSD-2-Clause diff --git a/lib/utils/Kconfig b/lib/utils/Kconfig new file mode 100644 index 0000000..d6e0506 --- /dev/null +++ b/lib/utils/Kconfig @@ -0,0 +1 @@ +# SPDX-License-Identifier: BSD-2-Clause diff --git a/platform/andes/ae350/Kconfig b/platform/andes/ae350/Kconfig new file mode 100644 index 0000000..4b73c76 --- /dev/null +++ b/platform/andes/ae350/Kconfig @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: BSD-2-Clause + +config PLATFORM_ANDES_AE350 + bool + default y diff --git a/platform/andes/ae350/configs/defconfig b/platform/andes/ae350/configs/defconfig new file mode 100644 index 0000000..e69de29 diff --git a/platform/fpga/ariane/Kconfig b/platform/fpga/ariane/Kconfig new file mode 100644 index 0000000..70d2004 --- /dev/null +++ b/platform/fpga/ariane/Kconfig @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: BSD-2-Clause + +config PLATFORM_ARIANE_FPGA + bool + default y diff --git a/platform/fpga/ariane/configs/defconfig b/platform/fpga/ariane/configs/defconfig new file mode 100644 index 0000000..e69de29 diff --git a/platform/fpga/openpiton/Kconfig b/platform/fpga/openpiton/Kconfig new file mode 100644 index 0000000..81e4b76 --- /dev/null +++ b/platform/fpga/openpiton/Kconfig @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: BSD-2-Clause + +config PLATFORM_OPENPITON_FPGA + bool + default y diff --git a/platform/fpga/openpiton/configs/defconfig b/platform/fpga/openpiton/configs/defconfig new file mode 100644 index 0000000..e69de29 diff --git a/platform/generic/Kconfig b/platform/generic/Kconfig new file mode 100644 index 0000000..3eab282 --- /dev/null +++ b/platform/generic/Kconfig @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: BSD-2-Clause + +config PLATFORM_GENERIC + bool + default y diff --git a/platform/generic/configs/defconfig b/platform/generic/configs/defconfig new file mode 100644 index 0000000..e69de29 diff --git a/platform/kendryte/k210/Kconfig b/platform/kendryte/k210/Kconfig new file mode 100644 index 0000000..889f16b --- /dev/null +++ b/platform/kendryte/k210/Kconfig @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: BSD-2-Clause + +config PLATFORM_KENDRYTE_K210 + bool + default y diff --git a/platform/kendryte/k210/configs/defconfig b/platform/kendryte/k210/configs/defconfig new file mode 100644 index 0000000..e69de29 diff --git a/platform/nuclei/ux600/Kconfig b/platform/nuclei/ux600/Kconfig new file mode 100644 index 0000000..c368ef4 --- /dev/null +++ b/platform/nuclei/ux600/Kconfig @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: BSD-2-Clause + +config PLATFORM_NUCLEI_UX600 + bool + default y diff --git a/platform/nuclei/ux600/configs/defconfig b/platform/nuclei/ux600/configs/defconfig new file mode 100644 index 0000000..e69de29 diff --git a/platform/template/Kconfig b/platform/template/Kconfig new file mode 100644 index 0000000..b9c4350 --- /dev/null +++ b/platform/template/Kconfig @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: BSD-2-Clause + +config PLATFORM_TEMPLATE + bool + default y diff --git a/platform/template/configs/defconfig b/platform/template/configs/defconfig new file mode 100644 index 0000000..e69de29