[PATCH v3 3/5] sandbox: Detect the host bit size automatically

Tom Rini trini at konsulko.com
Mon Nov 1 14:13:33 CET 2021


On Mon, Nov 01, 2021 at 08:04:44AM +0100, Pali Rohár wrote:
> On Sunday 01 August 2021 18:56:11 Simon Glass wrote:
> > At present if you build sandbox on a 32-bit host a lot of errors are
> > produced. This is because CONFIG_HOST_64BIT is enabled by default.
> > 
> > It is quite annoying to have to change that manually before building
> > sandbox. It is also quite confusing for new users.
> > 
> > Add a way to detect the setting and add the appropriate
> > CONFIG_HOST_64BIT=y or CONFIG_HOST_32BIT=y to the defconfig, to avoid
> > this issue.
> > 
> > Signed-off-by: Simon Glass <sjg at chromium.org>
> > ---
> > 
> > Changes in v3:
> > - Use 'bitness' instead of 'bit'
> > 
> > Changes in v2:
> > - Drop patches previously applied
> > - Put all the packages in gcc.rst
> > 
> >  Makefile                 | 11 ++++++++++-
> >  arch/sandbox/Kconfig     | 13 ++++++++-----
> >  scripts/kconfig/Makefile | 14 +++++++++++++-
> >  3 files changed, 31 insertions(+), 7 deletions(-)
> > 
> > diff --git a/Makefile b/Makefile
> > index 269e353a28a..57c3e9a77df 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -565,8 +565,17 @@ export KBUILD_DEFCONFIG KBUILD_KCONFIG
> >  config: scripts_basic outputmakefile FORCE
> >  	$(Q)$(MAKE) $(build)=scripts/kconfig $@
> >  
> > +# If nothing is specified explicitly, detect the bit size for sandbox,
> > +# referred to from arch/sandbox/Kconfig
> > +# Add it to the end of the defconfig file
> >  %config: scripts_basic outputmakefile FORCE
> > -	$(Q)$(MAKE) $(build)=scripts/kconfig $@
> > +	$(Q)if test -f $(srctree)/configs/$@ && \
> > +		! grep -Eq "CONFIG_HOST_(32|64)BIT=y" $(srctree)/configs/$@; then \
> > +		echo '#include <stdio.h>\nint main(void) { printf("CONFIG_HOST_%dBIT=y\\n", __WORDSIZE); return 0; }' \
> > +			 | gcc -x c - -o get_word_size; \
> 
> Should not Makefile use user's specified compiler instead of hardcoded 'gcc'?

And it should probably look a bit more like how we do CC_IS_GCC, etc.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20211101/c88dd7cc/attachment.sig>


More information about the U-Boot mailing list