* [Buildroot] [PATCH] toolchain-external: Commonize /lib/<tuple> symlinks
@ 2016-03-22 20:22 Matt Fornero
2016-03-27 16:09 ` Arnout Vandecappelle
0 siblings, 1 reply; 3+ messages in thread
From: Matt Fornero @ 2016-03-22 20:22 UTC (permalink / raw)
To: buildroot
Commonize the creation of symlinks from {/usr}/lib to
{/usr}/lib/<tuple>.
These were originally defined on a per-toolchain basis for the Linaro
toolchains, but there is currently no support for creating symlinks
for custom toolchains that may have been based on Linaro (or older
versions of the Linaro toolchain).
Add common code for all supported Linaro toolchains and add a new
config option, BR2_TOOLCHAIN_EXTERNAL_PREFIX_SYMLINK to enable custom
toolchains to enable the symbolic link creation.
Signed-off-by: Matthew Fornero <mfornero@mathworks.com>
---
toolchain/toolchain-external/Config.in | 15 +++++++++++
toolchain/toolchain-external/toolchain-external.mk | 26 ++++++--------------
2 files changed, 23 insertions(+), 18 deletions(-)
diff --git a/toolchain/toolchain-external/Config.in b/toolchain/toolchain-external/Config.in
index ff759a0..2e2ec03 100644
--- a/toolchain/toolchain-external/Config.in
+++ b/toolchain/toolchain-external/Config.in
@@ -745,6 +745,14 @@ config BR2_TOOLCHAIN_EXTERNAL_PREFIX
default BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX \
if BR2_TOOLCHAIN_EXTERNAL_CUSTOM
+config BR2_TOOLCHAIN_EXTERNAL_NEEDS_PREFIX_SYMLINK
+ bool
+ default y if BR2_TOOLCHAIN_EXTERNAL_LINARO_ARM && BR2_HOSTARCH = "x86"
+ default y if BR2_TOOLCHAIN_EXTERNAL_LINARO_AARCH64 && BR2_HOSTARCH = "x86"
+ default y if BR2_TOOLCHAIN_EXTERNAL_LINARO_ARMEB && BR2_HOSTARCH = "x86"
+ default y if BR2_TOOLCHAIN_EXTERNAL_PREFIX_SYMLINK
+ default n
+
config BR2_TOOLCHAIN_EXTERNAL_GLIBC
bool
select BR2_TOOLCHAIN_USES_GLIBC
@@ -1055,6 +1063,13 @@ config BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS
here, separated by spaces. They will be copied to the
target's /lib directory.
+config BR2_TOOLCHAIN_EXTERNAL_PREFIX_SYMLINK
+ bool "Symlink /lib/<tuple>?"
+ help
+ Select this option if your external toolchain needs a symlink
+ from the /lib directory to the /lib/<tuple> directory. This is
+ may be required if your toolchain is based on one from Linaro.
+
endif # BR2_TOOLCHAIN_EXTERNAL_CUSTOM
config BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY
diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk
index 37e1a2e..66cf449 100644
--- a/toolchain/toolchain-external/toolchain-external.mk
+++ b/toolchain/toolchain-external/toolchain-external.mk
@@ -244,23 +244,16 @@ ifeq ($(BR2_TOOLCHAIN_USES_MUSL),y)
TOOLCHAIN_EXTERNAL_DEPENDENCIES += netbsd-queue
endif
-# The Linaro ARMhf toolchain expects the libraries in
-# {/usr,}/lib/arm-linux-gnueabihf, but Buildroot copies them to
+# Some toolchains, such as Linaro, expect the libraries in
+# {/usr,}/lib/<tuple>, but Buildroot copies them to
# {/usr,}/lib, so we need to create a symbolic link.
-define TOOLCHAIN_EXTERNAL_LINARO_ARMHF_SYMLINK
- ln -snf . $(TARGET_DIR)/lib/arm-linux-gnueabihf
- ln -snf . $(TARGET_DIR)/usr/lib/arm-linux-gnueabihf
-endef
-
-define TOOLCHAIN_EXTERNAL_LINARO_ARMEBHF_SYMLINK
- ln -snf . $(TARGET_DIR)/lib/armeb-linux-gnueabihf
- ln -snf . $(TARGET_DIR)/usr/lib/armeb-linux-gnueabihf
-endef
-
-define TOOLCHAIN_EXTERNAL_LINARO_AARCH64_SYMLINK
- ln -snf . $(TARGET_DIR)/lib/aarch64-linux-gnu
- ln -snf . $(TARGET_DIR)/usr/lib/aarch64-linux-gnu
+ifeq ($(BR2_TOOLCHAIN_EXTERNAL_NEEDS_PREFIX_SYMLINK),y)
+define TOOLCHAIN_EXTERNAL_PREFIX_SYMLINK
+ ln -snf . $(TARGET_DIR)/lib/$(TOOLCHAIN_EXTERNAL_PREFIX)
+ ln -snf . $(TARGET_DIR)/usr/lib/$(TOOLCHAIN_EXTERNAL_PREFIX)
endef
+TOOLCHAIN_EXTERNAL_POST_INSTALL_STAGING_HOOKS += TOOLCHAIN_EXTERNAL_PREFIX_SYMLINK
+endif
# Special handling for Blackfin toolchain, because of the split in two
# tarballs, and the organization of tarball contents. The tarballs
@@ -298,7 +291,6 @@ ifeq ($(HOSTARCH),x86)
TOOLCHAIN_EXTERNAL_SITE = https://releases.linaro.org/14.09/components/toolchain/binaries
TOOLCHAIN_EXTERNAL_SOURCE = gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux.tar.xz
TOOLCHAIN_EXTERNAL_ACTUAL_SOURCE_TARBALL = gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_src.tar.bz2
-TOOLCHAIN_EXTERNAL_POST_INSTALL_STAGING_HOOKS += TOOLCHAIN_EXTERNAL_LINARO_ARMHF_SYMLINK
else
TOOLCHAIN_EXTERNAL_SITE = https://releases.linaro.org/components/toolchain/binaries/5.2-2015.11-2/arm-linux-gnueabihf
TOOLCHAIN_EXTERNAL_SOURCE = gcc-linaro-5.2-2015.11-2-x86_64_arm-linux-gnueabihf.tar.xz
@@ -308,7 +300,6 @@ ifeq ($(HOSTARCH),x86)
TOOLCHAIN_EXTERNAL_SITE = https://releases.linaro.org/14.09/components/toolchain/binaries
TOOLCHAIN_EXTERNAL_SOURCE = gcc-linaro-armeb-linux-gnueabihf-4.9-2014.09_linux.tar.xz
TOOLCHAIN_EXTERNAL_ACTUAL_SOURCE_TARBALL = gcc-linaro-armeb-linux-gnueabihf-4.9-2014.09_src.tar.bz2
-TOOLCHAIN_EXTERNAL_POST_INSTALL_STAGING_HOOKS += TOOLCHAIN_EXTERNAL_LINARO_ARMEBHF_SYMLINK
else
TOOLCHAIN_EXTERNAL_SITE = https://releases.linaro.org/components/toolchain/binaries/5.2-2015.11-2/armeb-linux-gnueabihf
TOOLCHAIN_EXTERNAL_SOURCE = gcc-linaro-5.2-2015.11-2-x86_64_armeb-linux-gnueabihf.tar.xz
@@ -353,7 +344,6 @@ ifeq ($(HOSTARCH),x86)
TOOLCHAIN_EXTERNAL_SITE = https://releases.linaro.org/14.09/components/toolchain/binaries
TOOLCHAIN_EXTERNAL_SOURCE = gcc-linaro-aarch64-linux-gnu-4.9-2014.09_linux.tar.xz
TOOLCHAIN_EXTERNAL_ACTUAL_SOURCE_TARBALL = gcc-linaro-aarch64-linux-gnu-4.9-2014.09_src.tar.bz2
-TOOLCHAIN_EXTERNAL_POST_INSTALL_STAGING_HOOKS += TOOLCHAIN_EXTERNAL_LINARO_AARCH64_SYMLINK
else
TOOLCHAIN_EXTERNAL_SITE = https://releases.linaro.org/components/toolchain/binaries/5.2-2015.11-2/aarch64-linux-gnu
TOOLCHAIN_EXTERNAL_SOURCE = gcc-linaro-5.2-2015.11-2-x86_64_aarch64-linux-gnu.tar.xz
--
1.7.10.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [Buildroot] [PATCH] toolchain-external: Commonize /lib/<tuple> symlinks
2016-03-22 20:22 [Buildroot] [PATCH] toolchain-external: Commonize /lib/<tuple> symlinks Matt Fornero
@ 2016-03-27 16:09 ` Arnout Vandecappelle
2016-03-28 15:24 ` Matt Fornero
0 siblings, 1 reply; 3+ messages in thread
From: Arnout Vandecappelle @ 2016-03-27 16:09 UTC (permalink / raw)
To: buildroot
Hi Matt,
An external toolchain patch as your first contribution, that's... ambitious...
The external toolchain support is pretty fragile, we are careful about touching
it, so it could take months before your patch gets applied.
On 03/22/16 21:22, Matt Fornero wrote:
> Commonize the creation of symlinks from {/usr}/lib to
> {/usr}/lib/<tuple>.
>
> These were originally defined on a per-toolchain basis for the Linaro
> toolchains, but there is currently no support for creating symlinks
> for custom toolchains that may have been based on Linaro (or older
> versions of the Linaro toolchain).
>
> Add common code for all supported Linaro toolchains and add a new
> config option, BR2_TOOLCHAIN_EXTERNAL_PREFIX_SYMLINK to enable custom
> toolchains to enable the symbolic link creation.
>
> Signed-off-by: Matthew Fornero <mfornero@mathworks.com>
> ---
> toolchain/toolchain-external/Config.in | 15 +++++++++++
> toolchain/toolchain-external/toolchain-external.mk | 26 ++++++--------------
> 2 files changed, 23 insertions(+), 18 deletions(-)
>
> diff --git a/toolchain/toolchain-external/Config.in b/toolchain/toolchain-external/Config.in
> index ff759a0..2e2ec03 100644
> --- a/toolchain/toolchain-external/Config.in
> +++ b/toolchain/toolchain-external/Config.in
> @@ -745,6 +745,14 @@ config BR2_TOOLCHAIN_EXTERNAL_PREFIX
> default BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX \
> if BR2_TOOLCHAIN_EXTERNAL_CUSTOM
>
> +config BR2_TOOLCHAIN_EXTERNAL_NEEDS_PREFIX_SYMLINK
> + bool
> + default y if BR2_TOOLCHAIN_EXTERNAL_LINARO_ARM && BR2_HOSTARCH = "x86"
The HOSTARCH condition is unnecessary.
> + default y if BR2_TOOLCHAIN_EXTERNAL_LINARO_AARCH64 && BR2_HOSTARCH = "x86"
> + default y if BR2_TOOLCHAIN_EXTERNAL_LINARO_ARMEB && BR2_HOSTARCH = "x86"
> + default y if BR2_TOOLCHAIN_EXTERNAL_PREFIX_SYMLINK
> + default n
default n is not necessary.
> +
> config BR2_TOOLCHAIN_EXTERNAL_GLIBC
> bool
> select BR2_TOOLCHAIN_USES_GLIBC
> @@ -1055,6 +1063,13 @@ config BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS
> here, separated by spaces. They will be copied to the
> target's /lib directory.
>
> +config BR2_TOOLCHAIN_EXTERNAL_PREFIX_SYMLINK
> + bool "Symlink /lib/<tuple>?"
I would leave out the ? at the end. The HAS options above have it, but that's
about the only situation we ever have a question mark.
I was also thinking if we shouldn't just create the symlink unconditionally.
But it's really just the Linaro toolchains that need it, so it doesn't make that
much sense.
But basically, it looks good to me.
Regards,
Arnout
> + help
> + Select this option if your external toolchain needs a symlink
> + from the /lib directory to the /lib/<tuple> directory. This is
> + may be required if your toolchain is based on one from Linaro.
> +
> endif # BR2_TOOLCHAIN_EXTERNAL_CUSTOM
>
> config BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY
> diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk
> index 37e1a2e..66cf449 100644
> --- a/toolchain/toolchain-external/toolchain-external.mk
> +++ b/toolchain/toolchain-external/toolchain-external.mk
> @@ -244,23 +244,16 @@ ifeq ($(BR2_TOOLCHAIN_USES_MUSL),y)
> TOOLCHAIN_EXTERNAL_DEPENDENCIES += netbsd-queue
> endif
>
> -# The Linaro ARMhf toolchain expects the libraries in
> -# {/usr,}/lib/arm-linux-gnueabihf, but Buildroot copies them to
> +# Some toolchains, such as Linaro, expect the libraries in
> +# {/usr,}/lib/<tuple>, but Buildroot copies them to
> # {/usr,}/lib, so we need to create a symbolic link.
> -define TOOLCHAIN_EXTERNAL_LINARO_ARMHF_SYMLINK
> - ln -snf . $(TARGET_DIR)/lib/arm-linux-gnueabihf
> - ln -snf . $(TARGET_DIR)/usr/lib/arm-linux-gnueabihf
> -endef
> -
> -define TOOLCHAIN_EXTERNAL_LINARO_ARMEBHF_SYMLINK
> - ln -snf . $(TARGET_DIR)/lib/armeb-linux-gnueabihf
> - ln -snf . $(TARGET_DIR)/usr/lib/armeb-linux-gnueabihf
> -endef
> -
> -define TOOLCHAIN_EXTERNAL_LINARO_AARCH64_SYMLINK
> - ln -snf . $(TARGET_DIR)/lib/aarch64-linux-gnu
> - ln -snf . $(TARGET_DIR)/usr/lib/aarch64-linux-gnu
> +ifeq ($(BR2_TOOLCHAIN_EXTERNAL_NEEDS_PREFIX_SYMLINK),y)
> +define TOOLCHAIN_EXTERNAL_PREFIX_SYMLINK
> + ln -snf . $(TARGET_DIR)/lib/$(TOOLCHAIN_EXTERNAL_PREFIX)
> + ln -snf . $(TARGET_DIR)/usr/lib/$(TOOLCHAIN_EXTERNAL_PREFIX)
> endef
> +TOOLCHAIN_EXTERNAL_POST_INSTALL_STAGING_HOOKS += TOOLCHAIN_EXTERNAL_PREFIX_SYMLINK
> +endif
>
> # Special handling for Blackfin toolchain, because of the split in two
> # tarballs, and the organization of tarball contents. The tarballs
> @@ -298,7 +291,6 @@ ifeq ($(HOSTARCH),x86)
> TOOLCHAIN_EXTERNAL_SITE = https://releases.linaro.org/14.09/components/toolchain/binaries
> TOOLCHAIN_EXTERNAL_SOURCE = gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux.tar.xz
> TOOLCHAIN_EXTERNAL_ACTUAL_SOURCE_TARBALL = gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_src.tar.bz2
> -TOOLCHAIN_EXTERNAL_POST_INSTALL_STAGING_HOOKS += TOOLCHAIN_EXTERNAL_LINARO_ARMHF_SYMLINK
> else
> TOOLCHAIN_EXTERNAL_SITE = https://releases.linaro.org/components/toolchain/binaries/5.2-2015.11-2/arm-linux-gnueabihf
> TOOLCHAIN_EXTERNAL_SOURCE = gcc-linaro-5.2-2015.11-2-x86_64_arm-linux-gnueabihf.tar.xz
> @@ -308,7 +300,6 @@ ifeq ($(HOSTARCH),x86)
> TOOLCHAIN_EXTERNAL_SITE = https://releases.linaro.org/14.09/components/toolchain/binaries
> TOOLCHAIN_EXTERNAL_SOURCE = gcc-linaro-armeb-linux-gnueabihf-4.9-2014.09_linux.tar.xz
> TOOLCHAIN_EXTERNAL_ACTUAL_SOURCE_TARBALL = gcc-linaro-armeb-linux-gnueabihf-4.9-2014.09_src.tar.bz2
> -TOOLCHAIN_EXTERNAL_POST_INSTALL_STAGING_HOOKS += TOOLCHAIN_EXTERNAL_LINARO_ARMEBHF_SYMLINK
> else
> TOOLCHAIN_EXTERNAL_SITE = https://releases.linaro.org/components/toolchain/binaries/5.2-2015.11-2/armeb-linux-gnueabihf
> TOOLCHAIN_EXTERNAL_SOURCE = gcc-linaro-5.2-2015.11-2-x86_64_armeb-linux-gnueabihf.tar.xz
> @@ -353,7 +344,6 @@ ifeq ($(HOSTARCH),x86)
> TOOLCHAIN_EXTERNAL_SITE = https://releases.linaro.org/14.09/components/toolchain/binaries
> TOOLCHAIN_EXTERNAL_SOURCE = gcc-linaro-aarch64-linux-gnu-4.9-2014.09_linux.tar.xz
> TOOLCHAIN_EXTERNAL_ACTUAL_SOURCE_TARBALL = gcc-linaro-aarch64-linux-gnu-4.9-2014.09_src.tar.bz2
> -TOOLCHAIN_EXTERNAL_POST_INSTALL_STAGING_HOOKS += TOOLCHAIN_EXTERNAL_LINARO_AARCH64_SYMLINK
> else
> TOOLCHAIN_EXTERNAL_SITE = https://releases.linaro.org/components/toolchain/binaries/5.2-2015.11-2/aarch64-linux-gnu
> TOOLCHAIN_EXTERNAL_SOURCE = gcc-linaro-5.2-2015.11-2-x86_64_aarch64-linux-gnu.tar.xz
>
--
Arnout Vandecappelle arnout at mind be
Senior Embedded Software Architect +32-16-286500
Essensium/Mind http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Buildroot] [PATCH] toolchain-external: Commonize /lib/<tuple> symlinks
2016-03-27 16:09 ` Arnout Vandecappelle
@ 2016-03-28 15:24 ` Matt Fornero
0 siblings, 0 replies; 3+ messages in thread
From: Matt Fornero @ 2016-03-28 15:24 UTC (permalink / raw)
To: buildroot
> From: Arnout Vandecappelle [mailto:arnout at mind.be]
>
> Hi Matt,
>
> An external toolchain patch as your first contribution, that's...
> ambitious...
> The external toolchain support is pretty fragile, we are careful about
> touching it, so it could take months before your patch gets applied.
Hi Arnout,
Understood-- there's not a lot of urgency on our side; we generally
re-sync to upstream every ~6 months. We're using Buildroot to (among
other things) generate images for Altera's SoC FPGA parts, and need to
use the version of the Linaro toolchain they ship. Previously I'd been
hacking the .mk file to properly describe the GCC version, headers
version, etc, while still getting the symlinks-- this seemed cleaner. If
we can get to the point where my co-workers can merge in upstream
changes without having to touch the toolchain files, I'd be happy!
...
> > +config BR2_TOOLCHAIN_EXTERNAL_NEEDS_PREFIX_SYMLINK
> > + bool
> > + default y if BR2_TOOLCHAIN_EXTERNAL_LINARO_ARM &&
> BR2_HOSTARCH = "x86"
>
> The HOSTARCH condition is unnecessary.
Ok-- I wasn't sure about this-- from what I can see the lines in the .mk
file that I'm replacing only install the post-staging hook for x86, was
there a reason for that?
...
> > + default y if BR2_TOOLCHAIN_EXTERNAL_LINARO_AARCH64 &&
> BR2_HOSTARCH = "x86"
> > + default y if BR2_TOOLCHAIN_EXTERNAL_LINARO_ARMEB &&
> BR2_HOSTARCH = "x86"
> > + default y if BR2_TOOLCHAIN_EXTERNAL_PREFIX_SYMLINK
> > + default n
>
> default n is not necessary.
I'll remove the line-- wasn't super familiar with this style of Kconfig
> >
> > +config BR2_TOOLCHAIN_EXTERNAL_PREFIX_SYMLINK
> > + bool "Symlink /lib/<tuple>?"
>
> I would leave out the ? at the end. The HAS options above have it, but
> that's about the only situation we ever have a question mark.
>
I'll drop the "?"
> I was also thinking if we shouldn't just create the symlink
> unconditionally.
> But it's really just the Linaro toolchains that need it, so it doesn't make
> that much sense.
I also looked at modifying / cloning the toolchain_find_libdir and
create_lib_symlinks functions, but these seemed much more fragile. The
opt-in Kconfig option seemed like the least invasive way to modify the
code at this point.
>
> But basically, it looks good to me.
I'll go ahead and submit a v2 of this with the above changes
-Matt
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-03-28 15:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-22 20:22 [Buildroot] [PATCH] toolchain-external: Commonize /lib/<tuple> symlinks Matt Fornero
2016-03-27 16:09 ` Arnout Vandecappelle
2016-03-28 15:24 ` Matt Fornero
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox