From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B9F83C433EF for ; Fri, 17 Dec 2021 04:05:05 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DC25F83793; Fri, 17 Dec 2021 05:02:40 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="g9kEoCGq"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 60FDB83420; Fri, 17 Dec 2021 05:01:08 +0100 (CET) Received: from mail-oi1-x22c.google.com (mail-oi1-x22c.google.com [IPv6:2607:f8b0:4864:20::22c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 0EAE9832FC for ; Fri, 17 Dec 2021 05:00:32 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-oi1-x22c.google.com with SMTP id q25so1925526oiw.0 for ; Thu, 16 Dec 2021 20:00:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UbfKzqlnCh16eWA//YLA0uBSTJpdY1FWNQK2C8BIo3w=; b=g9kEoCGqlBebyKZGn/rYcMNee8T8pBGRXNUA8bonkCpL2NzO+R5cC6kCBQy+KTtOid mlCLwmZELdvmJwpyf5u5hAvZ8ZbKbZrJALUHnyPUXij+GEotC68kXi+Mfdot6UUPXpnq PWHN4+0WRD5aZ2pDrfc+PWCFxEfWJQAc23Hp4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UbfKzqlnCh16eWA//YLA0uBSTJpdY1FWNQK2C8BIo3w=; b=eMgGdVTzMTbgx+ZyhjCoGdCLUX9YySXUtx5SQwJlOyhw+jTZMlqD/h9l7a3VEeQO7X SPWaZuBRUctPJa5uZjcb6b2B/ywNFyWEKgMawStyQEebV6+HdMaxMbPGqkOZC6HMUDvE cB/7Mv+I6KsFJe1ns7wqxAu44bX/ZkjzY9tV9REcqf/hKNj2ossqyMRkQDLXYvHYnibC zNgK+gzNyVjwi5euD3dq9FhgXHmh9fs3nX4NSbm9VoDk0OKxc2n5ymCuh+rZMgfSwfAN 7xTYivPz9mlEQvhI6JN7rN0Eg9h1iFeDjqB5WjqVeFx4eCRFFW+8I84pEbK/n2IZnNxa Yp4g== X-Gm-Message-State: AOAM531OUC04vUGj/UpnxaCuuQTgwEpI1oBfsfKcujKjiJ2Yp1NuGKa1 stoA9JbNKh4JIzTigCjlsoCGJ2HizRPu/w== X-Google-Smtp-Source: ABdhPJyiQS4AikEKwI8qEaMLMxlATu/NwKSvuUVZBaL8pQuoehxzTMerdWL3OSgrWD5r1KatAkFj+A== X-Received: by 2002:a54:4701:: with SMTP id k1mr6474746oik.37.1639713630562; Thu, 16 Dec 2021 20:00:30 -0800 (PST) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id h14sm1431249ots.22.2021.12.16.20.00.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Dec 2021 20:00:30 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Sean Anderson , Heinrich Schuchardt , Tom Rini , Mark Kettenis , =?UTF-8?q?Fran=C3=A7ois=20Ozog?= , Simon Glass , Jerry Van Baren , Masahiro Yamada Subject: [PATCH v8 30/32] fdt: Makefile: Ensure that OF_BOARD is used when needed Date: Thu, 16 Dec 2021 20:59:37 -0700 Message-Id: <20211217035939.670884-30-sjg@chromium.org> X-Mailer: git-send-email 2.34.1.173.g76aa8bc2d0-goog In-Reply-To: <20211217035939.670884-1-sjg@chromium.org> References: <20211217035939.670884-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.38 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Boards which define OF_HAS_PRIOR_STAGE must define OF_BOARD at present, since a custom function is the only way to obtain the devicetree at runtime. Add a build error when this requirement is not met, to avoid accepting any patches which break this requirement. Add a whitelist for boards which use it, currently none. This whitelist can be updated for local development, if needed. Signed-off-by: Simon Glass --- Changes in v8: - Add new patch to ensure that OF_BOARD is used when needed Makefile | 7 +++++++ scripts/check-of.sh | 42 ++++++++++++++++++++++++++++++++++++++++ scripts/of_whitelist.txt | 1 + 3 files changed, 50 insertions(+) create mode 100755 scripts/check-of.sh create mode 100644 scripts/of_whitelist.txt diff --git a/Makefile b/Makefile index 6671c5d9e2f..98ef2642f68 100644 --- a/Makefile +++ b/Makefile @@ -1061,6 +1061,10 @@ quiet_cmd_cfgcheck = CFGCHK $2 cmd_cfgcheck = $(srctree)/scripts/check-config.sh $2 \ $(srctree)/scripts/config_whitelist.txt $(srctree) +quiet_cmd_ofcheck = OFCHK $2 +cmd_ofcheck = $(srctree)/scripts/check-of.sh $2 \ + $(srctree)/scripts/of_whitelist.txt + # Concat the value of all the CONFIGs (result is 'y' or 'yy', etc. ) got = $(foreach cfg,$(1),$($(cfg))) @@ -1139,6 +1143,9 @@ endif @# know about unless they are in Kconfig. All the existing CONFIG @# options are whitelisted, so new ones should not be added. $(call cmd,cfgcheck,u-boot.cfg) + @# Check that this build does not override OF_HAS_PRIOR_STAGE by + @# disabling OF_BOARD. + $(call cmd,ofcheck,$(KCONFIG_CONFIG)) PHONY += dtbs dtbs: dts/dt.dtb diff --git a/scripts/check-of.sh b/scripts/check-of.sh new file mode 100755 index 00000000000..3ce7105cad4 --- /dev/null +++ b/scripts/check-of.sh @@ -0,0 +1,42 @@ +#!/bin/sh +# Copyright 2021 Google LLC +# Written by Simon Glass +# +# Check that the .config file provided does not try to disable OF_BOARD for +# boards that use CONFIG_OF_HAS_PRIOR_STAGE +# +# Usage +# check-of.sh +# +# For example: +# scripts/check-of.sh b/chromebook_link/u-boot.cfg kconfig_whitelist.txt +# +# Exit code is 0 if OK, 3 if the .config is wrong, as above + +set -e +set -u + +PROG_NAME="${0##*/}" + +usage() { + echo "$PROG_NAME " + exit 1 +} + +[ $# -ge 2 ] || usage + +path="$1" +whitelist="$2" + +sys_config="$(sed -n 's/CONFIG_SYS_CONFIG_NAME="\(.*\)"$/\1/p' "${path}")" + +if grep -q OF_HAS_PRIOR_STAGE=y "${path}"; then + if ! grep -lq CONFIG_OF_BOARD=y "${path}"; then + echo >&2 "This board uses a prior stage to provide the device tree." + echo >&2 "Please enable CONFIG_OF_BOARD to ensure that it works correctly." + if grep -q "${sys_config}" "${whitelist}"; then + exit 0 + fi + exit 3 + fi +fi diff --git a/scripts/of_whitelist.txt b/scripts/of_whitelist.txt new file mode 100644 index 00000000000..e82cf557bb2 --- /dev/null +++ b/scripts/of_whitelist.txt @@ -0,0 +1 @@ +# List of boards which are permitted to use OF_HAS_PRIOR_STAGE without OF_BOARD -- 2.34.1.173.g76aa8bc2d0-goog