Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 0/5] Support for musl based external toolchains
@ 2013-10-05 14:16 Thomas Petazzoni
  2013-10-05 14:16 ` [Buildroot] [PATCH 1/5] toolchain-external: conditionalize the installation of libraries Thomas Petazzoni
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Thomas Petazzoni @ 2013-10-05 14:16 UTC (permalink / raw)
  To: buildroot

Hello,

The musl C library is an alternative C library available from
http://www.musl-libc.org, it is gaining popularity amongst the people
interested in small root filesystem for embedded platforms.

The following set of commits add support for musl based external
toolchains. As noted in PATCH 3, the pre-build musl toolchains
available at musl.codu.org cannot be used for the moment, since they
lack sysroot support, but I have already contacted the author, who has
added sysroot support, that I've succesfully tested. The next release
of the pre-built toolchains will therefore have sysroot support, and
I'll be able to add them in the external toolchain profiles.

The last patch adds some minor fixes to Busybox to make it build
properly, they have been submitted to upstream Busybox already. Some
other packages will need a few minor fixes, of course.

In the future, I'm planning to add musl support to the internal
toolchain backend as well, but that requires patches on binutils and
gcc, which is a little bit annoying, even if the patches are quite
small.

Best regards,

Thomas

Thomas Petazzoni (5):
  toolchain-external: conditionalize the installation of libraries
  toolchain-external: modify the wildcard logic for shared libraries
    copying
  toolchain-external: add support for musl C library
  toolchain-external: improve help text of some options
  busybox: add patches to fix build with the musl C library

 ...01-libbb-use-poll.h-instead-of-sys-poll.h.patch | 32 +++++++++++++++++++
 ...onfig-include-linux-if_slip.h-instead-of-.patch | 33 ++++++++++++++++++++
 ...libiproute-use-linux-if_packet.h-instead-.patch | 36 ++++++++++++++++++++++
 toolchain/Config.in                                |  9 ++++++
 toolchain/helpers.mk                               | 13 +++++++-
 toolchain/toolchain-external/Config.in             | 27 +++++++++++++---
 toolchain/toolchain-external/ext-tool.mk           | 34 +++++++++++++-------
 7 files changed, 168 insertions(+), 16 deletions(-)
 create mode 100644 package/busybox/1.21.1/0001-libbb-use-poll.h-instead-of-sys-poll.h.patch
 create mode 100644 package/busybox/1.21.1/0002-network-ifconfig-include-linux-if_slip.h-instead-of-.patch
 create mode 100644 package/busybox/1.21.1/0003-networking-libiproute-use-linux-if_packet.h-instead-.patch

-- 
1.8.1.2

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH 1/5] toolchain-external: conditionalize the installation of libraries
  2013-10-05 14:16 [Buildroot] [PATCH 0/5] Support for musl based external toolchains Thomas Petazzoni
@ 2013-10-05 14:16 ` Thomas Petazzoni
  2013-10-05 14:16 ` [Buildroot] [PATCH 2/5] toolchain-external: modify the wildcard logic for shared libraries copying Thomas Petazzoni
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Thomas Petazzoni @ 2013-10-05 14:16 UTC (permalink / raw)
  To: buildroot

The external toolchain code makes the assumption that all C libraries
have a ld*.so, libc.so, libcrypt.so, libdl.so, libgcc_s.so, libm.so,
libnsl.so, libresolv.so, libutil.so, and when thread support is
enabled, libpthread.so, etc.

However, this is not the case with the musl C library, which
integrates all the functionalities in a single libc.so file. In
preparation of the support of the musl library, we make the current
value of LIB_EXTERNAL_LIBS conditional to glibc or uClibc.

The addition of additional libraries through
BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS is kept outside the condition, at
the end.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 toolchain/toolchain-external/ext-tool.mk | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/toolchain/toolchain-external/ext-tool.mk b/toolchain/toolchain-external/ext-tool.mk
index db2a99e..93f1c0f 100644
--- a/toolchain/toolchain-external/ext-tool.mk
+++ b/toolchain/toolchain-external/ext-tool.mk
@@ -49,8 +49,16 @@
 #  $(HOST_DIR)/usr/bin like for the internal toolchains, and the rest
 #  of Buildroot is handled identical for the 2 toolchain types.
 
-LIB_EXTERNAL_LIBS=ld*.so libc.so libcrypt.so libdl.so libgcc_s.so libm.so libnsl.so libresolv.so librt.so libutil.so
-LIB_EXTERNAL_LIBS+=$(call qstrip,$(BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS))
+ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GLIBC)$(BR2_TOOLCHAIN_EXTERNAL_UCLIBC),y)
+LIB_EXTERNAL_LIBS+=ld*.so libc.so libcrypt.so libdl.so libgcc_s.so libm.so libnsl.so libresolv.so librt.so libutil.so
+ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
+LIB_EXTERNAL_LIBS+=libpthread.so
+ifneq ($(BR2_PACKAGE_GDB_SERVER)$(BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY),)
+LIB_EXTERNAL_LIBS+=libthread_db.so
+endif # gdbserver
+endif # ! no threads
+endif
+
 ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GLIBC),y)
 LIB_EXTERNAL_LIBS+=libnss_files.so libnss_dns.so
 endif
@@ -59,12 +67,7 @@ ifeq ($(BR2_INSTALL_LIBSTDCPP),y)
 USR_LIB_EXTERNAL_LIBS+=libstdc++.so
 endif
 
-ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
-LIB_EXTERNAL_LIBS+=libpthread.so
-ifneq ($(BR2_PACKAGE_GDB_SERVER)$(BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY),)
-LIB_EXTERNAL_LIBS+=libthread_db.so
-endif # gdbserver
-endif # ! no threads
+LIB_EXTERNAL_LIBS+=$(call qstrip,$(BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS))
 
 # Details about sysroot directory selection.
 #
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH 2/5] toolchain-external: modify the wildcard logic for shared libraries copying
  2013-10-05 14:16 [Buildroot] [PATCH 0/5] Support for musl based external toolchains Thomas Petazzoni
  2013-10-05 14:16 ` [Buildroot] [PATCH 1/5] toolchain-external: conditionalize the installation of libraries Thomas Petazzoni
@ 2013-10-05 14:16 ` Thomas Petazzoni
  2013-10-05 14:16 ` [Buildroot] [PATCH 3/5] toolchain-external: add support for musl C library Thomas Petazzoni
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Thomas Petazzoni @ 2013-10-05 14:16 UTC (permalink / raw)
  To: buildroot

Until now, the copy_toolchain_lib_root function took as argument the
base name of a library (e.g: libm.so), and was assuming that the usual
scheme libm.so.<x> being a symbolic link to the real library was used.

However, with musl based toolchains, the C library is named libc.so
directly, with no symbolic link at all. Therefore, this commit changes
the copy_toolchain_lib_root to move the responsibility of using a
wildcard or not after the library name the caller's responsibility.

So, all the existing LIB_EXTERNAL_LIBS values are modified to have a
.* at the end, so that the behavior is effectively unchanged.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 toolchain/helpers.mk                     |  2 +-
 toolchain/toolchain-external/ext-tool.mk | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
index 0e270ee..d5443b5 100644
--- a/toolchain/helpers.mk
+++ b/toolchain/helpers.mk
@@ -56,7 +56,7 @@ copy_toolchain_lib_root = \
 		$${ARCH_SYSROOT_DIR}/$${ARCH_LIB_DIR} \
 		$${ARCH_SYSROOT_DIR}/usr/$${ARCH_LIB_DIR} \
 		$${SUPPORT_LIB_DIR} ; do \
-		LIBSPATH=`find $${dir} -maxdepth 1 -name "$${LIB}.*" 2>/dev/null` ; \
+		LIBSPATH=`find $${dir} -maxdepth 1 -name "$${LIB}" 2>/dev/null` ; \
 		if test -n "$${LIBSPATH}" ; then \
 			break ; \
 		fi \
diff --git a/toolchain/toolchain-external/ext-tool.mk b/toolchain/toolchain-external/ext-tool.mk
index 93f1c0f..8762a46 100644
--- a/toolchain/toolchain-external/ext-tool.mk
+++ b/toolchain/toolchain-external/ext-tool.mk
@@ -50,21 +50,21 @@
 #  of Buildroot is handled identical for the 2 toolchain types.
 
 ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GLIBC)$(BR2_TOOLCHAIN_EXTERNAL_UCLIBC),y)
-LIB_EXTERNAL_LIBS+=ld*.so libc.so libcrypt.so libdl.so libgcc_s.so libm.so libnsl.so libresolv.so librt.so libutil.so
+LIB_EXTERNAL_LIBS+=ld*.so.* libc.so.* libcrypt.so.* libdl.so.* libgcc_s.so.* libm.so.* libnsl.so.* libresolv.so.* librt.so.* libutil.so.*
 ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
-LIB_EXTERNAL_LIBS+=libpthread.so
+LIB_EXTERNAL_LIBS+=libpthread.so.*
 ifneq ($(BR2_PACKAGE_GDB_SERVER)$(BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY),)
-LIB_EXTERNAL_LIBS+=libthread_db.so
+LIB_EXTERNAL_LIBS+=libthread_db.so.*
 endif # gdbserver
 endif # ! no threads
 endif
 
 ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GLIBC),y)
-LIB_EXTERNAL_LIBS+=libnss_files.so libnss_dns.so
+LIB_EXTERNAL_LIBS+=libnss_files.so.* libnss_dns.so.*
 endif
 
 ifeq ($(BR2_INSTALL_LIBSTDCPP),y)
-USR_LIB_EXTERNAL_LIBS+=libstdc++.so
+USR_LIB_EXTERNAL_LIBS+=libstdc++.so.*
 endif
 
 LIB_EXTERNAL_LIBS+=$(call qstrip,$(BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS))
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH 3/5] toolchain-external: add support for musl C library
  2013-10-05 14:16 [Buildroot] [PATCH 0/5] Support for musl based external toolchains Thomas Petazzoni
  2013-10-05 14:16 ` [Buildroot] [PATCH 1/5] toolchain-external: conditionalize the installation of libraries Thomas Petazzoni
  2013-10-05 14:16 ` [Buildroot] [PATCH 2/5] toolchain-external: modify the wildcard logic for shared libraries copying Thomas Petazzoni
@ 2013-10-05 14:16 ` Thomas Petazzoni
  2013-10-05 14:18   ` Thomas Petazzoni
  2013-10-06  6:57   ` Thomas De Schampheleire
  2013-10-05 14:16 ` [Buildroot] [PATCH 4/5] toolchain-external: improve help text of some options Thomas Petazzoni
  2013-10-05 14:16 ` [Buildroot] [PATCH 5/5] busybox: add patches to fix build with the musl C library Thomas Petazzoni
  4 siblings, 2 replies; 9+ messages in thread
From: Thomas Petazzoni @ 2013-10-05 14:16 UTC (permalink / raw)
  To: buildroot

This commit adds support for external toolchains based on the musl C
library, as available from http://www.musl-libc.org.

Note that the pre-built musl toolchains available from
http://musl.codu.org/ are not working for the moment, since they lack
sysroot support. However, this problem has been reported to the
maintainer, who has already added sysroot support in his scripts at
https://bitbucket.org/GregorR/musl-cross, and therefore the next
version of the pre-built toolchains should work with Buildroot
out-of-the-box. In the mean time, the musl-cross script must be used
to build the toolchain.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 toolchain/Config.in                      |  9 +++++++++
 toolchain/helpers.mk                     | 11 +++++++++++
 toolchain/toolchain-external/Config.in   | 12 ++++++++++++
 toolchain/toolchain-external/ext-tool.mk | 11 ++++++++++-
 4 files changed, 42 insertions(+), 1 deletion(-)

diff --git a/toolchain/Config.in b/toolchain/Config.in
index 17be32a..61eb520 100644
--- a/toolchain/Config.in
+++ b/toolchain/Config.in
@@ -24,6 +24,15 @@ config BR2_TOOLCHAIN_USES_GLIBC
 config BR2_TOOLCHAIN_USES_UCLIBC
 	bool
 
+config BR2_TOOLCHAIN_USES_MUSL
+	bool
+	select BR2_LARGEFILE
+	select BR2_INET_IPV6
+	select BR2_USE_WCHAR
+	select BR2_ENABLE_LOCALE
+	select BR2_TOOLCHAIN_HAS_THREADS
+	select BR2_TOOLCHAIN_HAS_THREADS_DEBUG
+
 choice
 	prompt "Toolchain type"
 	help
diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
index d5443b5..e8d4168 100644
--- a/toolchain/helpers.mk
+++ b/toolchain/helpers.mk
@@ -214,6 +214,17 @@ check_glibc = \
 	$(call check_glibc_rpc_feature,$${SYSROOT_DIR})
 
 #
+# Check that the selected C library is really musl
+#
+# $1: sysroot directory
+check_musl = \
+	SYSROOT_DIR="$(strip $1)"; \
+	if test ! -f $${SYSROOT_DIR}/lib/libc.so -o -e $${SYSROOT_DIR}/lib/libm.so ; then \
+		echo "Incorrect selection of the C library" ; \
+		exit -1; \
+	fi
+
+#
 # Check the conformity of Buildroot configuration with regard to the
 # uClibc configuration of the external toolchain, for a particular
 # feature.
diff --git a/toolchain/toolchain-external/Config.in b/toolchain/toolchain-external/Config.in
index c53577e..89c799e 100644
--- a/toolchain/toolchain-external/Config.in
+++ b/toolchain/toolchain-external/Config.in
@@ -860,6 +860,10 @@ config BR2_TOOLCHAIN_EXTERNAL_UCLIBC
 	bool
 	select BR2_TOOLCHAIN_USES_UCLIBC
 
+config BR2_TOOLCHAIN_EXTERNAL_MUSL
+	bool
+	select BR2_TOOLCHAIN_USES_MUSL
+
 if BR2_TOOLCHAIN_EXTERNAL_CUSTOM
 
 choice
@@ -882,6 +886,13 @@ config BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC
 	  eglibc configured to exclude key features may cause build failures to
 	  some packages.
 
+config BR2_TOOLCHAIN_EXTERNAL_CUSTOM_MUSL
+	bool "musl"
+	select BR2_TOOLCHAIN_EXTERNAL_MUSL
+	help
+	  Select this option if your external toolchain uses the
+	  'musl' C library, available from http://www.musl-libc.org/.
+
 endchoice
 
 if BR2_TOOLCHAIN_EXTERNAL_CUSTOM_UCLIBC
@@ -952,6 +963,7 @@ endif # BR2_TOOLCHAIN_EXTERNAL_CUSTOM_UCLIBC
 config BR2_TOOLCHAIN_EXTERNAL_INET_RPC
 	bool "Toolchain has RPC support?"
 	select BR2_TOOLCHAIN_HAS_NATIVE_RPC
+	depends on !BR2_TOOLCHAIN_EXTERNAL_MUSL
 	default y if BR2_TOOLCHAIN_EXTERNAL_GLIBC
 	help
 	  Select this option if your external toolchain supports
diff --git a/toolchain/toolchain-external/ext-tool.mk b/toolchain/toolchain-external/ext-tool.mk
index 8762a46..f642017 100644
--- a/toolchain/toolchain-external/ext-tool.mk
+++ b/toolchain/toolchain-external/ext-tool.mk
@@ -63,6 +63,10 @@ ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GLIBC),y)
 LIB_EXTERNAL_LIBS+=libnss_files.so.* libnss_dns.so.*
 endif
 
+ifeq ($(BR2_TOOLCHAIN_EXTERNAL_MUSL),y)
+LIB_EXTERNAL_LIBS += libc.so libgcc_s.so.*
+endif
+
 ifeq ($(BR2_INSTALL_LIBSTDCPP),y)
 USR_LIB_EXTERNAL_LIBS+=libstdc++.so.*
 endif
@@ -369,7 +373,7 @@ $(STAMP_DIR)/ext-toolchain-checked: $(TOOLCHAIN_EXTERNAL_DEPENDENCIES)
 	@$(call MESSAGE,"Checking external toolchain settings")
 	$(Q)$(call check_cross_compiler_exists,$(TOOLCHAIN_EXTERNAL_CC))
 	$(Q)LIBC_A_LOCATION=`readlink -f $$(LANG=C $(TOOLCHAIN_EXTERNAL_CC) -print-file-name=libc.a)` ; \
-	SYSROOT_DIR=`echo $${LIBC_A_LOCATION} | sed -r -e 's:usr/lib(32|64)?/(.*/)?libc\.a::'` ; \
+	SYSROOT_DIR=`echo $${LIBC_A_LOCATION} | sed -r -e 's:(usr/)?lib(32|64)?/(.*/)?libc\.a::'` ; \
 	if test -z "$${SYSROOT_DIR}" ; then \
 		@echo "External toolchain doesn't support --sysroot. Cannot use." ; \
 		exit 1 ; \
@@ -384,6 +388,8 @@ $(STAMP_DIR)/ext-toolchain-checked: $(TOOLCHAIN_EXTERNAL_DEPENDENCIES)
 	fi ; \
 	if test "$(BR2_TOOLCHAIN_EXTERNAL_UCLIBC)" = "y" ; then \
 		$(call check_uclibc,$${SYSROOT_DIR}) ; \
+	elif test "$(BR2_TOOLCHAIN_EXTERNAL_MUSL)" = "y" ; then \
+		$(call check_musl,$${SYSROOT_DIR}) ; \
 	else \
 		$(call check_glibc,$${SYSROOT_DIR}) ; \
 	fi
@@ -464,6 +470,9 @@ $(STAMP_DIR)/ext-toolchain-installed: $(STAMP_DIR)/ext-toolchain-checked
 			$(call copy_toolchain_lib_root,$${ARCH_SYSROOT_DIR},$${SUPPORT_LIB_DIR},$${ARCH_LIB_DIR},$$libs,/usr/lib); \
 		done ; \
 	fi ; \
+	if test "$(BR2_TOOLCHAIN_EXTERNAL_MUSL)" = "y" ; then \
+		ln -sf libc.so $(TARGET_DIR)/lib/ld-musl-arm.so.1 ; \
+	fi ; \
 	$(call MESSAGE,"Copying external toolchain sysroot to staging...") ; \
 	$(call copy_toolchain_sysroot,$${SYSROOT_DIR},$${ARCH_SYSROOT_DIR},$${ARCH_SUBDIR},$${ARCH_LIB_DIR},$${SUPPORT_LIB_DIR}) ; \
 	if test "$(BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY)" = "y"; then \
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH 4/5] toolchain-external: improve help text of some options
  2013-10-05 14:16 [Buildroot] [PATCH 0/5] Support for musl based external toolchains Thomas Petazzoni
                   ` (2 preceding siblings ...)
  2013-10-05 14:16 ` [Buildroot] [PATCH 3/5] toolchain-external: add support for musl C library Thomas Petazzoni
@ 2013-10-05 14:16 ` Thomas Petazzoni
  2013-10-05 14:16 ` [Buildroot] [PATCH 5/5] busybox: add patches to fix build with the musl C library Thomas Petazzoni
  4 siblings, 0 replies; 9+ messages in thread
From: Thomas Petazzoni @ 2013-10-05 14:16 UTC (permalink / raw)
  To: buildroot

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 toolchain/toolchain-external/Config.in | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/toolchain/toolchain-external/Config.in b/toolchain/toolchain-external/Config.in
index 89c799e..67f4fc7 100644
--- a/toolchain/toolchain-external/Config.in
+++ b/toolchain/toolchain-external/Config.in
@@ -876,15 +876,22 @@ config BR2_TOOLCHAIN_EXTERNAL_CUSTOM_UCLIBC
 	# For the time being, we assume that all custom external
 	# toolchains have shadow password support.
 	select BR2_TOOLCHAIN_HAS_SHADOW_PASSWORDS
+	help
+	  Select this option if your external toolchain uses the
+	  uClibc C library (available from http://www.uclibc.org/).
 
 config BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC
 	bool "glibc/eglibc"
 	select BR2_TOOLCHAIN_EXTERNAL_GLIBC
 	help
-	  Note: eglibc is a variant of glibc that (among other things) can be
-	  configured to exclude some of its features. Using a toolchain with
-	  eglibc configured to exclude key features may cause build failures to
-	  some packages.
+	  Select this option if your external toolchain uses the GNU C
+	  library (available from https://www.gnu.org/software/libc/)
+	  or its variant the eglibc library (http://www.eglibc.org/).
+
+	  Note: eglibc is a variant of glibc that (among other things)
+	  can be configured to exclude some of its features. Using a
+	  toolchain with eglibc configured to exclude key features may
+	  cause build failures to some packages.
 
 config BR2_TOOLCHAIN_EXTERNAL_CUSTOM_MUSL
 	bool "musl"
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH 5/5] busybox: add patches to fix build with the musl C library
  2013-10-05 14:16 [Buildroot] [PATCH 0/5] Support for musl based external toolchains Thomas Petazzoni
                   ` (3 preceding siblings ...)
  2013-10-05 14:16 ` [Buildroot] [PATCH 4/5] toolchain-external: improve help text of some options Thomas Petazzoni
@ 2013-10-05 14:16 ` Thomas Petazzoni
  4 siblings, 0 replies; 9+ messages in thread
From: Thomas Petazzoni @ 2013-10-05 14:16 UTC (permalink / raw)
  To: buildroot

Those patches have been submitted upstream.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 ...01-libbb-use-poll.h-instead-of-sys-poll.h.patch | 32 +++++++++++++++++++
 ...onfig-include-linux-if_slip.h-instead-of-.patch | 33 ++++++++++++++++++++
 ...libiproute-use-linux-if_packet.h-instead-.patch | 36 ++++++++++++++++++++++
 3 files changed, 101 insertions(+)
 create mode 100644 package/busybox/1.21.1/0001-libbb-use-poll.h-instead-of-sys-poll.h.patch
 create mode 100644 package/busybox/1.21.1/0002-network-ifconfig-include-linux-if_slip.h-instead-of-.patch
 create mode 100644 package/busybox/1.21.1/0003-networking-libiproute-use-linux-if_packet.h-instead-.patch

diff --git a/package/busybox/1.21.1/0001-libbb-use-poll.h-instead-of-sys-poll.h.patch b/package/busybox/1.21.1/0001-libbb-use-poll.h-instead-of-sys-poll.h.patch
new file mode 100644
index 0000000..089d858
--- /dev/null
+++ b/package/busybox/1.21.1/0001-libbb-use-poll.h-instead-of-sys-poll.h.patch
@@ -0,0 +1,32 @@
+From 676452a92d1fc4f85e8d89930d7729197c031026 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Sat, 5 Oct 2013 15:51:56 +0200
+Subject: [PATCH 1/3] libbb: use <poll.h> instead of <sys/poll.h>
+
+As the pol() manpage recommends, include the <poll.h> header instead
+of <sys/poll.h>. This allows to get rid of gazillions of warnings when
+building Busybox against the musl C library, which prints a warning
+when the internal header <sys/poll.h> is included directly instead of
+the <poll.h> header.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+---
+ include/libbb.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/include/libbb.h b/include/libbb.h
+index e520060..f03f454 100644
+--- a/include/libbb.h
++++ b/include/libbb.h
+@@ -37,7 +37,7 @@
+ #include <libgen.h> /* dirname,basename */
+ #undef basename
+ #define basename dont_use_basename
+-#include <sys/poll.h>
++#include <poll.h>
+ #include <sys/ioctl.h>
+ #include <sys/mman.h>
+ #include <sys/socket.h>
+-- 
+1.8.1.2
+
diff --git a/package/busybox/1.21.1/0002-network-ifconfig-include-linux-if_slip.h-instead-of-.patch b/package/busybox/1.21.1/0002-network-ifconfig-include-linux-if_slip.h-instead-of-.patch
new file mode 100644
index 0000000..ed35719
--- /dev/null
+++ b/package/busybox/1.21.1/0002-network-ifconfig-include-linux-if_slip.h-instead-of-.patch
@@ -0,0 +1,33 @@
+From 5eae213031a3ef88fe8d9d0a387f44264ea635cc Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Sat, 5 Oct 2013 15:53:16 +0200
+Subject: [PATCH 2/3] network/ifconfig: include <linux/if_slip.h> instead of
+ <net/if_slip.h>
+
+The musl C library doesn't provide the <net/if_slip.h> since userspace
+applications can just as well use the <linux/if_slip.h> kernel header.
+
+This commit fixes the build of the ifconfig applet with the musl C
+library.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+---
+ networking/ifconfig.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/networking/ifconfig.c b/networking/ifconfig.c
+index 782374b..c90ed6b 100644
+--- a/networking/ifconfig.c
++++ b/networking/ifconfig.c
+@@ -56,7 +56,7 @@
+ #endif
+ 
+ #if ENABLE_FEATURE_IFCONFIG_SLIP
+-# include <net/if_slip.h>
++# include <linux/if_slip.h>
+ #endif
+ 
+ /* I don't know if this is needed for busybox or not.  Anyone? */
+-- 
+1.8.1.2
+
diff --git a/package/busybox/1.21.1/0003-networking-libiproute-use-linux-if_packet.h-instead-.patch b/package/busybox/1.21.1/0003-networking-libiproute-use-linux-if_packet.h-instead-.patch
new file mode 100644
index 0000000..7b74656
--- /dev/null
+++ b/package/busybox/1.21.1/0003-networking-libiproute-use-linux-if_packet.h-instead-.patch
@@ -0,0 +1,36 @@
+From d4fec31889ad660a58dab633c511221feb66e817 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Sat, 5 Oct 2013 15:55:06 +0200
+Subject: [PATCH 3/3] networking/libiproute: use <linux/if_packet.h> instead of
+ <net/if_packet.h>
+
+The musl C library doesn't provide the <net/if_packet.h> since the
+corresponding kernel headers <linux/if_packet.h> already provides the
+necessary definitions. Replacing <net/if_packet.h> by
+<linux/if_packet.h> also removes the need to include
+<netpacket/packet.h>
+
+This commit fixes the build of iplink with the musl C library.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+---
+ networking/libiproute/iplink.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/networking/libiproute/iplink.c b/networking/libiproute/iplink.c
+index bad2017..32ccb1c 100644
+--- a/networking/libiproute/iplink.c
++++ b/networking/libiproute/iplink.c
+@@ -5,8 +5,7 @@
+  * Licensed under GPLv2 or later, see file LICENSE in this source tree.
+  */
+ #include <net/if.h>
+-#include <net/if_packet.h>
+-#include <netpacket/packet.h>
++#include <linux/if_packet.h>
+ #include <netinet/if_ether.h>
+ 
+ #include "ip_common.h"  /* #include "libbb.h" is inside */
+-- 
+1.8.1.2
+
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH 3/5] toolchain-external: add support for musl C library
  2013-10-05 14:16 ` [Buildroot] [PATCH 3/5] toolchain-external: add support for musl C library Thomas Petazzoni
@ 2013-10-05 14:18   ` Thomas Petazzoni
  2013-10-06  7:00     ` Thomas De Schampheleire
  2013-10-06  6:57   ` Thomas De Schampheleire
  1 sibling, 1 reply; 9+ messages in thread
From: Thomas Petazzoni @ 2013-10-05 14:18 UTC (permalink / raw)
  To: buildroot

Hello,

On Sat,  5 Oct 2013 16:16:12 +0200, Thomas Petazzoni wrote:

> +	if test "$(BR2_TOOLCHAIN_EXTERNAL_MUSL)" = "y" ; then \
> +		ln -sf libc.so $(TARGET_DIR)/lib/ld-musl-arm.so.1 ; \

Crap. This should indeed be conditional on the architecture. I'll fix
that in v2 with the other comments that the patches will receive.

Thomas
-- 
Thomas Petazzoni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH 3/5] toolchain-external: add support for musl C library
  2013-10-05 14:16 ` [Buildroot] [PATCH 3/5] toolchain-external: add support for musl C library Thomas Petazzoni
  2013-10-05 14:18   ` Thomas Petazzoni
@ 2013-10-06  6:57   ` Thomas De Schampheleire
  1 sibling, 0 replies; 9+ messages in thread
From: Thomas De Schampheleire @ 2013-10-06  6:57 UTC (permalink / raw)
  To: buildroot

Thomas Petazzoni <thomas.petazzoni@free-electrons.com> wrote:
>This commit adds support for external toolchains based on the musl C
>library, as available from http://www.musl-libc.org.
>
>Note that the pre-built musl toolchains available from
>http://musl.codu.org/ are not working for the moment, since they lack
>sysroot support. However, this problem has been reported to the
>maintainer, who has already added sysroot support in his scripts at
>https://bitbucket.org/GregorR/musl-cross, and therefore the next
>version of the pre-built toolchains should work with Buildroot
>out-of-the-box. In the mean time, the musl-cross script must be used
>to build the toolchain.
>
>Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
>---
> toolchain/Config.in                      |  9 +++++++++
> toolchain/helpers.mk                     | 11 +++++++++++
> toolchain/toolchain-external/Config.in   | 12 ++++++++++++
> toolchain/toolchain-external/ext-tool.mk | 11 ++++++++++-
> 4 files changed, 42 insertions(+), 1 deletion(-)
>
>diff --git a/toolchain/Config.in b/toolchain/Config.in
>index 17be32a..61eb520 100644
>--- a/toolchain/Config.in
>+++ b/toolchain/Config.in
>@@ -24,6 +24,15 @@ config BR2_TOOLCHAIN_USES_GLIBC
> config BR2_TOOLCHAIN_USES_UCLIBC
> 	bool
> 
>+config BR2_TOOLCHAIN_USES_MUSL
>+	bool
>+	select BR2_LARGEFILE
>+	select BR2_INET_IPV6
>+	select BR2_USE_WCHAR
>+	select BR2_ENABLE_LOCALE
>+	select BR2_TOOLCHAIN_HAS_THREADS
>+	select BR2_TOOLCHAIN_HAS_THREADS_DEBUG
>+
> choice
> 	prompt "Toolchain type"
> 	help
>diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
>index d5443b5..e8d4168 100644
>--- a/toolchain/helpers.mk
>+++ b/toolchain/helpers.mk
>@@ -214,6 +214,17 @@ check_glibc = \
> 	$(call check_glibc_rpc_feature,$${SYSROOT_DIR})
> 
> #
>+# Check that the selected C library is really musl
>+#
>+# $1: sysroot directory
>+check_musl = \
>+	SYSROOT_DIR="$(strip $1)"; \
>+	if test ! -f $${SYSROOT_DIR}/lib/libc.so -o -e $${SYSROOT_DIR}/lib/libm.so ; then \
>+		echo "Incorrect selection of the C library" ; \
>+		exit -1; \
>+	fi
>+
>+#
> # Check the conformity of Buildroot configuration with regard to the
> # uClibc configuration of the external toolchain, for a particular
> # feature.
>diff --git a/toolchain/toolchain-external/Config.in b/toolchain/toolchain-external/Config.in
>index c53577e..89c799e 100644
>--- a/toolchain/toolchain-external/Config.in
>+++ b/toolchain/toolchain-external/Config.in
>@@ -860,6 +860,10 @@ config BR2_TOOLCHAIN_EXTERNAL_UCLIBC
> 	bool
> 	select BR2_TOOLCHAIN_USES_UCLIBC
> 
>+config BR2_TOOLCHAIN_EXTERNAL_MUSL
>+	bool
>+	select BR2_TOOLCHAIN_USES_MUSL
>+
> if BR2_TOOLCHAIN_EXTERNAL_CUSTOM
> 
> choice
>@@ -882,6 +886,13 @@ config BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC
> 	  eglibc configured to exclude key features may cause build failures to
> 	  some packages.
> 
>+config BR2_TOOLCHAIN_EXTERNAL_CUSTOM_MUSL
>+	bool "musl"
>+	select BR2_TOOLCHAIN_EXTERNAL_MUSL
>+	help
>+	  Select this option if your external toolchain uses the
>+	  'musl' C library, available from http://www.musl-libc.org/.
>+
> endchoice
> 
> if BR2_TOOLCHAIN_EXTERNAL_CUSTOM_UCLIBC
>@@ -952,6 +963,7 @@ endif # BR2_TOOLCHAIN_EXTERNAL_CUSTOM_UCLIBC
> config BR2_TOOLCHAIN_EXTERNAL_INET_RPC
> 	bool "Toolchain has RPC support?"
> 	select BR2_TOOLCHAIN_HAS_NATIVE_RPC
>+	depends on !BR2_TOOLCHAIN_EXTERNAL_MUSL
> 	default y if BR2_TOOLCHAIN_EXTERNAL_GLIBC
> 	help
> 	  Select this option if your external toolchain supports
>diff --git a/toolchain/toolchain-external/ext-tool.mk b/toolchain/toolchain-external/ext-tool.mk
>index 8762a46..f642017 100644
>--- a/toolchain/toolchain-external/ext-tool.mk
>+++ b/toolchain/toolchain-external/ext-tool.mk
>@@ -63,6 +63,10 @@ ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GLIBC),y)
> LIB_EXTERNAL_LIBS+=libnss_files.so.* libnss_dns.so.*
> endif
> 
>+ifeq ($(BR2_TOOLCHAIN_EXTERNAL_MUSL),y)
>+LIB_EXTERNAL_LIBS += libc.so libgcc_s.so.*
>+endif
>+
> ifeq ($(BR2_INSTALL_LIBSTDCPP),y)
> USR_LIB_EXTERNAL_LIBS+=libstdc++.so.*
> endif
>@@ -369,7 +373,7 @@ $(STAMP_DIR)/ext-toolchain-checked: $(TOOLCHAIN_EXTERNAL_DEPENDENCIES)
> 	@$(call MESSAGE,"Checking external toolchain settings")
> 	$(Q)$(call check_cross_compiler_exists,$(TOOLCHAIN_EXTERNAL_CC))
> 	$(Q)LIBC_A_LOCATION=`readlink -f $$(LANG=C $(TOOLCHAIN_EXTERNAL_CC) -print-file-name=libc.a)` ; \
>-	SYSROOT_DIR=`echo $${LIBC_A_LOCATION} | sed -r -e 's:usr/lib(32|64)?/(.*/)?libc\.a::'` ; \
>+	SYSROOT_DIR=`echo $${LIBC_A_LOCATION} | sed -r -e 's:(usr/)?lib(32|64)?/(.*/)?libc\.a::'` ; \
> 	if test -z "$${SYSROOT_DIR}" ; then \
> 		@echo "External toolchain doesn't support --sysroot. Cannot use." ; \
> 		exit 1 ; \
>@@ -384,6 +388,8 @@ $(STAMP_DIR)/ext-toolchain-checked: $(TOOLCHAIN_EXTERNAL_DEPENDENCIES)
> 	fi ; \
> 	if test "$(BR2_TOOLCHAIN_EXTERNAL_UCLIBC)" = "y" ; then \
> 		$(call check_uclibc,$${SYSROOT_DIR}) ; \
>+	elif test "$(BR2_TOOLCHAIN_EXTERNAL_MUSL)" = "y" ; then \
>+		$(call check_musl,$${SYSROOT_DIR}) ; \
> 	else \
> 		$(call check_glibc,$${SYSROOT_DIR}) ; \
> 	fi
>@@ -464,6 +470,9 @@ $(STAMP_DIR)/ext-toolchain-installed: $(STAMP_DIR)/ext-toolchain-checked
> 			$(call copy_toolchain_lib_root,$${ARCH_SYSROOT_DIR},$${SUPPORT_LIB_DIR},$${ARCH_LIB_DIR},$$libs,/usr/lib); \
> 		done ; \
> 	fi ; \
>+	if test "$(BR2_TOOLCHAIN_EXTERNAL_MUSL)" = "y" ; then \
>+		ln -sf libc.so $(TARGET_DIR)/lib/ld-musl-arm.so.1 ; \
>+	fi ; \

Is this intentionally arm-specific?

> 	$(call MESSAGE,"Copying external toolchain sysroot to staging...") ; \
> 	$(call copy_toolchain_sysroot,$${SYSROOT_DIR},$${ARCH_SYSROOT_DIR},$${ARCH_SUBDIR},$${ARCH_LIB_DIR},$${SUPPORT_LIB_DIR}) ; \
> 	if test "$(BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY)" = "y"; then \

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH 3/5] toolchain-external: add support for musl C library
  2013-10-05 14:18   ` Thomas Petazzoni
@ 2013-10-06  7:00     ` Thomas De Schampheleire
  0 siblings, 0 replies; 9+ messages in thread
From: Thomas De Schampheleire @ 2013-10-06  7:00 UTC (permalink / raw)
  To: buildroot

Thomas Petazzoni <thomas.petazzoni@free-electrons.com> wrote:
>Hello,
>
>On Sat,  5 Oct 2013 16:16:12 +0200, Thomas Petazzoni wrote:
>
>> +	if test "$(BR2_TOOLCHAIN_EXTERNAL_MUSL)" = "y" ; then \
>> +		ln -sf libc.so $(TARGET_DIR)/lib/ld-musl-arm.so.1 ; \
>
>Crap. This should indeed be conditional on the architecture. I'll fix
>that in v2 with the other comments that the patches will receive.

Ah I hadn't seen this yet... please disregard my previous mail...

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-10-06  7:00 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-05 14:16 [Buildroot] [PATCH 0/5] Support for musl based external toolchains Thomas Petazzoni
2013-10-05 14:16 ` [Buildroot] [PATCH 1/5] toolchain-external: conditionalize the installation of libraries Thomas Petazzoni
2013-10-05 14:16 ` [Buildroot] [PATCH 2/5] toolchain-external: modify the wildcard logic for shared libraries copying Thomas Petazzoni
2013-10-05 14:16 ` [Buildroot] [PATCH 3/5] toolchain-external: add support for musl C library Thomas Petazzoni
2013-10-05 14:18   ` Thomas Petazzoni
2013-10-06  7:00     ` Thomas De Schampheleire
2013-10-06  6:57   ` Thomas De Schampheleire
2013-10-05 14:16 ` [Buildroot] [PATCH 4/5] toolchain-external: improve help text of some options Thomas Petazzoni
2013-10-05 14:16 ` [Buildroot] [PATCH 5/5] busybox: add patches to fix build with the musl C library Thomas Petazzoni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox