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 5D1CCC4332F for ; Fri, 14 Oct 2022 08:43:40 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C9D3684CEC; Fri, 14 Oct 2022 10:43:37 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=suse.de 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=suse.de header.i=@suse.de header.b="UDE3pNxU"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="flfcw6B4"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DA73484DE8; Fri, 14 Oct 2022 10:43:35 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 3FDD184CEC for ; Fri, 14 Oct 2022 10:43:33 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=msuchanek@suse.de Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id EF66521FD8; Fri, 14 Oct 2022 08:43:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1665737012; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=cCwiZdcAy1YKMaJvawYg2HU16dqG5Qgax2/IaQ8ariY=; b=UDE3pNxUqjV6dPXotqmoNC45IYilEyDWLhkv/4vuWOE8/IETYvEoZD0grge6m8bs8Dh9nU 7cOCa4PYVD/gLBpGSP+FFhssqREQm8nJ7Wq49abGPv+0b1a/aRwRtfPPmwXUgbD0OcAN1U sdxUbxpaDRU7X+w6iZSaJsHeZj6cRrI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1665737012; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=cCwiZdcAy1YKMaJvawYg2HU16dqG5Qgax2/IaQ8ariY=; b=flfcw6B4P8rGdpAetpG6t1D8tn9RQqoUn66iQ6BiKj+BPXt9k8mQ1YfWI7RM1ALVHjPW/v vlKEDsPExEL6W8DQ== Received: from kitsune.suse.cz (kitsune.suse.cz [10.100.12.127]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 821182C142; Fri, 14 Oct 2022 08:43:32 +0000 (UTC) Date: Fri, 14 Oct 2022 10:43:31 +0200 From: Michal =?iso-8859-1?Q?Such=E1nek?= To: Heinrich Schuchardt Cc: AKASHI Takahiro , Heiko Thiery , Marek =?iso-8859-1?Q?Beh=FAn?= , Pali =?iso-8859-1?Q?Roh=E1r?= , Quentin Schulz , Samuel Holland , Simon Glass , Stefan Roese , Weijie Gao , u-boot@lists.denx.de Subject: Re: [PATCH] tests: Build correct sandbox configuration on 32bit Message-ID: <20221014084331.GI28810@kitsune.suse.cz> References: <20221013202855.13904-1-msuchanek@suse.de> <1e2f9172-10a5-e471-0e0b-7aa14905de2c@gmx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1e2f9172-10a5-e471-0e0b-7aa14905de2c@gmx.de> User-Agent: Mutt/1.10.1 (2018-07-13) 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 On Fri, Oct 14, 2022 at 05:05:26AM +0200, Heinrich Schuchardt wrote: > On 10/13/22 22:28, Michal Suchanek wrote: > > Currently sandbox configuration defautls to 64bit and there is no > > automation for building 32bit sandbox on 32bit hosts. > > > > cpp does not know about target specification, code needs to be compiled > > to determine integer width. > > > > Add a test program that prints the integer width, and a make target that > > aligns the sandbox configuration with the result. > > > > Signed-off-by: Michal Suchanek > > --- > > > > Makefile | 6 ++++++ > > doc/arch/sandbox.rst | 16 +++++++++++----- > > test/py/conftest.py | 1 + > > tools/Makefile | 2 ++ > > tools/bits-per-long.c | 14 ++++++++++++++ > > 5 files changed, 34 insertions(+), 5 deletions(-) > > create mode 100644 tools/bits-per-long.c > > > > diff --git a/Makefile b/Makefile > > index 3866cc62f9..e5463573f3 100644 > > --- a/Makefile > > +++ b/Makefile > > @@ -2166,6 +2166,12 @@ tools-all: envtools tools ; > > cross_tools: export CROSS_BUILD_TOOLS=y > > cross_tools: tools ; > > > > +PHONY += set_host_bits > > +set_host_bits: tools > > + $(Q)sed -i -e /CONFIG_HOST_$$($(objtree)/tools/bits-per-long)BIT/d $(KCONFIG_CONFIG) > > + $(Q)sed -i -E -e "s/CONFIG_HOST_(..)BIT=y/# CONFIG_HOST_\1BIT is not set/" $(KCONFIG_CONFIG) > > + $(Q)echo CONFIG_HOST_$$($(objtree)/tools/bits-per-long)BIT=y >> $(KCONFIG_CONFIG) > > + > > .PHONY : CHANGELOG > > CHANGELOG: > > git log --no-merges U-Boot-1_1_5.. | \ > > diff --git a/doc/arch/sandbox.rst b/doc/arch/sandbox.rst > > index 068d4a3be4..d751205eba 100644 > > --- a/doc/arch/sandbox.rst > > +++ b/doc/arch/sandbox.rst > > @@ -33,9 +33,11 @@ machines. > > > > There are two versions of the sandbox: One using 32-bit-wide integers, and one > > using 64-bit-wide integers. The 32-bit version can be build and run on either > > -32 or 64-bit hosts by either selecting or deselecting CONFIG_SANDBOX_32BIT; by > > -default, the sandbox it built for a 32-bit host. The sandbox using 64-bit-wide > > -integers can only be built on 64-bit hosts. > > +32 or 64-bit hosts by either selecting or deselecting HOST_64BIT; by > > +default, the sandbox it built for a 64-bit host. The sandbox using 64-bit-wide > > +integers can only be built on 64-bit hosts. There is no automation for ensuring > > +32bit build on 32bit hosts - use ``make set_host_bits`` to adjust the sandbox > > +config. > > > > Note that standalone/API support is not available at present. > > > > @@ -51,7 +53,9 @@ Basic Operation > > > > To run sandbox U-Boot use something like:: > > > > - make sandbox_defconfig all > > + make sandbox_defconfig > > + make set_host_bits > > + make all > > Thanks for addressing the problem of sandbox bitness. > > We should not make building the sandbox more complicated. You could > integrate building set_host_bits into an existing target like u-boot.cfg:. > > Overall an approach with an external program is too complicated. > CONFIG_HOST_32BIT and CONFIG_HOST_64BIT are used to define > CONFIG_SANDBOX_BITS_PER_LONG. And for making SANDBOX64 depend on 64bit build. > > We could add > > #ifndef __LP64__ > #undef SANDBOX_BITS_PER_LONG > #define SANDBOX_BITS_PER_LONG 32 > #endif If we are willing to depend on this define which is clearly named as compiler-internal we could do similar to cc-option to run something like $(CC) -dM -E - < /dev/null | grep -q _LP64 > > to the top of arch/sandbox/include/asm/posix_types.h and use > > #if defined(CONFIG_HOST_64BIT) && defined(__LP64__) > > in drivers/misc/swap_case.c to solve the problem. This demonstrates that > CONFIG_HOST_32BIT and CONFIG_HOST_64BIT are superfluous symbols. Not really. Thanks Michal