package/binutils-bare-metal: add multiple tuple support
PATCH v4 1/5 package/binutils-bare-metal: add multiple tuple support
Add support to binutils-bare-metal to support multiple architecture tuples with the BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH string.
To do this, custom configure, build and install commands are needed, so that each step goes through a loop of the architecture tuples in the list.
To keep consistency with autotools, all the relevant host configurations have been copied into the HOST_BINUTILS_BARE_METAL_CONF_OPTS while removing any configurations that do not apply to binutils and removing redundant configs.
autotools redundant configs covered by $(HOST_CONFIGURE_OPTS):
CFLAGS="$$(HOST_CFLAGS)" LDFLAGS="$$(HOST_LDFLAGS)"
autotools configs not applicable to binutils:
--disable-gtk-doc --disable-gtk-doc-html --disable-doc --disable-docs --disable-documentation --disable-debug --with-xmlto=no --with-fop=no --disable-nls
Some of the configurations already in the binutils-bare-metal package also needed to be changed / removed because they were either incorrect or not relevant to binutils.
Config Incorrect:
--disable-gprof -> --disable-gprofng
Configs Not Applicable:
--enable-static -> handled by --disable-shared
---V1->V2:
- no changesV2->V3:
- removed unnecessary symlinks
- removed unnecessary semi-colonsV3->V4:
- added all relevant autotools configs
- removed any configs not relevant to binutils
- corrected some configs already included in binutils-bare-metal
--- .../binutils-bare-metal.mk | 38 +++++++++++++++++-- 1 file changed, 35 insertions(+), 3 deletions(-)
package/binutils-bare-metal/binutils-bare-metal.mk +35 -3
@@ -22,13 +22,45 @@ HOST_BINUTILS_BARE_METAL_MAKE_OPTS += MAKEINFO=true HOST_BINUTILS_BARE_METAL_INSTALL_OPTS += MAKEINFO=true install HOST_BINUTILS_BARE_METAL_CONF_OPTS = \ - --target=$(TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH_TUPLE) \ - --disable-gprof \ + --prefix=$(HOST_DIR) \ + --sysconfdir=$(HOST_DIR)/etc \ + --localstatedir=$(HOST_DIR)/var \ + $(if $$($$(PKG)_OVERRIDE_SRCDIR),,--disable-dependency-tracking) \ + $(QUIET) \ + --disable-gprofng \ --disable-shared \ --enable-lto \ - --enable-static \ --disable-initfini-array \ --disable-multilib \ --disable-werror +define HOST_BINUTILS_BARE_METAL_CONFIGURE_CMDS + $(foreach arch_tuple, $(TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH_TUPLE), \ + mkdir -p $(@D)/build-$(arch_tuple) && \ + cd $(@D)/build-$(arch_tuple) && \ + $(HOST_CONFIGURE_OPTS) \ + $(HOST_BINUTILS_BARE_METAL_CONF_ENV) \ + CONFIG_SITE=/dev/null \ + $(@D)/configure \ + $(HOST_BINUTILS_BARE_METAL_CONF_OPTS) \ + --target=$(arch_tuple) + ) +endef + +define HOST_BINUTILS_BARE_METAL_BUILD_CMDS + $(foreach arch_tuple, $(TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH_TUPLE), \ + $(HOST_MAKE_ENV) $(MAKE) \ + $(HOST_BINUTILS_BARE_METAL_MAKE_OPTS) \ + -C $(@D)/build-$(arch_tuple) + ) +endef + +define HOST_BINUTILS_BARE_METAL_INSTALL_CMDS + $(foreach arch_tuple, $(TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH_TUPLE), \ + $(HOST_MAKE_ENV) $(MAKE) \ + $(HOST_BINUTILS_BARE_METAL_INSTALL_OPTS) \ + -C $(@D)/build-$(arch_tuple) + ) +endef + $(eval $(host-autotools-package))
Signature · 6 lines
2.25.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v4 2/5 package/gcc-bare-metal: add multiple tuple support
Add support to gcc-bare-metal to support multiple architecture tuples with the BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH string.
To do this, custom configure, build and install commands are needed, so that each step goes through a loop of the architecture tuples in the list.
To keep consistency with autotools, all the relevant host configurations have been copied into the HOST_GCC_BARE_METAL_CONF_OPTS while removing any configurations that do not apply to gcc and removing redundant configs.
autotools redundant configs covered by $(HOST_CONFIGURE_OPTS):
CFLAGS="$$(HOST_CFLAGS)" LDFLAGS="$$(HOST_LDFLAGS)"
autotools configs not applicable to gcc:
--disable-gtk-doc --disable-gtk-doc-html --disable-doc --disable-docs --disable-documentation --disable-debug --with-xmlto=no --with-fop=no --disable-nls
Some of the configurations already in the gcc-bare-metal package also needed to be changed / removed because they were incorrect.
Configs Incorrect:
--disable-initfini_array -> --disable-initfini-array --disable-libstdcxx-pch -> --disable-libstdcxx
---V1->V2:
- corrected sysroot configurationV2->V3:
- removed unnecessary symlinks
- removed unnecessary semi-colonsV3->V4:
- added all relevant autotools configs
- removed any configs not relevant to gcc
- corrected some configs already included in gcc-bare-metal
--- package/gcc-bare-metal/gcc-bare-metal.mk | 60 +++++++++++++++++------- 1 file changed, 44 insertions(+), 16 deletions(-)
package/gcc-bare-metal/gcc-bare-metal.mk +44 -16
@@ -20,15 +20,9 @@ HOST_GCC_BARE_METAL_DEPENDENCIES = \ host-mpfr \ host-isl -# gcc doesn't support in-tree build, so we create a 'build' -# subdirectory in the gcc sources, and build from there. -define HOST_GCC_BARE_METAL_CONFIGURE_SYMLINK - mkdir -p $(@D)/build - ln -sf ../configure $(@D)/build/configure -endef - -HOST_GCC_BARE_METAL_PRE_CONFIGURE_HOOKS += HOST_GCC_BARE_METAL_CONFIGURE_SYMLINK -HOST_GCC_BARE_METAL_SUBDIR = build +# Don't build documentation. It takes up extra space / build time, +# and sometimes needs specific makeinfo versions to work +HOST_GCC_BARE_METAL_CONF_ENV = MAKEINFO=missing HOST_GCC_BARE_METAL_MAKE_OPTS = \ $(HOST_GCC_COMMON_MAKE_OPTS) \
@@ -38,10 +32,15 @@ HOST_GCC_BARE_METAL_MAKE_OPTS = \ HOST_GCC_BARE_METAL_INSTALL_OPTS = install-gcc install-target-libgcc HOST_GCC_BARE_METAL_CONF_OPTS = \ - --target=$(TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH_TUPLE) \ - --disable-initfini_array \ + --prefix=$(HOST_DIR) \ + --sysconfdir=$(HOST_DIR)/etc \ + --localstatedir=$(HOST_DIR)/var \ + $(if $$($$(PKG)_OVERRIDE_SRCDIR),,--disable-dependency-tracking) \ + $(QUIET) \ + --disable-shared \ + --disable-initfini-array \ --disable-__cxa_atexit \ - --disable-libstdcxx-pch \ + --disable-libstdcxx \ --with-newlib \ --disable-threads \ --enable-plugins \
@@ -54,9 +53,38 @@ HOST_GCC_BARE_METAL_CONF_OPTS = \ --with-gmp=$(HOST_DIR) \ --with-mpc=$(HOST_DIR) \ --with-mpfr=$(HOST_DIR) \ - --with-isl=$(HOST_DIR) \ - --with-sysroot=$(TOOLCHAIN_BARE_METAL_BUILDROOT_SYSROOT) \ - AR_FOR_TARGET=$(HOST_DIR)/bin/$(TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH_TUPLE)-ar \ - RANLIB_FOR_TARGET=$(HOST_DIR)/bin/$(TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH_TUPLE)-ranlib + --with-isl=$(HOST_DIR) + +define HOST_GCC_BARE_METAL_CONFIGURE_CMDS + $(foreach arch_tuple, $(TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH_TUPLE), \ + mkdir -p $(@D)/build-$(arch_tuple) && \ + cd $(@D)/build-$(arch_tuple) && \ + $(HOST_CONFIGURE_OPTS) \ + $(HOST_GCC_BARE_METAL_CONF_ENV) \ + CONFIG_SITE=/dev/null \ + $(@D)/configure \ + $(HOST_GCC_BARE_METAL_CONF_OPTS) \ + --target=$(arch_tuple) \ + --with-sysroot=$(HOST_DIR)/$(arch_tuple)/sysroot \ + AR_FOR_TARGET=$(HOST_DIR)/bin/$(arch_tuple)-ar \ + RANLIB_FOR_TARGET=$(HOST_DIR)/bin/$(arch_tuple)-ranlib + ) +endef + +define HOST_GCC_BARE_METAL_BUILD_CMDS + $(foreach arch_tuple, $(TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH_TUPLE), \ + $(HOST_MAKE_ENV) $(MAKE) \ + $(HOST_GCC_BARE_METAL_MAKE_OPTS) \ + -C $(@D)/build-$(arch_tuple) + ) +endef + +define HOST_GCC_BARE_METAL_INSTALL_CMDS + $(foreach arch_tuple, $(TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH_TUPLE), \ + $(HOST_MAKE_ENV) $(MAKE) \ + $(HOST_GCC_BARE_METAL_INSTALL_OPTS) \ + -C $(@D)/build-$(arch_tuple) + ) +endef $(eval $(host-autotools-package))
Signature · 6 lines
2.25.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v4 3/5 package/newlib-bare-metal: add multiple tuple support
In reply to Neal Frager via buildrootAdd support to gcc-bare-metal to support multiple architecture tuples with the BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH string.
To do this, custom configure, build and install commands are needed, so that each step goes through a loop of the architecture tuples in the list.
To keep consistency with autotools, all the relevant target configurations have been copied into the NEWLIB_BARE_METAL_CONF_OPTS while removing any configurations that do not apply to newlib.
Also, the following configs were not taken because newlib is being built for each of the bare-metal targets and not the main target of Buildroot.
$$(TARGET_CONFIGURE_OPTS)
$$(TARGET_CONFIGURE_ARGS)
--target=$$(GNU_TARGET_NAME)
--host=$$(GNU_TARGET_NAME)
---V1->V2:
- no changesV2->V3:
- removed unnecessary symlinks
- removed unnecessary semi-colonsV3->V4:
- added all relevant autotools configs
- removed any configs not relevant to newlib
- placed common configs in NEWLIB_BARE_METAL_CONF_OPTS
--- .../newlib-bare-metal/newlib-bare-metal.mk | 47 ++++++++++++++----- 1 file changed, 34 insertions(+), 13 deletions(-)
package/newlib-bare-metal/newlib-bare-metal.mk +34 -13
@@ -22,28 +22,49 @@ NEWLIB_BARE_METAL_INSTALL_STAGING = YES NEWLIB_BARE_METAL_INSTALL_TARGET = NO NEWLIB_BARE_METAL_MAKE_OPTS = MAKEINFO=true +NEWLIB_BARE_METAL_CONF_OPTS = \ + --build=$(GNU_HOST_NAME) \ + --prefix=/usr \ + --exec-prefix=/usr \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --program-prefix="" \ + $(if $$($$(PKG)_OVERRIDE_SRCDIR),,--disable-dependency-tracking) \ + $(QUIET) \ + --enable-newlib-io-c99-formats \ + --enable-newlib-io-long-long \ + --enable-newlib-io-float \ + --enable-newlib-io-long-double \ + --disable-multilib \ + --with-tooldir=/usr + define NEWLIB_BARE_METAL_CONFIGURE_CMDS - (cd $(@D) && \ + $(foreach arch_tuple, $(TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH_TUPLE), \ + mkdir -p $(@D)/build-$(arch_tuple) && \ + cd $(@D)/build-$(arch_tuple) && \ PATH=$(BR_PATH) \ - ./configure \ - --target=$(TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH_TUPLE) \ - --prefix=/usr \ - --enable-newlib-io-c99-formats \ - --enable-newlib-io-long-long \ - --enable-newlib-io-float \ - --enable-newlib-io-long-double \ - --disable-multilib \ - --with-tooldir=/usr \ + CONFIG_SITE=/dev/null \ + $(@D)/configure \ + $(NEWLIB_BARE_METAL_CONF_OPTS) \ + --target=$(arch_tuple) ) endef define NEWLIB_BARE_METAL_BUILD_CMDS - PATH=$(BR_PATH) $(MAKE1) $(NEWLIB_BARE_METAL_MAKE_OPTS) -C $(@D) + $(foreach arch_tuple, $(TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH_TUPLE), \ + PATH=$(BR_PATH) $(MAKE1) \ + $(NEWLIB_BARE_METAL_MAKE_OPTS) \ + -C $(@D)/build-$(arch_tuple) + ) endef define NEWLIB_BARE_METAL_INSTALL_STAGING_CMDS - PATH=$(BR_PATH) $(MAKE1) -C $(@D) $(NEWLIB_BARE_METAL_MAKE_OPTS) \ - DESTDIR=$(TOOLCHAIN_BARE_METAL_BUILDROOT_SYSROOT) install + $(foreach arch_tuple, $(TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH_TUPLE), \ + PATH=$(BR_PATH) $(MAKE1) \ + $(NEWLIB_BARE_METAL_MAKE_OPTS) \ + -C $(@D)/build-$(arch_tuple) \ + DESTDIR=$(HOST_DIR)/$(arch_tuple)/sysroot install + ) endef $(eval $(generic-package))
Signature · 6 lines
2.25.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v4 4/5 toolchain/toolchain-bare-metal-buildroot: update help text for multiple tuple support
In reply to Neal Frager via buildrootNow that binutils-bare-metal, gcc-bare-metal and newlib-bare-metal packages have been upgraded to support a list of architecture tuples, this patch updates the toolchain-bare-metal-buildroot help text to describe the new capability.
BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH is still backwards compatible with its prior definition as defining a single tuple with this new definition works exactly the same as before.
---V1->V2:
- no changesV2->V3:
- improved help textV3->V4:
- no changes
--- toolchain/Config.in | 2 +- toolchain/toolchain-bare-metal-buildroot/Config.in | 12 +++++++++--- .../toolchain-bare-metal-buildroot.mk | 1 - 3 files changed, 10 insertions(+), 5 deletions(-)
toolchain/Config.in +1 -1
@@ -941,7 +941,7 @@ config BR2_TOOLCHAIN_HAS_LIBQUADMATH comment "Bare metal toolchain" config BR2_TOOLCHAIN_BARE_METAL_BUILDROOT - bool "Build a bare metal toolchain" + bool "Build bare metal toolchains" select BR2_PACKAGE_NEWLIB_BARE_METAL help Select if you need a bare-metal toolchain for building
toolchain/toolchain-bare-metal-buildroot/Config.in +9 -3
@@ -1,10 +1,16 @@ if BR2_TOOLCHAIN_BARE_METAL_BUILDROOT config BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH - string "architecture tuple" + string "list of architecture tuples" help - This option allows to define the architecture tuple for the - bare-metal toolchain. + This option allows to define the list of architecture + tuples for which bare-metal toolchains will be created. + One toolchain will be built for each of the architecture + tuples specified in this option. + + For example, to build both a Microblaze and a RISC-V bare + metal toolchain, use the following definition: + "microblazeel-buildroot-elf riscv32-buildroot-elf" source "package/newlib-bare-metal/Config.in"
toolchain/toolchain-bare-metal-buildroot/toolchain-bare-metal-buildroot.mk +0 -1
@@ -6,7 +6,6 @@ TOOLCHAIN_BARE_METAL_BUILDROOT_DEPENDENCIES = newlib-bare-metal TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH_TUPLE = $(call qstrip,$(BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH)) -TOOLCHAIN_BARE_METAL_BUILDROOT_SYSROOT = $(HOST_DIR)/$(TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH_TUPLE)/sysroot TOOLCHAIN_BARE_METAL_BUILDROOT_ADD_TOOLCHAIN_DEPENDENCY = NO $(eval $(virtual-package))
Signature · 6 lines
2.25.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH v4 5/5 boot/xilinx-embeddedsw: change dependency
In reply to Neal Frager via buildrootNow that BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH can contain multiple tuples, BR2_TARGET_XILINX_EMBEDDEDSW can no longer be dependent on:
depends on BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH = "microblazeel-xilinx-elf"
A valid definition could have "microblazeel-xilinx-elf" as just one of many tuples in the list.
For this reason, this patch changes the dependency to:
depends on BR2_TOOLCHAIN_BARE_METAL_BUILDROOT
One side effect of this is that the user comment will be displayed now when using multiple tuples, even if one of them is the required tuple.
---V1->V3:
- new patch with V3 of seriesV3->V4:
- no changes
--- boot/xilinx-embeddedsw/Config.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
boot/xilinx-embeddedsw/Config.in +1 -1
@@ -1,7 +1,7 @@ config BR2_TARGET_XILINX_EMBEDDEDSW bool "xilinx-embeddedsw" depends on BR2_aarch64 - depends on BR2_TOOLCHAIN_BARE_METAL_BUILDROOT_ARCH = "microblazeel-xilinx-elf" + depends on BR2_TOOLCHAIN_BARE_METAL_BUILDROOT help Build boot firmware applications from source for Xilinx boards. Users can mix and match applications to be built
Signature · 6 lines
2.25.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot