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 8909FC43334 for ; Sun, 10 Jul 2022 11:43:38 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1C144845B5; Sun, 10 Jul 2022 13:43:36 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="bY2BD3HX"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 90444845B5; Sun, 10 Jul 2022 13:43:33 +0200 (CEST) Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id DF6E9843A2 for ; Sun, 10 Jul 2022 13:43:29 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 73EE5B8075D; Sun, 10 Jul 2022 11:43:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11783C3411E; Sun, 10 Jul 2022 11:43:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1657453408; bh=Nckc76kjd2iHdDKAV1C8+qKAUGvgk4ihbbea4QpuPEk=; h=From:To:Cc:Subject:Date:From; b=bY2BD3HXp+9D9xUBfDIYQOs9T/hhYAAhCEuyyvL7Zb6iRGIdnTX+NoLl/sONgONLC 8Ci9E6g5zW2a5btOfflKHFYNupZGCIF44x+zr8oTpr3HojTBu6ClnqWw2olMIjfiRO N714sz87w5X9YHTLy9CNxiLEPaeS9w8GsZ20Wa3sp9+BgrwnYK2NrEXtfywsT1rx2c IQtlssb67IdGyy5pabQIl10FNs3qHpAQ5iL0q61IZRApyhvOD8ZiYsfuIQZ5G46l3Q Tfj9RCgSr8lRv6sxFzXOcWLiTN5OOfPlX/H0IA55d90pRiNxbjEYlFWDpcvq0tV97F mPQg18WAfOzLg== Received: by pali.im (Postfix) id 9599677C; Sun, 10 Jul 2022 13:43:25 +0200 (CEST) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Troy Kisky , Joe Hershberger , Wolfgang Denk , Simon Glass Cc: u-boot@lists.denx.de Subject: [PATCH 1/2] Fix usage of CONFIG_PREBOOT Date: Sun, 10 Jul 2022 13:42:55 +0200 Message-Id: <20220710114256.27322-1-pali@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.6 at phobos.denx.de X-Virus-Status: Clean Due to usage of PREBOOT in Kconfig, macro CONFIG_PREBOOT is always defined when CONFIG_USE_PREBOOT is enabled. In case CONFIG_PREBOOT is not explicitly enabled it is set to empty C string and therefore '#ifdef CONFIG_PREBOOT' guard does not work. Fix this issue by introducing a new Kconfig symbol PREBOOT_DEFINED which cause to define new C macro CONFIG_PREBOOT_DEFINED only when CONFIG_PREBOOT is really defined. Change usage of '#ifdef CONFIG_PREBOOT' by '#ifdef CONFIG_USE_PREBOOT' for code which checks if preboot code would be called and by '#ifdef CONFIG_PREBOOT_DEFINED' for defining preboot code. Signed-off-by: Pali Rohár --- board/boundary/nitrogen6x/nitrogen6x.c | 4 ++-- boot/Kconfig | 4 ++++ include/env_default.h | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/board/boundary/nitrogen6x/nitrogen6x.c b/board/boundary/nitrogen6x/nitrogen6x.c index 83bb445d481a..382c01ddf4e0 100644 --- a/board/boundary/nitrogen6x/nitrogen6x.c +++ b/board/boundary/nitrogen6x/nitrogen6x.c @@ -929,7 +929,7 @@ U_BOOT_CMD( "Returns 0 (true) to shell if key is pressed." ); -#ifdef CONFIG_PREBOOT +#ifdef CONFIG_USE_PREBOOT static char const kbd_magic_prefix[] = "key_magic"; static char const kbd_command_prefix[] = "key_cmd"; @@ -989,7 +989,7 @@ int misc_init_r(void) gpio_request(IMX_GPIO_NR(2, 3), "search"); gpio_request(IMX_GPIO_NR(7, 13), "volup"); gpio_request(IMX_GPIO_NR(4, 5), "voldown"); -#ifdef CONFIG_PREBOOT +#ifdef CONFIG_USE_PREBOOT preboot_keys(); #endif diff --git a/boot/Kconfig b/boot/Kconfig index 08451c65a56b..5e7ae61d5116 100644 --- a/boot/Kconfig +++ b/boot/Kconfig @@ -1309,6 +1309,10 @@ config PREBOOT help This is the default of "preboot" environment variable. +config PREBOOT_DEFINED + bool + default y if PREBOOT != "" + config DEFAULT_FDT_FILE string "Default fdt file" help diff --git a/include/env_default.h b/include/env_default.h index 7004a6fef29b..62a73b939cf2 100644 --- a/include/env_default.h +++ b/include/env_default.h @@ -62,7 +62,7 @@ const char default_environment[] = { #ifdef CONFIG_SYS_AUTOLOAD "autoload=" CONFIG_SYS_AUTOLOAD "\0" #endif -#ifdef CONFIG_PREBOOT +#ifdef CONFIG_PREBOOT_DEFINED "preboot=" CONFIG_PREBOOT "\0" #endif #ifdef CONFIG_ROOTPATH -- 2.20.1