Skip to contentSkip to conversation

systemd: fix build with uClibc toolchains

PATCH New Thomas Petazzoni 2 participants 2 messages Feb 12, 2014 – Feb 13, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 systemd: fix build with uClibc toolchains

Currently, the build of systemd is broken with the internal toolchain backend, because we have uClibc patches that add support for execvpe(), but we also have a patch for systemd that adds execvpe(), which was added when the internal uClibc didn't support execvpe().

However, simply dropping the patch is not a solution, as it would break the build of systemd with any other uClibc than the ones built with Buildroot. For example, a Crosstool-NG uClibc toolchain would fail.

Beyond this execvpe() problem, there are also other problems that prevented systemd from being built with unpatched uClibc.

This patch does the following:

* Add sequence numbers of systemd patches.
* Regenerate them to avoid fuzz.
* Improve the uClibc compatibility patch so that it:
- Detects whether execvpe() is available or not, and if not available provide an implementation.
- Detects if dup3() is available or not, and if not available provide an implementation.
- Detects if MSG_CMSG_CLOEXEC is defined or not, and if not, define it to the appropriate value.

This has been tested with uClibc internal toolchain, uClibc external toolchain built with Buildroot, uClibc external toolchain built with Crosstool-NG, and glibc external toolchain.

Fixes bug #6776.

Fixes:

http://autobuild.buildroot.org/results/591/591c6055430da334bd1e46e7d01497add45da837/build-end.log
http://autobuild.buildroot.org/results/e58/e5851939d2837d4e35a4c1d9ca6df3c93ed5a34b/build-end.log
http://autobuild.buildroot.org/results/92e/92e4c40c69a3feb4046b2fe5a0d8c69d5a44a157/build-end.log

---
Obviously, this patch is for the master branch. On the next branch, systemd has been bumped to a much newer version of systemd, which is now restricted to glibc. I however believe that it is worth having systemd-44 working in 2014.02.

---
 ...-unit.patch => systemd-01-fix-getty-unit.patch} | 16 ++++-----
 ...e-size.patch => systemd-02-fix-page-size.patch} |  6 ++--
 ...clibc-fix.patch => systemd-03-uclibc-fix.patch} | 41 +++++++++++++++++-----
 package/systemd/systemd.mk                         |  2 ++
 4 files changed, 46 insertions(+), 19 deletions(-)
 rename package/systemd/{systemd-fix-getty-unit.patch => systemd-01-fix-getty-unit.patch} (70%)
 rename package/systemd/{systemd-fix-page-size.patch => systemd-02-fix-page-size.patch} (91%)
 rename package/systemd/{systemd-uclibc-fix.patch => systemd-03-uclibc-fix.patch} (60%)
package/systemd/systemd-01-fix-getty-unit.patch renamed from package/systemd/systemd-fix-getty-unit.patch +8 -8
similarity index 70%
rename from package/systemd/systemd-fix-getty-unit.patch
rename to package/systemd/systemd-01-fix-getty-unit.patch
index 6df54b1..9008e43 100644
@@ -6,11 +6,11 @@ Signed-off-by: Maxime Ripard <[email protected]>
  units/serial-getty at .service.m4 |    2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
 
-Index: systemd-37/units/getty at .service.m4
+Index: b/units/getty at .service.m4
 ===================================================================
---- systemd-37.orig/units/getty at .service.m4
-+++ systemd-37/units/getty at .service.m4
-@@ -32,7 +32,7 @@
+--- a/units/getty at .service.m4
++++ b/units/getty at .service.m4
+@@ -35,7 +35,7 @@
  
  [Service]
  Environment=TERM=linux
@@ -19,11 +19,11 @@ Index: systemd-37/units/getty at .service.m4
  Restart=always
  RestartSec=0
  UtmpIdentifier=%I
-Index: systemd-37/units/serial-getty at .service.m4
+Index: b/units/serial-getty at .service.m4
 ===================================================================
---- systemd-37.orig/units/serial-getty at .service.m4
-+++ systemd-37/units/serial-getty at .service.m4
-@@ -32,7 +32,7 @@
+--- a/units/serial-getty at .service.m4
++++ b/units/serial-getty at .service.m4
+@@ -35,7 +35,7 @@
  
  [Service]
  Environment=TERM=vt100
package/systemd/systemd-02-fix-page-size.patch renamed from package/systemd/systemd-fix-page-size.patch +3 -3
similarity index 91%
rename from package/systemd/systemd-fix-page-size.patch
rename to package/systemd/systemd-02-fix-page-size.patch
index 241ceb8..a8b351a 100644
@@ -6,8 +6,8 @@ Date:   Wed Mar 21 23:47:44 2012 +0100
     
     Let's use NAME_MAX, as suggested by Dan Walsh
 
-diff --git a/src/journal/journald.c b/src/journal/journald.c
-index d27cb60..87390bd 100644
+Index: b/src/journal/journald.c
+===================================================================
 --- a/src/journal/journald.c
 +++ b/src/journal/journald.c
 @@ -29,7 +29,6 @@
@@ -18,7 +18,7 @@ index d27cb60..87390bd 100644
  
  #include <systemd/sd-journal.h>
  #include <systemd/sd-login.h>
-@@ -2149,10 +2148,20 @@ static int process_event(Server *s, struct epoll_event *ev) {
+@@ -2141,10 +2140,20 @@
                          size_t label_len = 0;
                          union {
                                  struct cmsghdr cmsghdr;
package/systemd/systemd-03-uclibc-fix.patch renamed from package/systemd/systemd-uclibc-fix.patch +33 -8

68 lines not on this page · raw message

package/systemd/systemd.mk +2 -0
index a5dc8e5..bd90101 100644
@@ -22,6 +22,8 @@ ifeq ($(BR2_PACKAGE_BUSYBOX),y)
 	SYSTEMD_DEPENDENCIES += busybox
 endif
 
+SYSTEMD_AUTORECONF = YES
+
 SYSTEMD_CONF_OPT += \
 	--with-distro=other \
 	--disable-selinux \
Signature · 1 line
1.8.3.2
#1 lore raw

PATCH 1/1 systemd: fix build with uClibc toolchains

Quoted 39 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Currently, the build of systemd is broken with the internal toolchain backend, because we have uClibc patches that add support for execvpe(), but we also have a patch for systemd that adds execvpe(), which was added when the internal uClibc didn't support execvpe().

However, simply dropping the patch is not a solution, as it would break the build of systemd with any other uClibc than the ones built with Buildroot. For example, a Crosstool-NG uClibc toolchain would fail.

Beyond this execvpe() problem, there are also other problems that prevented systemd from being built with unpatched uClibc.

This patch does the following:

* Add sequence numbers of systemd patches.
* Regenerate them to avoid fuzz.
* Improve the uClibc compatibility patch so that it:
- Detects whether execvpe() is available or not, and if not available provide an implementation.
- Detects if dup3() is available or not, and if not available provide an implementation.
- Detects if MSG_CMSG_CLOEXEC is defined or not, and if not, define it to the appropriate value.

This has been tested with uClibc internal toolchain, uClibc external toolchain built with Buildroot, uClibc external toolchain built with Crosstool-NG, and glibc external toolchain.

Fixes bug #6776.

Fixes:

http://autobuild.buildroot.org/results/591/591c6055430da334bd1e46e7d01497add45da837/build-end.log
http://autobuild.buildroot.org/results/e58/e5851939d2837d4e35a4c1d9ca6df3c93ed5a34b/build-end.log
http://autobuild.buildroot.org/results/92e/92e4c40c69a3feb4046b2fe5a0d8c69d5a44a157/build-end.log

Quoted 6 lines

---
Obviously, this patch is for the master branch. On the next branch, systemd has been bumped to a much newer version of systemd, which is now restricted to glibc. I however believe that it is worth having systemd-44 working in 2014.02.

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard