Skip to content

Commit 58f36b6

Browse files
authored
Merge pull request bottlerocket-os#706 from bcressey/bootstrap-libudev
add libudev for bootstrapping purposes
2 parents 818479f + f032a07 commit 58f36b6

11 files changed

+162
-12
lines changed

Cargo.lock

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/libcryptsetup/0001-pbkdf-check-whether-FIPS-is-enabled-at-runtime.patch

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
From 246df3d2d990257de06ce8b2219a7f4f198e69cc Mon Sep 17 00:00:00 2001
1+
From d30aec8c423c9b9d6899bfa4c99985c5562e3c42 Mon Sep 17 00:00:00 2001
22
From: Ben Cressey <[email protected]>
33
Date: Fri, 28 Mar 2025 21:29:04 +0000
44
Subject: [PATCH] pbkdf: check whether FIPS is enabled at runtime
@@ -19,7 +19,7 @@ Signed-off-by: Ben Cressey <[email protected]>
1919
1 file changed, 12 insertions(+), 1 deletion(-)
2020

2121
diff --git a/lib/utils_pbkdf.c b/lib/utils_pbkdf.c
22-
index b54509c8..37db5932 100644
22+
index 87e9419..bea4024 100644
2323
--- a/lib/utils_pbkdf.c
2424
+++ b/lib/utils_pbkdf.c
2525
@@ -8,6 +8,7 @@
@@ -30,7 +30,7 @@ index b54509c8..37db5932 100644
3030

3131
#include "internal.h"
3232

33-
@@ -185,8 +186,18 @@ int init_pbkdf_type(struct crypt_device *cd,
33+
@@ -192,8 +193,18 @@ int init_pbkdf_type(struct crypt_device *cd,
3434
unsigned cpus;
3535
uint32_t old_flags, memory_kb;
3636
int r;
@@ -50,6 +50,3 @@ index b54509c8..37db5932 100644
5050
if (pbkdf && strcmp(pbkdf->type, CRYPT_KDF_PBKDF2)) {
5151
log_err(cd, _("Only PBKDF2 is supported in FIPS mode."));
5252
return -EINVAL;
53-
--
54-
2.48.1
55-
Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
From b25fb07213c0dfd91693bfa1ee375b8b26525734 Mon Sep 17 00:00:00 2001
1+
From 2949ceab1ea4618fcac5668a99f89dcb272c3875 Mon Sep 17 00:00:00 2001
22
From: Ben Cressey <[email protected]>
33
Date: Sat, 17 May 2025 18:01:33 +0000
44
Subject: [PATCH] build: replace openssl with libcrypto in pkgconfig
@@ -9,10 +9,10 @@ Signed-off-by: Ben Cressey <[email protected]>
99
1 file changed, 1 insertion(+), 1 deletion(-)
1010

1111
diff --git a/configure.ac b/configure.ac
12-
index a5535731..58019842 100644
12+
index 6a6c4df..a00dcc7 100644
1313
--- a/configure.ac
1414
+++ b/configure.ac
15-
@@ -710,7 +710,7 @@ dnl pwquality is used only by tools
15+
@@ -717,7 +717,7 @@ dnl pwquality is used only by tools
1616
PKGMODULES="uuid devmapper json-c"
1717
case $with_crypto_backend in
1818
gcrypt) PKGMODULES="$PKGMODULES libgcrypt" ;;
@@ -21,6 +21,3 @@ index a5535731..58019842 100644
2121
nss) PKGMODULES="$PKGMODULES nss" ;;
2222
nettle) PKGMODULES="$PKGMODULES nettle" ;;
2323
esac
24-
--
25-
2.49.0
26-
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
From abb56fb487f9e4692d0eb6bbeae3f10f8a7f8445 Mon Sep 17 00:00:00 2001
2+
From: Ben Cressey <[email protected]>
3+
Date: Sat, 25 Oct 2025 17:41:13 +0000
4+
Subject: [PATCH] random: quiet message about FIPS mode
5+
6+
Since we always build with FIPS mode enabled, the message isn't very
7+
useful. It's also printed by other tools that depend on the library,
8+
where it can clutter up the output.
9+
10+
Demote the message to debug level to make it less intrusive.
11+
12+
Signed-off-by: Ben Cressey <[email protected]>
13+
---
14+
lib/random.c | 2 +-
15+
1 file changed, 1 insertion(+), 1 deletion(-)
16+
17+
diff --git a/lib/random.c b/lib/random.c
18+
index 06d2713..71acbf3 100644
19+
--- a/lib/random.c
20+
+++ b/lib/random.c
21+
@@ -147,7 +147,7 @@ int crypt_random_init(struct crypt_device *ctx)
22+
goto err;
23+
24+
if (crypt_fips_mode())
25+
- log_verbose(ctx, _("Running in FIPS mode."));
26+
+ log_dbg(ctx, _("Running in FIPS mode."));
27+
28+
random_initialised = 1;
29+
return 0;

packages/libcryptsetup/libcryptsetup.spec

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ Patch0001: 0001-pbkdf-check-whether-FIPS-is-enabled-at-runtime.patch
1515
# cryptsetup only depends on libcrypto, not libssl.
1616
Patch0002: 0002-build-replace-openssl-with-libcrypto-in-pkgconfig.patch
1717

18+
# Quiet warning about FIPS mode.
19+
Patch0003: 0003-random-quiet-message-about-FIPS-mode.patch
20+
1821
BuildRequires: %{_cross_os}glibc-devel
1922
BuildRequires: %{_cross_os}libblkid-devel
2023
BuildRequires: %{_cross_os}libcrypto-devel
@@ -77,6 +80,7 @@ autoreconf -fi
7780
--enable-internal-argon2 \
7881
--enable-internal-sse-argon2 \
7982
--enable-selinux \
83+
--enable-udev \
8084
--enable-veritysetup \
8185
--with-crypto_backend=openssl \
8286
--with-luks2-pbkdf=pbkdf2 \

packages/libdevmapper/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ sha512 = "de081006558f8ef998cbfbacc1b887d43702a39bc3dd6dd2a9e59ffd0481889921ef49
2323
glibc = { path = "../glibc" }
2424
libselinux = { path = "../libselinux" }
2525
libaio = { path = "../libaio" }
26+
libudev = { path = "../libudev" }
2627
util-linux = { path = "../util-linux" }

packages/libdevmapper/libdevmapper.spec

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,19 @@ BuildRequires: %{_cross_os}glibc-devel
1212
BuildRequires: %{_cross_os}libaio-devel
1313
BuildRequires: %{_cross_os}libblkid-devel
1414
BuildRequires: %{_cross_os}libselinux-devel
15+
BuildRequires: %{_cross_os}libudev-devel
1516
Requires: %{_cross_os}libaio
1617
Requires: %{_cross_os}libblkid
1718
Requires: %{_cross_os}libselinux
19+
Requires: %{_cross_os}libudev
1820

1921
%description
2022
%{summary}.
2123

2224
%package devel
2325
Summary: Files for development using the library for device mapper
2426
Requires: %{name}
27+
Requires: %{_cross_os}libudev-devel
2528

2629
%description devel
2730
%{summary}.
@@ -54,6 +57,7 @@ Requires: %{name}
5457
--enable-pkgconfig \
5558
--enable-selinux \
5659
--enable-udev_rules \
60+
--enable-udev_sync \
5761
--with-user= \
5862
--with-group= \
5963
--with-device-uid=0 \

packages/libudev/Cargo.toml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[package]
2+
name = "libudev"
3+
version = "0.1.0"
4+
edition = "2021"
5+
publish = false
6+
build = "../build.rs"
7+
8+
[lib]
9+
path = "../packages.rs"
10+
11+
[package.metadata.build-package]
12+
releases-url = "https://github.com/systemd/systemd-stable/releases"
13+
14+
[[package.metadata.build-package.external-files]]
15+
url = "https://github.com/systemd/systemd-stable/archive/v252.39/systemd-stable-252.39.tar.gz"
16+
sha512 = "0a24faf0dd6da9d5b55dafab332bdd40bfb90f643bd6caa3b6ecfcb8feaeabe51b1cf007f033e8d9ea3f52efdb4722ed63816b31646d70b99c22eb1eb2705450"
17+
18+
[build-dependencies]
19+
glibc = { path = "../glibc" }
20+
kmod = { path = "../kmod" }
21+
libacl = { path = "../libacl" }
22+
libattr = { path = "../libattr" }
23+
libcap = { path = "../libcap" }
24+
libseccomp = { path = "../libseccomp" }
25+
libselinux = { path = "../libselinux" }
26+
libxcrypt = { path = "../libxcrypt" }
27+
util-linux = { path = "../util-linux" }

packages/libudev/libudev.spec

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Skip check-rpaths since we expect them for systemd.
2+
%global __brp_check_rpaths %{nil}
3+
4+
Name: %{_cross_os}libudev
5+
Version: 252.39
6+
Release: 1%{?dist}
7+
Summary: System and Service Manager
8+
License: GPL-2.0-or-later AND GPL-2.0-only AND LGPL-2.1-or-later
9+
URL: https://www.freedesktop.org/wiki/Software/systemd
10+
Source0: https://github.com/systemd/systemd-stable/archive/v%{version}/systemd-stable-%{version}.tar.gz
11+
12+
BuildRequires: %{_cross_os}glibc-devel
13+
BuildRequires: %{_cross_os}kmod-devel
14+
BuildRequires: %{_cross_os}libacl-devel
15+
BuildRequires: %{_cross_os}libattr-devel
16+
BuildRequires: %{_cross_os}libblkid-devel
17+
BuildRequires: %{_cross_os}libcap-devel
18+
BuildRequires: %{_cross_os}libfdisk-devel
19+
BuildRequires: %{_cross_os}libmount-devel
20+
BuildRequires: %{_cross_os}libseccomp-devel
21+
BuildRequires: %{_cross_os}libselinux-devel
22+
BuildRequires: %{_cross_os}libuuid-devel
23+
BuildRequires: %{_cross_os}libxcrypt-devel
24+
25+
# Discourage dnf from picking this bootstrap package during image builds.
26+
Conflicts: %{_cross_os}filesystem
27+
Conflicts: %{_cross_os}release
28+
Conflicts: %{_cross_os}systemd
29+
30+
%description
31+
%{summary}.
32+
33+
%package devel
34+
Summary: Files for development using the System and Service Manager
35+
Requires: %{name}
36+
Requires: %{_cross_os}libcap
37+
38+
%description devel
39+
%{summary}.
40+
41+
%prep
42+
%autosetup -n systemd-stable-%{version} -p1
43+
44+
%build
45+
CONFIGURE_OPTS=(
46+
-Dmode=release
47+
48+
-Drootprefix='%{_cross_prefix}'
49+
-Drootlibdir='%{_cross_libdir}'
50+
51+
-Dpkgconfigdatadir='%{_cross_pkgconfigdir}'
52+
-Dpkgconfiglibdir='%{_cross_pkgconfigdir}'
53+
)
54+
55+
%cross_meson "${CONFIGURE_OPTS[@]}"
56+
%cross_meson_build
57+
58+
%install
59+
%cross_meson_install
60+
61+
find %{buildroot} \( -type f -o -type l \) ! -name '*libudev*' -delete
62+
63+
%files
64+
%license LICENSE.GPL2 LICENSE.LGPL2.1
65+
%{_cross_attribution_file}
66+
%{_cross_libdir}/libudev.so.*
67+
68+
%files devel
69+
%{_cross_libdir}/libudev.so
70+
%{_cross_includedir}/libudev.h
71+
%{_cross_pkgconfigdir}/libudev*.pc

packages/systemd-252/systemd-252.spec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ Requires: %{_cross_os}libuuid
132132
Requires: %{_cross_os}libxcrypt
133133

134134
Provides: %{_cross_os}systemd = %{package_priority_epoch}:
135+
Provides: %{_cross_os}libudev = %{package_priority_epoch}:
135136
Conflicts: %{_cross_os}systemd
136137

137138
%description
@@ -158,6 +159,7 @@ Provides: %{_cross_os}systemd-cryptsetup = %{package_priority_epoch}:
158159
Summary: Files for development using the System and Service Manager
159160
Requires: %{name}
160161
Provides: %{_cross_os}systemd-devel = %{package_priority_epoch}:
162+
Provides: %{_cross_os}libudev-devel = %{package_priority_epoch}:
161163

162164
%description devel
163165
%{summary}.

0 commit comments

Comments
 (0)