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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6AE9C433F5 for ; Mon, 27 Sep 2021 20:18:42 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 1A9F160FF2 for ; Mon, 27 Sep 2021 20:18:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 1A9F160FF2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D957482FC0; Mon, 27 Sep 2021 22:18:36 +0200 (CEST) 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="KFpg5OR5"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 897A282E8E; Mon, 27 Sep 2021 22:18:13 +0200 (CEST) Received: from mail-vs1-xe32.google.com (mail-vs1-xe32.google.com [IPv6:2607:f8b0:4864:20::e32]) (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 9206682E88 for ; Mon, 27 Sep 2021 22:18:08 +0200 (CEST) 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@google.com Received: by mail-vs1-xe32.google.com with SMTP id az15so19554230vsb.8 for ; Mon, 27 Sep 2021 13:18:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+EH3KvXb7I9kU71wMRHu7uy2yKGaKBJfEz5e8CfEwy4=; b=KFpg5OR5OCi0DnnHs2djTCzV4bC9kZWeqdikckKhPVaXfsVKp+wUfkjvSTZYU6oRKI 7tm584BAR4V+kaV4oH0Z9cGvhVBQoQutFKI2iuHOBGE6IJKVN3pNXv69Z4OiVS9c3xmy disInvInI61/G39sc7OIoImF+Qv/HMemrzZBg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+EH3KvXb7I9kU71wMRHu7uy2yKGaKBJfEz5e8CfEwy4=; b=RRiZX6Ih9NmVD7W3wfwneibY8+IHcCJTw8DNw0hVpo9p3yKsLx4nSnbl5EgsxHn3wO a3hYXoS29dPiEnzGXolKPt+0D/tN3RGSEh4zbtWiR2CMaYgJKV6+Jt5L/ypR6vk6FgVG VXu7hbjHKA0frbKaLOv8OK8CB8b6Brz3FEUQoCdqlFDo3U/vPcaW/cYq4kVJcr2oDfFo Gzk/NwEQ3u7NsyI4TfcA4whz5jOaPbyrsugFgPxvi4eE4LkvnLwJZHdRDeguIkwNQx+P Pa6z0P7ezrrGdZDqVHVorPcvXQ6iXYgBkuSRrMMYcm23kL8H0NlIIdCepOGa2zZGPwGt hoYg== X-Gm-Message-State: AOAM532aJdaVtiLmjuhuxg9I16NVP2zvTAfbjQpC6az+ZoNKE/1gUU6P 9Ctj9V75d9oXKjSbh9u3gseHhHLWduC8kkTYzZih+g== X-Google-Smtp-Source: ABdhPJy+nSsrFGyeqBc/+qgMN9raCX4w9WkKL8xSztulgXF+nFCaysqU63V1BIsgesyhjTHNmKZG3WtwMAMJUFgiIRY= X-Received: by 2002:a67:f801:: with SMTP id l1mr2207711vso.59.1632773887134; Mon, 27 Sep 2021 13:18:07 -0700 (PDT) MIME-Version: 1.0 References: <20210926014342.127913-1-sjg@chromium.org> <20210926014342.127913-3-sjg@chromium.org> In-Reply-To: From: Simon Glass Date: Mon, 27 Sep 2021 14:17:56 -0600 Message-ID: Subject: Re: [PATCH v5 02/29] kconfig: Add tools support to CONFIG_IS_ENABLED() To: Masahiro Yamada Cc: "Alex G." , U-Boot Mailing List , Andre Przywara , Rasmus Villemoes , Robert Marko , Tom Rini Content-Type: text/plain; charset="UTF-8" X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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 Hi Masahiro, On Mon, 27 Sept 2021 at 10:51, Masahiro Yamada wrote: > > On Tue, Sep 28, 2021 at 1:11 AM Alex G. wrote: > > > > > > > > On 9/25/21 8:43 PM, Simon Glass wrote: > > > At present we must separately test for the host build for many options, > > > since we force them to be enabled. For example, CONFIG_FIT is always > > > enabled in the host tools, even if CONFIG_FIT is not enabled by the > > > board itself. > > > > > > It would be more convenient if we could use, for example, > > > CONFIG_IS_ENABLED(FIT) and get CONFIG_HOST_FIT, when building for the > > > host. Add support for this. > > > > > > With this and the tools_build() function, we should be able to remove all > > > the #ifdefs currently needed in code that is build by tools and targets. > > > > > > This will be even nicer when we move to using CONFIG(xxx) everywhere, > > > since all the #ifdef and IS_ENABLED/CONFIG_IS_ENABLED stuff will go away. > > > > > > Signed-off-by: Simon Glass > > > Suggested-by: Rasmus Villemoes # b4f73886 > > > --- > > > > In my vision, the host tools are target-agostic. They always support the > > same feature set: all features. From that point of view, it doesn't make > > sense to have options which enable or disable tools features. > > > Agree. > Host tools should not depend on any CONFIG option. Agreed, although arguably that is not quite what is happening here, We need some way for shared code to work, so the options are: if (tools_build() || CONFIG_IS_ENABLED(FIT_SIGNATURE)) or: if (CONFIG_IS_ENABLED(FIT_SIGNATURE)) I believe the second is better. BTW we do have a series to drop IS_ENABLED() and CONFIG_IS_ENABLED() and move to just CONFIG() so it would be: if (CONFIG(FIT_SIGNATURE)) > > In Linux kernel, most host tools are target-agnostic. > (It is true there are some exceptions such as objtool, > modpost, etc. but in theory we can make all of them > target-agnostic) > > In fact, U-Boot made much more tools target-dependent. > They must be rebuilt every time you change the configuration. Can you give some examples? We have tried for the exact opposite of that and should fix any instances we find. > > For example, mkimage in U-Boot supports many boards > and depends on the configuration. > It makes less sense to support all sort of board-specific > firmware in a huge single host tool. Maybe, but I would much prefer that there is one mkimage that supports everything. > > > In contrast, Barebox splits it into small programs, > zynq_mkimage, socfpga_mkimage, etc., > each of which is target-agnostic. [1] > Makefile decides only whether each program should be built or not. > > [1] https://github.com/saschahauer/barebox/blob/v2021.07.0/scripts/Makefile#L22 How does it share code between boards and tools which includes CONFIG options? Regards, Simon [..]