* [Buildroot] [PATCH 1/1] package/systemd: fix compiling with headers < 4.14
@ 2024-06-17 8:03 Raphaël Mélotte via buildroot
2024-07-11 20:00 ` Thomas Petazzoni via buildroot
0 siblings, 1 reply; 2+ messages in thread
From: Raphaël Mélotte via buildroot @ 2024-06-17 8:03 UTC (permalink / raw)
To: buildroot
Cc: Norbert Lange, Raphaël Mélotte, Yann E. MORIN,
Sen Hastings
In commit 360a7cd738a85067ba60b029ca88eb7c874bfe4f ("package/systemd:
bump linux-headers dependency to 4.14"), the headers requirements were
bumped to 4.14 because of new build failures due to
LOOP_SET_BLOCK_SIZE.
Even though systemd does not recommend using it with headers <
4.15 (see [1]), it is still possible to build it and use some of its
features (after fixing the build failure).
Note that this was build-tested with 4.4 headers only, and not all the
way back to 3.15 (which is the version requirement that was used
before 360a7cd738a85067ba60b029ca88eb7c874bfe4f).
[1]: https://github.com/systemd/systemd/blob/main/README
Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
---
...g_loop.h-fix-missing-LOOP_SET_BLOCK_.patch | 40 +++++++++++++++++++
package/systemd/Config.in | 7 ++--
system/Config.in | 6 +--
3 files changed, 47 insertions(+), 6 deletions(-)
create mode 100644 package/systemd/0001-src-basic-missing_loop.h-fix-missing-LOOP_SET_BLOCK_.patch
diff --git a/package/systemd/0001-src-basic-missing_loop.h-fix-missing-LOOP_SET_BLOCK_.patch b/package/systemd/0001-src-basic-missing_loop.h-fix-missing-LOOP_SET_BLOCK_.patch
new file mode 100644
index 0000000000..6072b1be7b
--- /dev/null
+++ b/package/systemd/0001-src-basic-missing_loop.h-fix-missing-LOOP_SET_BLOCK_.patch
@@ -0,0 +1,40 @@
+From 1b205aa9b15f04c510f76f3574726f6159f08291 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Rapha=C3=ABl=20M=C3=A9lotte?= <raphael.melotte@mind.be>
+Date: Fri, 14 Jun 2024 14:37:29 +0200
+Subject: [PATCH] src/basic/missing_loop.h: fix missing LOOP_SET_BLOCK_SIZE
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Builds with kernels headers < 4.14 fail with:
+
+../src/shared/loop-util.c: In function ‘loop_configure_fallback’:
+../src/shared/loop-util.c:237:31: error: ‘LOOP_SET_BLOCK_SIZE’ undeclared (first use in this function); did you mean ‘LOOP_SET_DIRECT_IO’?
+ if (ioctl(fd, LOOP_SET_BLOCK_SIZE, (unsigned long) c->block_size) < 0)
+ ^~~~~~~~~~~~~~~~~~~
+ LOOP_SET_DIRECT_IO
+
+Fixes: https://github.com/systemd/systemd/issues/33341
+
+Upstream: https://github.com/systemd/systemd/pull/33342
+
+Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
+---
+ src/basic/missing_loop.h | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/basic/missing_loop.h b/src/basic/missing_loop.h
+index b88501d78b..f83a14c914 100644
+--- a/src/basic/missing_loop.h
++++ b/src/basic/missing_loop.h
+@@ -29,3 +29,7 @@ assert_cc(LOOP_SET_DIRECT_IO == 0x4C08);
+ #ifndef LOOP_SET_STATUS_SETTABLE_FLAGS
+ # define LOOP_SET_STATUS_SETTABLE_FLAGS (LO_FLAGS_AUTOCLEAR | LO_FLAGS_PARTSCAN)
+ #endif
++
++#ifndef LOOP_SET_BLOCK_SIZE
++# define LOOP_SET_BLOCK_SIZE 0x4C09
++#endif
+--
+2.45.1
+
diff --git a/package/systemd/Config.in b/package/systemd/Config.in
index a94e9b73b8..82c0e30474 100644
--- a/package/systemd/Config.in
+++ b/package/systemd/Config.in
@@ -22,7 +22,7 @@ menuconfig BR2_PACKAGE_SYSTEMD
depends on !BR2_STATIC_LIBS # kmod
depends on BR2_TOOLCHAIN_USES_GLIBC
depends on BR2_TOOLCHAIN_HAS_SSP
- depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_14 # LOOP_SET_BLOCK_SIZE
+ depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_15
depends on BR2_TOOLCHAIN_GCC_AT_LEAST_5
depends on BR2_HOST_GCC_AT_LEAST_5 # host-systemd
select BR2_PACKAGE_HAS_UDEV
@@ -239,6 +239,7 @@ config BR2_PACKAGE_SYSTEMD_HOMED
depends on BR2_USE_MMU # cryptsetup -> lvm2
depends on !BR2_STATIC_LIBS # cryptsetup -> lvm2
depends on BR2_TOOLCHAIN_HAS_SYNC_4 # cryptsetup -> json-c
+ depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_12 # fscrypt_key
select BR2_PACKAGE_CRYPTSETUP
select BR2_PACKAGE_OPENSSL
select BR2_PACKAGE_OPENSSL_FORCE_LIBOPENSSL
@@ -249,11 +250,11 @@ config BR2_PACKAGE_SYSTEMD_HOMED
https://www.freedesktop.org/software/systemd/man/systemd-homed.service.html
-comment "homed support needs a toolchain w/ threads, dynamic library"
+comment "homed support needs a toolchain w/ threads, dynamic library, kernel headers >= 4.12"
depends on BR2_USE_MMU
depends on BR2_TOOLCHAIN_HAS_SYNC_4
depends on !BR2_TOOLCHAIN_HAS_THREADS || \
- BR2_STATIC_LIBS
+ BR2_STATIC_LIBS || !BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_12
config BR2_PACKAGE_SYSTEMD_HOSTNAMED
bool "enable hostname daemon"
diff --git a/system/Config.in b/system/Config.in
index 3fb17ed1c6..bc0c6eb6bc 100644
--- a/system/Config.in
+++ b/system/Config.in
@@ -125,19 +125,19 @@ config BR2_INIT_SYSTEMD
depends on BR2_TOOLCHAIN_USES_GLIBC
depends on BR2_TOOLCHAIN_HAS_SSP
depends on BR2_TOOLCHAIN_HAS_THREADS
- depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_14
+ depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_15
depends on BR2_TOOLCHAIN_GCC_AT_LEAST_5
depends on BR2_HOST_GCC_AT_LEAST_5
select BR2_ROOTFS_MERGED_USR
select BR2_PACKAGE_SYSTEMD
select BR2_PACKAGE_SKELETON_INIT_SYSTEMD if BR2_ROOTFS_SKELETON_DEFAULT
-comment "systemd needs a glibc toolchain w/ SSP, headers >= 4.14, host and target gcc >= 5"
+comment "systemd needs a glibc toolchain w/ SSP, headers >= 3.15, host and target gcc >= 5"
depends on BR2_PACKAGE_SYSTEMD_ARCH_SUPPORTS
depends on BR2_USE_MMU
depends on !BR2_TOOLCHAIN_USES_GLIBC || \
!BR2_TOOLCHAIN_HAS_SSP || \
- !BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_14 || \
+ !BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_15 || \
!BR2_TOOLCHAIN_GCC_AT_LEAST_5 || \
!BR2_HOST_GCC_AT_LEAST_5
--
2.37.3
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [Buildroot] [PATCH 1/1] package/systemd: fix compiling with headers < 4.14
2024-06-17 8:03 [Buildroot] [PATCH 1/1] package/systemd: fix compiling with headers < 4.14 Raphaël Mélotte via buildroot
@ 2024-07-11 20:00 ` Thomas Petazzoni via buildroot
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-07-11 20:00 UTC (permalink / raw)
To: Raphaël Mélotte via buildroot
Cc: Sen Hastings, Norbert Lange, Raphaël Mélotte,
Yann E. MORIN
On Mon, 17 Jun 2024 10:03:09 +0200
Raphaël Mélotte via buildroot <buildroot@buildroot.org> wrote:
> In commit 360a7cd738a85067ba60b029ca88eb7c874bfe4f ("package/systemd:
> bump linux-headers dependency to 4.14"), the headers requirements were
> bumped to 4.14 because of new build failures due to
> LOOP_SET_BLOCK_SIZE.
>
> Even though systemd does not recommend using it with headers <
> 4.15 (see [1]), it is still possible to build it and use some of its
> features (after fixing the build failure).
>
> Note that this was build-tested with 4.4 headers only, and not all the
> way back to 3.15 (which is the version requirement that was used
> before 360a7cd738a85067ba60b029ca88eb7c874bfe4f).
>
> [1]: https://github.com/systemd/systemd/blob/main/README
>
> Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
> ---
> ...g_loop.h-fix-missing-LOOP_SET_BLOCK_.patch | 40 +++++++++++++++++++
> package/systemd/Config.in | 7 ++--
> system/Config.in | 6 +--
> 3 files changed, 47 insertions(+), 6 deletions(-)
> create mode 100644 package/systemd/0001-src-basic-missing_loop.h-fix-missing-LOOP_SET_BLOCK_.patch
Applied to master, after refreshing the patch so that it applies on the
current version of systemd we have packaged, and updating the Upstream:
tag of the patch to point to the upstream commit, now that your pull
request has been accepted upstream.
Thanks a lot!
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-07-11 20:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-17 8:03 [Buildroot] [PATCH 1/1] package/systemd: fix compiling with headers < 4.14 Raphaël Mélotte via buildroot
2024-07-11 20:00 ` Thomas Petazzoni via buildroot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.