[Buildroot] [PATCH v8 01/10] package/binutils-bare-metal: new package

Frager, Neal neal.frager at amd.com
Thu Dec 14 07:10:39 UTC 2023


Hello Thomas,

> This patch adds a new package for building binutils for a bare-metal toolchain.
> The cpu architecture is defined by a toolchain-bare-metal virtual package.
> While any cpu architecture could be used, the default configuration 
> will be a Xilinx microblaze little endian architecture, so that 
> buildroot will be able to build the microblaze firmware applications for zynqmp and versal.

> Thanks for sending this new iteration. I finally took some time to look into it, as I wanted to merge patches 1 to 4 today. I did some good progress in fixing a number of issues, and my current progress can be seen at:

>   https://github.com/tpetazzoni/buildroot/tree/bare-metal

> Do you think you could rebase your changes on top of this, and see if it all works fine? I of course encourage you to review the modified commits, to spot what I fixed/changed. If you agree with my changes, and they work for you, I think the changes in my branch are ready to be merged, so I will be happy to apply them.

> One thing that still bothers me is:

> +define NEWLIB_BARE_METAL_FIXUP
> +mv $(HOST_GCC_BARE_METAL_SYSROOT)/usr/$(NEWLIB_BARE_METAL_ARCH)/include \
> +	$(HOST_GCC_BARE_METAL_SYSROOT)/usr/include
> +mv $(HOST_GCC_BARE_METAL_SYSROOT)/usr/$(NEWLIB_BARE_METAL_ARCH)/lib \
> +	$(HOST_GCC_BARE_METAL_SYSROOT)/usr/lib
> +endef
> +
> +NEWLIB_BARE_METAL_POST_INSTALL_STAGING_HOOKS += NEWLIB_BARE_METAL_FIXUP

> But I was able to find that it's due to:

> tooldir='${exec_prefix}'/${target_noncanonical}

> in newlib's configure.ac script.

> And interestingly, this issue had already been spotted in an earlier
> (2015) attempt at bringing newlib support in Buildroot:

> https://lore.kernel.org/buildroot/1442127768-26447-1-git-send-email-cjwfirmware@vxmdesign.com/#Z31newlib-0001-configure-tooldir-path.patch

> I'm not yet decided on what is the most appropriate: your hook that moves things around after installation, or patching the configure.ac script to get things at the right place from the start.

I just made a patch which removes my post install fixup with the newlib configure script patch.

Below you can find a pull request to apply it to your bare-metal branch:
https://github.com/tpetazzoni/buildroot/pull/1

I have now applied patches 5-10 to this branch and I am running verification and test.  I will let you know when I have confirmed that it is good to go on my side.

Assuming this method works, I will submit the newlib patch upstream, so that hopefully it will be included with version 4.4.0.

Thanks for finding the newlib tooldir patch!  It saved me many hours!

Best regards,
Neal Frager
AMD



More information about the buildroot mailing list