summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrevor Woerner <trevor.woerner@amd.com>2025-03-28 13:10:57 -0400
committerMark Hatle <mark.hatle@amd.com>2025-05-08 13:58:14 -0500
commit87349a907b13bc5cabb9266acd64deb648e73ed2 (patch)
treed2c86ce497b34fd9a578cf271aeff3d31837fafa
parenta9b1c80db916102b08ff074fc16013c4e5b85734 (diff)
downloadmeta-xilinx-87349a907b13bc5cabb9266acd64deb648e73ed2.tar.gz
util-linux: carry the version from upsream master
wic uses the sfdisk(-native) utility from the util-linux project. Adding support for 4k sectors requires a version of sfdisk that can handle variable-sized sectors specified on the command-line. The version of sfdisk in scarthgap (2.39.3) does not have this feature, but the version in master (2.40.4) does. Signed-off-by: Trevor Woerner <trevor.woerner@amd.com> The microblaze util-linux patch needs to be updated for 2.40 as well. Move existing integration to specifically target the Poky version, while a new 2.40 version is created. This should allow either version if the user decided to use PREFERRED_VERSION. Signed-off-by: Mark Hatle <mark.hatle@amd.com>
-rw-r--r--meta-microblaze/recipes-core/util-linux/util-linux-2.39/util-linux-microblaze.patch (renamed from meta-microblaze/recipes-core/util-linux/util-linux/util-linux-microblaze.patch)0
-rw-r--r--meta-microblaze/recipes-core/util-linux/util-linux-2.40/util-linux-microblaze.patch17
-rw-r--r--meta-microblaze/recipes-core/util-linux/util-linux_%.bbappend2
-rw-r--r--meta-microblaze/recipes-core/util-linux/util-linux_2.39%.bbappend2
-rw-r--r--meta-microblaze/recipes-core/util-linux/util-linux_2.40%.bbappend2
-rw-r--r--meta-xilinx-core/recipes-core/util-linux/util-linux-libuuid_2.40.4.bb19
-rw-r--r--meta-xilinx-core/recipes-core/util-linux/util-linux.inc47
-rw-r--r--meta-xilinx-core/recipes-core/util-linux/util-linux/0001-cfdisk-add-sector-size-commanand-line-option.patch90
-rw-r--r--meta-xilinx-core/recipes-core/util-linux/util-linux/0002-sfdisk-add-sector-size-commanand-line-option.patch105
-rw-r--r--meta-xilinx-core/recipes-core/util-linux/util-linux/avoid_parallel_tests.patch28
-rw-r--r--meta-xilinx-core/recipes-core/util-linux/util-linux/configure-sbindir.patch31
-rw-r--r--meta-xilinx-core/recipes-core/util-linux/util-linux/display_testname_for_subtest.patch24
-rw-r--r--meta-xilinx-core/recipes-core/util-linux/util-linux/fcntl-lock.c332
-rw-r--r--meta-xilinx-core/recipes-core/util-linux/util-linux/ptest.patch23
-rw-r--r--meta-xilinx-core/recipes-core/util-linux/util-linux/run-ptest35
-rw-r--r--meta-xilinx-core/recipes-core/util-linux/util-linux/runuser-l.pamd3
-rw-r--r--meta-xilinx-core/recipes-core/util-linux/util-linux/runuser.pamd4
-rw-r--r--meta-xilinx-core/recipes-core/util-linux/util-linux_2.40.4.bb379
18 files changed, 1141 insertions, 2 deletions
diff --git a/meta-microblaze/recipes-core/util-linux/util-linux/util-linux-microblaze.patch b/meta-microblaze/recipes-core/util-linux/util-linux-2.39/util-linux-microblaze.patch
index 07712c98..07712c98 100644
--- a/meta-microblaze/recipes-core/util-linux/util-linux/util-linux-microblaze.patch
+++ b/meta-microblaze/recipes-core/util-linux/util-linux-2.39/util-linux-microblaze.patch
diff --git a/meta-microblaze/recipes-core/util-linux/util-linux-2.40/util-linux-microblaze.patch b/meta-microblaze/recipes-core/util-linux/util-linux-2.40/util-linux-microblaze.patch
new file mode 100644
index 00000000..1173c7a7
--- /dev/null
+++ b/meta-microblaze/recipes-core/util-linux/util-linux-2.40/util-linux-microblaze.patch
@@ -0,0 +1,17 @@
1SECCOMP / Audit support needs to know about the microblaze architecture.
2
3Upstream-Status: Pending
4
5Signed-off-by: Mark Hatle <mark.hatle@amd.com>
6
7--- util-linux-2.40.4/include/audit-arch.h.orig 2025-03-29 14:37:22.925095934 -0600
8+++ util-linux-2.40.4/include/audit-arch.h 2025-03-29 14:37:47.921422955 -0600
9@@ -75,6 +75,8 @@
10 # endif
11 #elif __alpha__
12 # define SECCOMP_ARCH_NATIVE AUDIT_ARCH_ALPHA
13+#elif __microblaze__
14+# define SECCOMP_ARCH_NATIVE AUDIT_ARCH_MICROBLAZE
15 #else
16 # error Unknown target architecture
17 #endif
diff --git a/meta-microblaze/recipes-core/util-linux/util-linux_%.bbappend b/meta-microblaze/recipes-core/util-linux/util-linux_%.bbappend
deleted file mode 100644
index 7774dda5..00000000
--- a/meta-microblaze/recipes-core/util-linux/util-linux_%.bbappend
+++ /dev/null
@@ -1,2 +0,0 @@
1FILESEXTRAPATHS:append:microblaze := ":${THISDIR}/util-linux"
2SRC_URI:append:microblaze = " file://util-linux-microblaze.patch"
diff --git a/meta-microblaze/recipes-core/util-linux/util-linux_2.39%.bbappend b/meta-microblaze/recipes-core/util-linux/util-linux_2.39%.bbappend
new file mode 100644
index 00000000..b46ea3ea
--- /dev/null
+++ b/meta-microblaze/recipes-core/util-linux/util-linux_2.39%.bbappend
@@ -0,0 +1,2 @@
1FILESEXTRAPATHS:append:microblaze := ":${THISDIR}/util-linux-2.39"
2SRC_URI:append:microblaze = " file://util-linux-microblaze.patch"
diff --git a/meta-microblaze/recipes-core/util-linux/util-linux_2.40%.bbappend b/meta-microblaze/recipes-core/util-linux/util-linux_2.40%.bbappend
new file mode 100644
index 00000000..b8189a97
--- /dev/null
+++ b/meta-microblaze/recipes-core/util-linux/util-linux_2.40%.bbappend
@@ -0,0 +1,2 @@
1FILESEXTRAPATHS:append:microblaze := ":${THISDIR}/util-linux-2.40"
2SRC_URI:append:microblaze = " file://util-linux-microblaze.patch"
diff --git a/meta-xilinx-core/recipes-core/util-linux/util-linux-libuuid_2.40.4.bb b/meta-xilinx-core/recipes-core/util-linux/util-linux-libuuid_2.40.4.bb
new file mode 100644
index 00000000..ec04c1d3
--- /dev/null
+++ b/meta-xilinx-core/recipes-core/util-linux/util-linux-libuuid_2.40.4.bb
@@ -0,0 +1,19 @@
1# To allow util-linux to optionally build-depend on cryptsetup, libuuid is
2# split out of the main recipe, as it's needed by cryptsetup
3
4require util-linux.inc
5
6inherit autotools gettext pkgconfig
7
8S = "${WORKDIR}/util-linux-${PV}"
9
10EXTRA_AUTORECONF += "--exclude=gtkdocize"
11EXTRA_OECONF += "--disable-all-programs --enable-libuuid"
12
13LICENSE = "BSD-3-Clause"
14
15do_install:append() {
16 rm -rf ${D}${datadir} ${D}${bindir} ${D}${base_bindir} ${D}${sbindir} ${D}${base_sbindir} ${D}${exec_prefix}/sbin
17}
18
19BBCLASSEXTEND = "native nativesdk"
diff --git a/meta-xilinx-core/recipes-core/util-linux/util-linux.inc b/meta-xilinx-core/recipes-core/util-linux/util-linux.inc
new file mode 100644
index 00000000..4e8701ff
--- /dev/null
+++ b/meta-xilinx-core/recipes-core/util-linux/util-linux.inc
@@ -0,0 +1,47 @@
1SUMMARY = "A suite of basic system administration utilities"
2HOMEPAGE = "https://en.wikipedia.org/wiki/Util-linux"
3DESCRIPTION = "Util-linux includes a suite of basic system administration utilities \
4commonly found on most Linux systems. Some of the more important utilities include \
5disk partitioning, kernel message management, filesystem creation, and system login."
6
7SECTION = "base"
8
9LICENSE = "GPL-1.0-or-later & GPL-2.0-only & GPL-2.0-or-later & LGPL-2.1-or-later & BSD-2-Clause & BSD-3-Clause & BSD-4-Clause-UC & MIT"
10LICENSE:${PN}-fcntl-lock = "MIT"
11LICENSE:${PN}-fdisk = "GPL-1.0-or-later"
12LICENSE:${PN}-libblkid = "LGPL-2.1-or-later"
13LICENSE:${PN}-libfdisk = "LGPL-2.1-or-later"
14LICENSE:${PN}-libmount = "LGPL-2.1-or-later"
15LICENSE:${PN}-libsmartcols = "LGPL-2.1-or-later"
16
17LIC_FILES_CHKSUM = "file://README.licensing;md5=ddd58b6c94da86ff4f03e91208eb9cfc \
18 file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
19 file://Documentation/licenses/COPYING.GPL-2.0-or-later;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
20 file://Documentation/licenses/COPYING.LGPL-2.1-or-later;md5=4fbd65380cdd255951079008b364516c \
21 file://Documentation/licenses/COPYING.BSD-3-Clause;md5=58dcd8452651fc8b07d1f65ce07ca8af \
22 file://Documentation/licenses/COPYING.BSD-4-Clause-UC;md5=263860f8968d8bafa5392cab74285262 \
23 file://libuuid/COPYING;md5=6d2cafc999feb2c2de84d4d24b23290c \
24 file://libmount/COPYING;md5=7c7e39fb7d70ffe5d693a643e29987c2 \
25 file://libblkid/COPYING;md5=693bcbbe16d3a4a4b37bc906bc01cc04 \
26 file://libfdisk/COPYING;md5=693bcbbe16d3a4a4b37bc906bc01cc04 \
27 file://libsmartcols/COPYING;md5=693bcbbe16d3a4a4b37bc906bc01cc04 \
28 "
29
30FILESEXTRAPATHS:prepend := "${THISDIR}/util-linux:"
31MAJOR_VERSION = "${@'.'.join(d.getVar('PV').split('.')[0:2])}"
32SRC_URI = "${KERNELORG_MIRROR}/linux/utils/util-linux/v${MAJOR_VERSION}/util-linux-${PV}.tar.xz \
33 file://configure-sbindir.patch \
34 file://runuser.pamd \
35 file://runuser-l.pamd \
36 file://ptest.patch \
37 file://run-ptest \
38 file://display_testname_for_subtest.patch \
39 file://avoid_parallel_tests.patch \
40 file://fcntl-lock.c \
41 file://0001-cfdisk-add-sector-size-commanand-line-option.patch \
42 file://0002-sfdisk-add-sector-size-commanand-line-option.patch \
43 "
44
45SRC_URI[sha256sum] = "5c1daf733b04e9859afdc3bd87cc481180ee0f88b5c0946b16fdec931975fb79"
46
47CVE_PRODUCT = "util-linux"
diff --git a/meta-xilinx-core/recipes-core/util-linux/util-linux/0001-cfdisk-add-sector-size-commanand-line-option.patch b/meta-xilinx-core/recipes-core/util-linux/util-linux/0001-cfdisk-add-sector-size-commanand-line-option.patch
new file mode 100644
index 00000000..73031318
--- /dev/null
+++ b/meta-xilinx-core/recipes-core/util-linux/util-linux/0001-cfdisk-add-sector-size-commanand-line-option.patch
@@ -0,0 +1,90 @@
1From 724b95ee6847613e23ca18f4918d4e65ff5b270e Mon Sep 17 00:00:00 2001
2From: Karel Zak <kzak@redhat.com>
3Date: Mon, 14 Oct 2024 15:48:46 +0200
4Subject: [PATCH 1/2] cfdisk: add --sector-size commanand line option
5
6* improves compatibility with fdisk
7* add ability to work with disk images where libfdisk defaults to 512
8
9Signed-off-by: Karel Zak <kzak@redhat.com>
10
11Upstream-Status: Backport [fd38ee2274f7a30393d3839dfce556260355c3fa]
12
13Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
14---
15 disk-utils/cfdisk.8.adoc | 3 +++
16 disk-utils/cfdisk.c | 15 ++++++++++++++-
17 2 files changed, 17 insertions(+), 1 deletion(-)
18
19diff --git a/disk-utils/cfdisk.8.adoc b/disk-utils/cfdisk.8.adoc
20index 97fad621d..759f39f0e 100644
21--- a/disk-utils/cfdisk.8.adoc
22+++ b/disk-utils/cfdisk.8.adoc
23@@ -55,6 +55,9 @@ Use exclusive BSD lock for device or file it operates. The optional argument _mo
24 *-r*, *--read-only*::
25 Forced open in read-only mode.
26
27+*-b*, *--sector-size* _sectorsize_::
28+Specify the sector size of the disk. Valid values are 512, 1024, 2048, and 4096. The kernel is aware of the sector size for regular block devices. Use this option only on very old kernels, when working with disk images, or to override the kernel's default sector size. Since util-linux-2.17, *fdisk* distinguishes between logical and physical sector size. This option changes both sector sizes to the specified _sectorsize_.
29+
30 *-z*, *--zero*::
31 Start with an in-memory zeroed partition table. This option does not zero the partition table on the disk; rather, it simply starts the program without reading the existing partition table. This option allows you to create a new partition table from scratch or from an *sfdisk*(8)-compatible script.
32
33diff --git a/disk-utils/cfdisk.c b/disk-utils/cfdisk.c
34index 183b7671e..f37e2d72a 100644
35--- a/disk-utils/cfdisk.c
36+++ b/disk-utils/cfdisk.c
37@@ -2739,6 +2739,8 @@ static void __attribute__((__noreturn__)) usage(void)
38 _(" --lock[=<mode>] use exclusive device lock (%s, %s or %s)\n"), "yes", "no", "nonblock");
39 fputs(_(" -r, --read-only forced open cfdisk in read-only mode\n"), out);
40
41+ fputs(_(" -b, --sector-size <size> physical and logical sector size\n"), out);
42+
43 fputs(USAGE_SEPARATOR, out);
44 fprintf(out, USAGE_HELP_OPTIONS(26));
45
46@@ -2751,6 +2753,7 @@ int main(int argc, char *argv[])
47 const char *diskpath = NULL, *lockmode = NULL;
48 int rc, c, colormode = UL_COLORMODE_UNDEF;
49 int read_only = 0;
50+ size_t user_ss = 0;
51 struct cfdisk _cf = { .lines_idx = 0 },
52 *cf = &_cf;
53 enum {
54@@ -2760,6 +2763,7 @@ int main(int argc, char *argv[])
55 { "color", optional_argument, NULL, 'L' },
56 { "lock", optional_argument, NULL, OPT_LOCK },
57 { "help", no_argument, NULL, 'h' },
58+ { "sector-size", required_argument, NULL, 'b' },
59 { "version", no_argument, NULL, 'V' },
60 { "zero", no_argument, NULL, 'z' },
61 { "read-only", no_argument, NULL, 'r' },
62@@ -2771,8 +2775,15 @@ int main(int argc, char *argv[])
63 textdomain(PACKAGE);
64 close_stdout_atexit();
65
66- while((c = getopt_long(argc, argv, "L::hVzr", longopts, NULL)) != -1) {
67+ while((c = getopt_long(argc, argv, "b:L::hVzr", longopts, NULL)) != -1) {
68 switch(c) {
69+ case 'b':
70+ user_ss = strtou32_or_err(optarg,
71+ _("invalid sector size argument"));
72+ if (user_ss != 512 && user_ss != 1024 &&
73+ user_ss != 2048 && user_ss != 4096)
74+ errx(EXIT_FAILURE, _("invalid sector size argument"));
75+ break;
76 case 'h':
77 usage();
78 break;
79@@ -2811,6 +2822,8 @@ int main(int argc, char *argv[])
80 cf->cxt = fdisk_new_context();
81 if (!cf->cxt)
82 err(EXIT_FAILURE, _("failed to allocate libfdisk context"));
83+ if (user_ss)
84+ fdisk_save_user_sector_size(cf->cxt, user_ss, user_ss);
85
86 fdisk_set_ask(cf->cxt, ask_callback, (void *) cf);
87
88--
892.25.1
90
diff --git a/meta-xilinx-core/recipes-core/util-linux/util-linux/0002-sfdisk-add-sector-size-commanand-line-option.patch b/meta-xilinx-core/recipes-core/util-linux/util-linux/0002-sfdisk-add-sector-size-commanand-line-option.patch
new file mode 100644
index 00000000..8d47d8de
--- /dev/null
+++ b/meta-xilinx-core/recipes-core/util-linux/util-linux/0002-sfdisk-add-sector-size-commanand-line-option.patch
@@ -0,0 +1,105 @@
1From 96570c03f46e0a5c17e721737a38c717c67e358b Mon Sep 17 00:00:00 2001
2From: Karel Zak <kzak@redhat.com>
3Date: Mon, 14 Oct 2024 15:50:40 +0200
4Subject: [PATCH 2/2] sfdisk: add --sector-size commanand line option
5
6* improves compatibility with fdisk
7* add ability to work with disk images where libfdisk defaults to 512
8
9Addresses: https://github.com/util-linux/util-linux/pull/3235
10Signed-off-by: Karel Zak <kzak@redhat.com>
11
12Upstream-Status: Backport [ef7b76baa17ddb5414691fa8f49d61415c30871c]
13
14Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
15---
16 disk-utils/sfdisk.8.adoc | 5 ++++-
17 disk-utils/sfdisk.c | 14 ++++++++++++++
18 2 files changed, 18 insertions(+), 1 deletion(-)
19
20diff --git a/disk-utils/sfdisk.8.adoc b/disk-utils/sfdisk.8.adoc
21index bc3ff9bb8..d1eaa3712 100644
22--- a/disk-utils/sfdisk.8.adoc
23+++ b/disk-utils/sfdisk.8.adoc
24@@ -201,6 +201,9 @@ The default list of columns may be extended if _list_ is specified in the format
25 *-q*, *--quiet*::
26 Suppress extra info messages.
27
28+*--sector-size* _sectorsize_::
29+Specify the sector size of the disk. Valid values are 512, 1024, 2048, and 4096. The kernel is aware of the sector size for regular block devices. Use this option only on very old kernels, when working with disk images, or to override the kernel's default sector size. Since util-linux-2.17, *fdisk* distinguishes between logical and physical sector size. This option changes both sector sizes to the specified _sectorsize_.
30+
31 *-u*, *--unit S*::
32 Deprecated option. Only the sector unit is supported. This option is not supported when using the *--show-size* command.
33
34@@ -249,7 +252,7 @@ Specify the maximal number of GPT partitions.
35 *grain*::
36 Specify minimal size in bytes used to calculate partitions alignment. The default is 1MiB and it's strongly recommended to use the default. Do not modify this variable if you're not sure.
37 *sector-size*::
38-Specify sector size. *sfdisk* always uses device sector size. Since version 2.39 *sfdisk* recalculates sizes from dump if the script and device sector size differ.
39+Specifies the sector size used in the input. *sfdisk* always internally uses the device sector size provided by the kernel for the block device, or as specified by the user on the command line (see *--sector-size*). Starting with version 2.39, *sfdisk* recalculates sizes from the input if the *sector-size* header and device sector size are different.
40
41 Note that it is only possible to use header lines before the first partition is specified in the input.
42
43diff --git a/disk-utils/sfdisk.c b/disk-utils/sfdisk.c
44index d8dd8d296..97d426559 100644
45--- a/disk-utils/sfdisk.c
46+++ b/disk-utils/sfdisk.c
47@@ -2084,6 +2084,8 @@ static void __attribute__((__noreturn__)) usage(void)
48 _(" --color[=<when>] colorize output (%s, %s or %s)\n"), "auto", "always", "never");
49 fprintf(out,
50 " %s\n", USAGE_COLORS_DEFAULT);
51+ fputs(_(" --sector-size <size> physical and logical sector size\n"), out);
52+
53 fprintf(out,
54 _(" --lock[=<mode>] use exclusive device lock (%s, %s or %s)\n"), "yes", "no", "nonblock");
55 fputs(_(" -N, --partno <num> specify partition number\n"), out);
56@@ -2120,6 +2122,7 @@ int main(int argc, char *argv[])
57 const char *outarg = NULL;
58 int rc = -EINVAL, c, longidx = -1, bytes = 0;
59 int colormode = UL_COLORMODE_UNDEF;
60+ size_t user_ss = 0;
61 struct sfdisk _sf = {
62 .partno = -1,
63 .wipemode = WIPEMODE_AUTO,
64@@ -2145,6 +2148,7 @@ int main(int argc, char *argv[])
65 OPT_NOTELL,
66 OPT_RELOCATE,
67 OPT_LOCK,
68+ OPT_SECTORSIZE
69 };
70
71 static const struct option longopts[] = {
72@@ -2174,6 +2178,7 @@ int main(int argc, char *argv[])
73 { "output", required_argument, NULL, 'o' },
74 { "partno", required_argument, NULL, 'N' },
75 { "reorder", no_argument, NULL, 'r' },
76+ { "sector-size", required_argument, NULL, OPT_SECTORSIZE },
77 { "show-geometry", no_argument, NULL, 'g' },
78 { "quiet", no_argument, NULL, 'q' },
79 { "verify", no_argument, NULL, 'V' },
80@@ -2373,6 +2378,13 @@ int main(int argc, char *argv[])
81 sf->lockmode = optarg;
82 }
83 break;
84+ case OPT_SECTORSIZE:
85+ user_ss = strtou32_or_err(optarg,
86+ _("invalid sector size argument"));
87+ if (user_ss != 512 && user_ss != 1024 &&
88+ user_ss != 2048 && user_ss != 4096)
89+ errx(EXIT_FAILURE, _("invalid sector size argument"));
90+ break;
91 default:
92 errtryhelp(EXIT_FAILURE);
93 }
94@@ -2383,6 +2395,8 @@ int main(int argc, char *argv[])
95 sfdisk_init(sf);
96 if (bytes)
97 fdisk_set_size_unit(sf->cxt, FDISK_SIZEUNIT_BYTES);
98+ if (user_ss)
99+ fdisk_save_user_sector_size(sf->cxt, user_ss, user_ss);
100
101 if (outarg)
102 init_fields(NULL, outarg, NULL);
103--
1042.25.1
105
diff --git a/meta-xilinx-core/recipes-core/util-linux/util-linux/avoid_parallel_tests.patch b/meta-xilinx-core/recipes-core/util-linux/util-linux/avoid_parallel_tests.patch
new file mode 100644
index 00000000..8ea00dbb
--- /dev/null
+++ b/meta-xilinx-core/recipes-core/util-linux/util-linux/avoid_parallel_tests.patch
@@ -0,0 +1,28 @@
1From da58b4150f6932de36c962ea657713bcf4ea44be Mon Sep 17 00:00:00 2001
2From: Tudor Florea <tudor.florea@enea.com>
3Date: Mon, 14 Jun 2021 14:00:31 +0200
4Subject: [PATCH] util-linux: Add ptest
5
6Ptest needs buildtest-TESTS and runtest-TESTS targets.
7serial-tests is required to generate those targets.
8Revert run.sh script accordingly to serialize running tests
9
10Signed-off-by: Tudor Florea <tudor.florea@enea.com>
11Upstream-Status: Inappropriate
12---
13 configure.ac | 2 +-
14 1 file changed, 1 insertion(+), 1 deletion(-)
15
16diff --git a/configure.ac b/configure.ac
17index 651ef2b..2a8012e 100644
18--- a/configure.ac
19+++ b/configure.ac
20@@ -11,7 +11,7 @@ AC_CONFIG_MACRO_DIR([m4])
21 dnl AC_USE_SYSTEM_EXTENSIONS must be called before any macros that run
22 dnl the compiler (like LT_INIT) to avoid autoconf errors.
23 AC_USE_SYSTEM_EXTENSIONS
24-AM_INIT_AUTOMAKE([-Wall -Wno-portability foreign 1.10 tar-pax no-dist-gzip dist-xz subdir-objects])
25+AM_INIT_AUTOMAKE([-Wall -Wno-portability foreign 1.10 tar-pax no-dist-gzip dist-xz subdir-objects serial-tests])
26
27 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
28 [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
diff --git a/meta-xilinx-core/recipes-core/util-linux/util-linux/configure-sbindir.patch b/meta-xilinx-core/recipes-core/util-linux/util-linux/configure-sbindir.patch
new file mode 100644
index 00000000..74abdc20
--- /dev/null
+++ b/meta-xilinx-core/recipes-core/util-linux/util-linux/configure-sbindir.patch
@@ -0,0 +1,31 @@
1From 0387d71516c978899cfd556ca512f530a212b4a9 Mon Sep 17 00:00:00 2001
2From: Phil Blundell <pb@pbcl.net>
3Date: Mon, 24 Sep 2012 07:24:51 +0100
4Subject: [PATCH] util-linux: Ensure that ${sbindir} is respected
5
6util-linux: take ${sbindir} from the environment if it is set there
7fix the test, the [ ] syntax was getting eaten by autoconf
8
9Signed-off-by: Phil Blundell <pb@pbcl.net>
10Signed-off-by: Saul Wold <sgw@linux.intel.com
11Upstream-Status: Inappropriate [configuration]
12---
13 configure.ac | 5 ++++-
14 1 file changed, 4 insertions(+), 1 deletion(-)
15
16diff --git a/configure.ac b/configure.ac
17index 23594ff..651ef2b 100644
18--- a/configure.ac
19+++ b/configure.ac
20@@ -110,7 +110,10 @@ AC_SUBST([runstatedir])
21 usrbin_execdir='${exec_prefix}/bin'
22 AC_SUBST([usrbin_execdir])
23
24-usrsbin_execdir='${exec_prefix}/sbin'
25+if test -z "$usrsbin_execdir" ;
26+then
27+ usrsbin_execdir='${exec_prefix}/sbin'
28+fi
29 AC_SUBST([usrsbin_execdir])
30
31 AS_CASE([$libdir],
diff --git a/meta-xilinx-core/recipes-core/util-linux/util-linux/display_testname_for_subtest.patch b/meta-xilinx-core/recipes-core/util-linux/util-linux/display_testname_for_subtest.patch
new file mode 100644
index 00000000..871b0b2d
--- /dev/null
+++ b/meta-xilinx-core/recipes-core/util-linux/util-linux/display_testname_for_subtest.patch
@@ -0,0 +1,24 @@
1From 45450d0339cd7ee27f53c0f2fac1cc74ed9bbfb8 Mon Sep 17 00:00:00 2001
2From: Tudor Florea <tudor.florea@enea.com>
3Date: Thu, 3 Dec 2015 04:08:00 +0100
4Subject: [PATCH] Display testname for subtest
5
6Signed-off-by: Tudor Florea <tudor.florea@enea.com>
7Upstream-Status: Pending
8---
9 tests/functions.sh | 2 +-
10 1 file changed, 1 insertion(+), 1 deletion(-)
11
12diff --git a/tests/functions.sh b/tests/functions.sh
13index 5fe5ba0..a6c703e 100644
14--- a/tests/functions.sh
15+++ b/tests/functions.sh
16@@ -450,7 +450,7 @@ function ts_init_subtest {
17
18 if [ "$TS_PARSABLE" != "yes" ]; then
19 [ $TS_NSUBTESTS -eq 1 ] && echo
20- printf "%16s: %-27s ..." "" "$TS_SUBNAME"
21+ printf "%13s: %-30s ..." "$TS_COMPONENT" "$TS_SUBNAME"
22 fi
23 }
24
diff --git a/meta-xilinx-core/recipes-core/util-linux/util-linux/fcntl-lock.c b/meta-xilinx-core/recipes-core/util-linux/util-linux/fcntl-lock.c
new file mode 100644
index 00000000..966d8c5e
--- /dev/null
+++ b/meta-xilinx-core/recipes-core/util-linux/util-linux/fcntl-lock.c
@@ -0,0 +1,332 @@
1// From https://github.com/magnumripper/fcntl-lock
2// SPDX-License-Identifier: MIT
3/* ----------------------------------------------------------------------- *
4 *
5 * Copyright 2003-2005 H. Peter Anvin - All Rights Reserved
6 * Copyright 2015 magnum (fcntl version)
7 *
8 * Permission is hereby granted, free of charge, to any person
9 * obtaining a copy of this software and associated documentation
10 * files (the "Software"), to deal in the Software without
11 * restriction, including without limitation the rights to use,
12 * copy, modify, merge, publish, distribute, sublicense, and/or
13 * sell copies of the Software, and to permit persons to whom
14 * the Software is furnished to do so, subject to the following
15 * conditions:
16 *
17 * The above copyright notice and this permission notice shall
18 * be included in all copies or substantial portions of the Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 * OTHER DEALINGS IN THE SOFTWARE.
28 *
29 * ----------------------------------------------------------------------- */
30
31#include <errno.h>
32#include <stdio.h>
33#include <stdlib.h>
34#include <fcntl.h>
35#include <unistd.h>
36#include <getopt.h>
37#include <signal.h>
38#include <ctype.h>
39#include <string.h>
40#include <paths.h>
41#include <sysexits.h>
42#include <sys/types.h>
43#include <sys/file.h>
44#include <sys/time.h>
45#include <sys/wait.h>
46
47#define PACKAGE_STRING "magnum"
48#define _(x) (x)
49
50static const struct option long_options[] = {
51 { "shared", 0, NULL, 's' },
52 { "exclusive", 0, NULL, 'x' },
53 { "unlock", 0, NULL, 'u' },
54 { "nonblocking", 0, NULL, 'n' },
55 { "nb", 0, NULL, 'n' },
56 { "timeout", 1, NULL, 'w' },
57 { "wait", 1, NULL, 'w' },
58 { "close", 0, NULL, 'o' },
59 { "help", 0, NULL, 'h' },
60 { "version", 0, NULL, 'V' },
61 { 0, 0, 0, 0 }
62};
63
64const char *program;
65
66static void usage(int ex)
67{
68 fputs("fcntl-lock (" PACKAGE_STRING ")\n", stderr);
69 fprintf(stderr,
70 _("Usage: %1$s [-sxun][-w #] fd#\n"
71 " %1$s [-sxon][-w #] file [-c] command...\n"
72 " %1$s [-sxon][-w #] directory [-c] command...\n"
73 " -s --shared Get a shared lock\n"
74 " -x --exclusive Get an exclusive lock\n"
75 " -u --unlock Remove a lock\n"
76 " -n --nonblock Fail rather than wait\n"
77 " -w --timeout Wait for a limited amount of time\n"
78 " -o --close Close file descriptor before running command\n"
79 " -c --command Run a single command string through the shell\n"
80 " -h --help Display this text\n"
81 " -V --version Display version\n"),
82 program);
83 exit(ex);
84}
85
86
87static sig_atomic_t timeout_expired = 0;
88
89static void timeout_handler(int sig)
90{
91 (void)sig;
92
93 timeout_expired = 1;
94}
95
96
97static char * strtotimeval(const char *str, struct timeval *tv)
98{
99 char *s;
100 long fs; /* Fractional seconds */
101 int i;
102
103 tv->tv_sec = strtol(str, &s, 10);
104 fs = 0;
105
106 if ( *s == '.' ) {
107 s++;
108
109 for ( i = 0 ; i < 6 ; i++ ) {
110 if ( !isdigit(*s) )
111 break;
112
113 fs *= 10;
114 fs += *s++ - '0';
115 }
116
117 for ( ; i < 6; i++ )
118 fs *= 10;
119
120 while ( isdigit(*s) )
121 s++;
122 }
123
124 tv->tv_usec = fs;
125 return s;
126}
127
128int main(int argc, char *argv[])
129{
130 struct itimerval timeout, old_timer;
131 int have_timeout = 0;
132 int type = F_WRLCK;
133 int block = F_SETLKW;
134 int fd = -1;
135 int opt, ix;
136 int do_close = 0;
137 int err;
138 int status;
139 char *eon;
140 char **cmd_argv = NULL, *sh_c_argv[4];
141 struct flock lock;
142 const char *filename = NULL;
143 struct sigaction sa, old_sa;
144
145 program = argv[0];
146
147 if ( argc < 2 )
148 usage(EX_USAGE);
149
150 memset(&timeout, 0, sizeof timeout);
151
152 optopt = 0;
153 while ( (opt = getopt_long(argc, argv, "+sexnouw:hV?", long_options, &ix)) != EOF ) {
154 switch(opt) {
155 case 's':
156 type = F_RDLCK;
157 break;
158 case 'e':
159 case 'x':
160 type = F_WRLCK;
161 break;
162 case 'u':
163 type = F_UNLCK;
164 break;
165 case 'o':
166 do_close = 1;
167 break;
168 case 'n':
169 block = F_SETLK;
170 break;
171 case 'w':
172 have_timeout = 1;
173 eon = strtotimeval(optarg, &timeout.it_value);
174 if ( *eon )
175 usage(EX_USAGE);
176 break;
177 case 'V':
178 printf("fcntl-lock (%s)\n", PACKAGE_STRING);
179 exit(0);
180 default:
181 /* optopt will be set if this was an unrecognized option, i.e. *not* 'h' or '?' */
182 usage(optopt ? EX_USAGE : 0);
183 break;
184 }
185 }
186
187 if ( argc > optind+1 ) {
188 /* Run command */
189
190 if ( !strcmp(argv[optind+1], "-c") ||
191 !strcmp(argv[optind+1], "--command") ) {
192
193 if ( argc != optind+3 ) {
194 fprintf(stderr, _("%s: %s requires exactly one command argument\n"),
195 program, argv[optind+1]);
196 exit(EX_USAGE);
197 }
198
199 cmd_argv = sh_c_argv;
200
201 cmd_argv[0] = getenv("SHELL");
202 if ( !cmd_argv[0] || !*cmd_argv[0] )
203 cmd_argv[0] = _PATH_BSHELL;
204
205 cmd_argv[1] = "-c";
206 cmd_argv[2] = argv[optind+2];
207 cmd_argv[3] = 0;
208 } else {
209 cmd_argv = &argv[optind+1];
210 }
211
212 filename = argv[optind];
213 fd = open(filename, O_RDWR|O_NOCTTY|O_CREAT, 0666);
214 /* Linux doesn't like O_CREAT on a directory, even though it should be a
215 no-op */
216 if (fd < 0 && errno == EISDIR)
217 fd = open(filename, O_RDONLY|O_NOCTTY);
218
219 if ( fd < 0 ) {
220 err = errno;
221 fprintf(stderr, _("%s: cannot open lock file %s: %s\n"),
222 program, argv[optind], strerror(err));
223 exit((err == ENOMEM||err == EMFILE||err == ENFILE) ? EX_OSERR :
224 (err == EROFS||err == ENOSPC) ? EX_CANTCREAT :
225 EX_NOINPUT);
226 }
227
228 } else if (optind < argc) {
229 /* Use provided file descriptor */
230
231 fd = (int)strtol(argv[optind], &eon, 10);
232 if ( *eon || !argv[optind] ) {
233 fprintf(stderr, _("%s: bad number: %s\n"), program, argv[optind]);
234 exit(EX_USAGE);
235 }
236
237 } else {
238 /* Bad options */
239
240 fprintf(stderr, _("%s: requires file descriptor, file or directory\n"),
241 program);
242 exit(EX_USAGE);
243 }
244
245
246 if ( have_timeout ) {
247 if ( timeout.it_value.tv_sec == 0 &&
248 timeout.it_value.tv_usec == 0 ) {
249 /* -w 0 is equivalent to -n; this has to be special-cased
250 because setting an itimer to zero means disabled! */
251
252 have_timeout = 0;
253 block = F_SETLK;
254 } else {
255 memset(&sa, 0, sizeof sa);
256
257 sa.sa_handler = timeout_handler;
258 sa.sa_flags = SA_RESETHAND;
259 sigaction(SIGALRM, &sa, &old_sa);
260
261 setitimer(ITIMER_REAL, &timeout, &old_timer);
262 }
263 }
264
265 memset(&lock, 0, sizeof(lock));
266 lock.l_type = type;
267 while ( fcntl(fd, block, &lock) ) {
268 switch( (err = errno) ) {
269 case EAGAIN: /* -n option set and failed to lock */
270 case EACCES: /* -n option set and failed to lock */
271 exit(1);
272 case EINTR: /* Signal received */
273 if ( timeout_expired )
274 exit(1); /* -w option set and failed to lock */
275 continue; /* otherwise try again */
276 default: /* Other errors */
277 if ( filename )
278 fprintf(stderr, "%s: %s: %s\n", program, filename, strerror(err));
279 else
280 fprintf(stderr, "%s: %d: %s\n", program, fd, strerror(err));
281 exit((err == ENOLCK||err == ENOMEM) ? EX_OSERR : EX_DATAERR);
282 }
283 }
284
285 if ( have_timeout ) {
286 setitimer(ITIMER_REAL, &old_timer, NULL); /* Cancel itimer */
287 sigaction(SIGALRM, &old_sa, NULL); /* Cancel signal handler */
288 }
289
290 status = 0;
291
292 if ( cmd_argv ) {
293 pid_t w, f;
294
295 /* Clear any inherited settings */
296 signal(SIGCHLD, SIG_DFL);
297 f = fork();
298
299 if ( f < 0 ) {
300 err = errno;
301 fprintf(stderr, _("%s: fork failed: %s\n"), program, strerror(err));
302 exit(EX_OSERR);
303 } else if ( f == 0 ) {
304 if ( do_close )
305 close(fd);
306 err = errno;
307 execvp(cmd_argv[0], cmd_argv);
308 /* execvp() failed */
309 fprintf(stderr, "%s: %s: %s\n", program, cmd_argv[0], strerror(err));
310 _exit((err == ENOMEM) ? EX_OSERR: EX_UNAVAILABLE);
311 } else {
312 do {
313 w = waitpid(f, &status, 0);
314 if (w == -1 && errno != EINTR)
315 break;
316 } while ( w != f );
317
318 if (w == -1) {
319 err = errno;
320 status = EXIT_FAILURE;
321 fprintf(stderr, "%s: waitpid failed: %s\n", program, strerror(err));
322 } else if ( WIFEXITED(status) )
323 status = WEXITSTATUS(status);
324 else if ( WIFSIGNALED(status) )
325 status = WTERMSIG(status) + 128;
326 else
327 status = EX_OSERR; /* WTF? */
328 }
329 }
330
331 return status;
332}
diff --git a/meta-xilinx-core/recipes-core/util-linux/util-linux/ptest.patch b/meta-xilinx-core/recipes-core/util-linux/util-linux/ptest.patch
new file mode 100644
index 00000000..7345926b
--- /dev/null
+++ b/meta-xilinx-core/recipes-core/util-linux/util-linux/ptest.patch
@@ -0,0 +1,23 @@
1From f9be73c3e2b0a4f0923950dcb058be85d3ee8ed7 Mon Sep 17 00:00:00 2001
2From: Tudor Florea <tudor.florea@enea.com>
3Date: Thu, 3 Dec 2015 04:08:00 +0100
4Subject: [PATCH] Define TESTS variable
5
6Signed-off-by: Tudor Florea <tudor.florea@enea.com>
7Upstream-Status: Pending
8---
9 Makefile.am | 1 +
10 1 file changed, 1 insertion(+)
11
12diff --git a/Makefile.am b/Makefile.am
13index 50ab8d0..7e2340d 100644
14--- a/Makefile.am
15+++ b/Makefile.am
16@@ -64,6 +64,7 @@ tmpfiles_DATA =
17 dist_bashcompletion_DATA =
18 check_PROGRAMS =
19 dist_check_SCRIPTS =
20+TESTS = $(check_PROGRAMS)
21
22 BUILT_SOURCES =
23
diff --git a/meta-xilinx-core/recipes-core/util-linux/util-linux/run-ptest b/meta-xilinx-core/recipes-core/util-linux/util-linux/run-ptest
new file mode 100644
index 00000000..7b6b1d1d
--- /dev/null
+++ b/meta-xilinx-core/recipes-core/util-linux/util-linux/run-ptest
@@ -0,0 +1,35 @@
1#!/bin/sh
2
3
4# When udevd (from eudev) is running most eject/mount tests will fail because
5# of automount. We need to stop udevd before executing util-linux's tests.
6# The systemd-udevd daemon doesn't change the outcome of util-linux's tests.
7UDEV_PID="`pidof "@base_sbindir@/udevd"`"
8if [ "x$UDEV_PID" != "x" ]; then
9 /etc/init.d/udev stop
10fi
11
12current_path=$(readlink -f $0)
13export bindir=$(dirname $current_path)
14export PATH=$bindir/bin:$PATH
15
16# losetup tests will be skipped and/or fail otherwise
17modprobe loop
18
19# required for mount/fallback test to pass
20# systemd does this by default, but ptest images do not use it
21# see https://man7.org/linux/man-pages/man7/mount_namespaces.7.html
22# for a long description of mount namespaces in Linux
23mount --make-shared /
24
25# lsfd/option-inet has races in the test script:
26# https://github.com/util-linux/util-linux/issues/2399
27./tests/run.sh --use-system-commands --parsable --show-diff --exclude=lsfd/option-inet | sed -u '{
28 s/^\(.*\):\(.*\) \.\.\. OK$/PASS: \1:\2/
29 s/^\(.*\):\(.*\) \.\.\. FAILED \(.*\)$/FAIL: \1:\2 \3/
30 s/^\(.*\):\(.*\) \.\.\. SKIPPED \(.*\)$/SKIP: \1:\2 \3/
31 }'
32
33if [ "x$UDEV_PID" != "x" ]; then
34 /etc/init.d/udev start
35fi
diff --git a/meta-xilinx-core/recipes-core/util-linux/util-linux/runuser-l.pamd b/meta-xilinx-core/recipes-core/util-linux/util-linux/runuser-l.pamd
new file mode 100644
index 00000000..4b368ccf
--- /dev/null
+++ b/meta-xilinx-core/recipes-core/util-linux/util-linux/runuser-l.pamd
@@ -0,0 +1,3 @@
1auth include runuser
2session optional pam_keyinit.so force revoke
3session include runuser
diff --git a/meta-xilinx-core/recipes-core/util-linux/util-linux/runuser.pamd b/meta-xilinx-core/recipes-core/util-linux/util-linux/runuser.pamd
new file mode 100644
index 00000000..48d133b9
--- /dev/null
+++ b/meta-xilinx-core/recipes-core/util-linux/util-linux/runuser.pamd
@@ -0,0 +1,4 @@
1auth sufficient pam_rootok.so
2session optional pam_keyinit.so revoke
3session required pam_limits.so
4session required pam_unix.so
diff --git a/meta-xilinx-core/recipes-core/util-linux/util-linux_2.40.4.bb b/meta-xilinx-core/recipes-core/util-linux/util-linux_2.40.4.bb
new file mode 100644
index 00000000..5e5284bf
--- /dev/null
+++ b/meta-xilinx-core/recipes-core/util-linux/util-linux_2.40.4.bb
@@ -0,0 +1,379 @@
1require util-linux.inc
2
3inherit autotools gettext manpages pkgconfig systemd update-alternatives python3-dir bash-completion ptest gtk-doc
4DEPENDS = "libcap-ng ncurses virtual/crypt zlib util-linux-libuuid"
5
6PACKAGES =+ "${PN}-swaponoff"
7PACKAGES += "${@bb.utils.contains('PACKAGECONFIG', 'pylibmount', '${PN}-pylibmount', '', d)}"
8
9python util_linux_binpackages () {
10 def pkg_hook(f, pkg, file_regex, output_pattern, modulename):
11 pn = d.getVar('PN')
12 d.appendVar('RRECOMMENDS:%s' % pn, ' %s' % pkg)
13
14 if d.getVar('ALTERNATIVE:' + pkg):
15 return
16 if d.getVarFlag('ALTERNATIVE_LINK_NAME', modulename):
17 d.setVar('ALTERNATIVE:' + pkg, modulename)
18
19 bindirs = sorted(list(set(d.expand("${base_sbindir} ${base_bindir} ${sbindir} ${bindir}").split())))
20 for dir in bindirs:
21 do_split_packages(d, root=dir,
22 file_regex=r'(.*)', output_pattern='${PN}-%s',
23 description='${PN} %s',
24 hook=pkg_hook, extra_depends='')
25
26 # There are some symlinks for some binaries which we have ignored
27 # above. Add them to the package owning the binary they are
28 # pointing to
29 extras = {}
30 dvar = d.getVar('PKGD')
31 for root in bindirs:
32 for walkroot, dirs, files in os.walk(dvar + root):
33 for f in files:
34 file = os.path.join(walkroot, f)
35 if not os.path.islink(file):
36 continue
37
38 pkg = os.path.basename(os.readlink(file))
39 extras.setdefault(pkg, [])
40 extras[pkg].append(file.replace(dvar, '', 1))
41
42 pn = d.getVar('PN')
43 for pkg, links in extras.items():
44 of = d.getVar('FILES:' + pn + '-' + pkg)
45 links = of + " " + " ".join(sorted(links))
46 d.setVar('FILES:' + pn + '-' + pkg, links)
47}
48
49# we must execute before update-alternatives PACKAGE_PREPROCESS_FUNCS
50PACKAGE_PREPROCESS_FUNCS =+ "util_linux_binpackages "
51
52# skip libuuid as it will be packaged by the util-linux-libuuid recipe
53python util_linux_libpackages() {
54 do_split_packages(d, root=d.getVar('UTIL_LINUX_LIBDIR'), file_regex=r'^lib(?!uuid)(.*)\.so\..*$',
55 output_pattern='${PN}-lib%s',
56 description='${PN} lib%s',
57 extra_depends='', prepend=True, allow_links=True)
58}
59
60PACKAGESPLITFUNCS =+ "util_linux_libpackages"
61
62PACKAGES_DYNAMIC = "^${PN}(?!.*-native)-.*"
63PACKAGES_DYNAMIC:class-native = "^${BPN}-.*-native"
64
65UTIL_LINUX_LIBDIR = "${libdir}"
66UTIL_LINUX_LIBDIR:class-target = "${base_libdir}"
67EXTRA_OECONF = "\
68 --enable-libuuid --enable-libblkid \
69 \
70 --enable-fsck --enable-kill --enable-last --enable-mesg \
71 --enable-mount --enable-partx --enable-rfkill \
72 --enable-unshare --enable-write \
73 \
74 --disable-bfs --disable-login \
75 --disable-makeinstall-chown --disable-minix --disable-newgrp \
76 --disable-use-tty-group --disable-vipw --disable-raw \
77 \
78 --without-udev \
79 \
80 usrsbin_execdir='${sbindir}' \
81 --libdir='${UTIL_LINUX_LIBDIR}' \
82"
83
84EXTRA_OECONF:append:class-target = " --enable-setpriv"
85EXTRA_OECONF:append:class-native = " --without-cap-ng --disable-setpriv"
86EXTRA_OECONF:append:class-nativesdk = " --without-cap-ng --disable-setpriv"
87EXTRA_OECONF:append = " --disable-hwclock-gplv3"
88
89# enable pcre2 for native/nativesdk to match host distros
90# this helps to keep same expectations when using the SDK or
91# build host versions during development
92#
93PACKAGECONFIG ?= "pcre2"
94PACKAGECONFIG:class-target ?= "\
95 libmount-mountfd-support \
96 ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'chfn-chsh pam lastlog2', '', d)} \
97"
98# inherit manpages requires this to be present, however util-linux does not have
99# configuration options, and installs manpages always
100PACKAGECONFIG[manpages] = ""
101PACKAGECONFIG[pam] = "--enable-su --enable-runuser,--disable-su --disable-runuser, libpam,"
102# Respect the systemd feature for uuidd
103PACKAGECONFIG[systemd] = "--with-systemd --with-systemdsystemunitdir=${systemd_system_unitdir}, --without-systemd --without-systemdsystemunitdir,systemd"
104# Build python bindings for libmount
105PACKAGECONFIG[pylibmount] = "--with-python=3 --enable-pylibmount,--without-python --disable-pylibmount,python3"
106# Readline support
107PACKAGECONFIG[readline] = "--with-readline,--without-readline,readline"
108# PCRE support in hardlink
109PACKAGECONFIG[pcre2] = ",,libpcre2"
110PACKAGECONFIG[cryptsetup] = "--with-cryptsetup,--without-cryptsetup,cryptsetup"
111PACKAGECONFIG[chfn-chsh] = "--enable-chfn-chsh,--disable-chfn-chsh,"
112PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux"
113PACKAGECONFIG[lastlog2] = "--enable-liblastlog2,--disable-liblastlog2,sqlite3"
114# Using the new file descriptors based mount kernel API can cause rootfs remount failure with some older kernels.
115# Of currently supported LTS kernels, the old mount API should be used with:
116# - versions prior to 6.6.18 in the 6.6.y series.
117# - versions prior to 6.1.79 in the 6.1.y series.
118# - versions till at least 5.15.164 in the 5.15.y series.
119# - with 5.10.y, 5.4.y and 4.19.y series kernels, libmount seemed to use the old API regardless of this option.
120PACKAGECONFIG[libmount-mountfd-support] = "--enable-libmount-mountfd-support,--disable-libmount-mountfd-support"
121
122EXTRA_OEMAKE = "ARCH=${TARGET_ARCH} CPU= CPUOPT= 'OPT=${CFLAGS}'"
123
124ALLOW_EMPTY:${PN} = "1"
125FILES:${PN} = ""
126FILES:${PN}-doc += "${datadir}/getopt/getopt-*.*"
127FILES:${PN}-dev += "${PYTHON_SITEPACKAGES_DIR}/libmount/pylibmount.la"
128FILES:${PN}-mount = "${sysconfdir}/default/mountall"
129FILES:${PN}-runuser = "${sysconfdir}/pam.d/runuser*"
130FILES:${PN}-su = "${sysconfdir}/pam.d/su-l"
131CONFFILES:${PN}-su = "${sysconfdir}/pam.d/su-l"
132FILES:${PN}-lastlog2 += "${base_libdir}/security/pam_lastlog2.so \
133 ${nonarch_libdir}/tmpfiles.d/lastlog2.conf \
134 ${sysconfdir}/default/volatiles/99_lastlog2"
135FILES:${PN}-pylibmount = "${PYTHON_SITEPACKAGES_DIR}/libmount/pylibmount.so \
136 ${PYTHON_SITEPACKAGES_DIR}/libmount/__init__.* \
137 ${PYTHON_SITEPACKAGES_DIR}/libmount/__pycache__/*"
138
139# Util-linux' blkid replaces the e2fsprogs one
140RCONFLICTS:${PN}-blkid = "${MLPREFIX}e2fsprogs-blkid"
141RREPLACES:${PN}-blkid = "${MLPREFIX}e2fsprogs-blkid"
142
143RRECOMMENDS:${PN}:class-native = ""
144RRECOMMENDS:${PN}:class-nativesdk = ""
145RDEPENDS:${PN}:class-native = ""
146RDEPENDS:${PN}:class-nativesdk = ""
147
148RDEPENDS:${PN} += " util-linux-libuuid"
149RDEPENDS:${PN}-dev += " util-linux-libuuid-dev"
150
151RPROVIDES:${PN}-dev = "${PN}-libblkid-dev ${PN}-libmount-dev"
152
153RDEPENDS:${PN}-bash-completion += "${PN}-lsblk ${PN}-findmnt"
154RDEPENDS:${PN}-ptest += "bash bc btrfs-tools coreutils e2fsprogs findutils grep iproute2 kmod procps sed socat which xz diffutils"
155RRECOMMENDS:${PN}-ptest += "kernel-module-scsi-debug kernel-module-sd-mod kernel-module-loop kernel-module-algif-hash"
156RDEPENDS:${PN}-swaponoff = "${PN}-swapon ${PN}-swapoff"
157ALLOW_EMPTY:${PN}-swaponoff = "1"
158
159#SYSTEMD_PACKAGES = "${PN}-uuidd ${PN}-fstrim"
160SYSTEMD_SERVICE:${PN}-uuidd = "uuidd.socket uuidd.service"
161SYSTEMD_AUTO_ENABLE:${PN}-uuidd = "disable"
162SYSTEMD_SERVICE:${PN}-fstrim = "fstrim.timer fstrim.service"
163SYSTEMD_AUTO_ENABLE:${PN}-fstrim = "disable"
164
165do_compile:prepend () {
166 # this is a workaround for the unnecessary remake problem. Issue and PR are as below:
167 # https://github.com/util-linux/util-linux/issues/3061
168 # https://github.com/util-linux/util-linux/pull/3064
169 # When newly release tarball contains the above fix, the following workaround could be dropped.
170 [ -e ${S}/libsmartcols/src/filter-scanner.c ] && touch ${S}/libsmartcols/src/filter-scanner.c
171 [ -e ${S}/libsmartcols/src/filter-parser.c ] && touch ${S}/libsmartcols/src/filter-parser.c
172}
173
174do_compile:append () {
175 cp ${WORKDIR}/fcntl-lock.c ${S}/fcntl-lock.c
176 ${CC} ${CFLAGS} ${LDFLAGS} ${S}/fcntl-lock.c -o ${B}/fcntl-lock
177}
178
179do_install:append () {
180 mkdir -p ${D}${base_bindir}
181
182 sbinprogs="agetty ctrlaltdel cfdisk vipw vigr"
183 sbinprogs_a="pivot_root hwclock mkswap losetup swapon swapoff fdisk fsck blkid blockdev fstrim sulogin switch_root nologin"
184 binprogs_a="dmesg getopt kill more umount mount login su mountpoint"
185
186 if [ "${base_sbindir}" != "${sbindir}" ]; then
187 mkdir -p ${D}${base_sbindir}
188 for p in $sbinprogs $sbinprogs_a; do
189 if [ -f "${D}${sbindir}/$p" ]; then
190 mv "${D}${sbindir}/$p" "${D}${base_sbindir}/$p"
191 fi
192 done
193 fi
194
195 if [ "${base_bindir}" != "${bindir}" ]; then
196 mkdir -p ${D}${base_bindir}
197 for p in $binprogs_a; do
198 if [ -f "${D}${bindir}/$p" ]; then
199 mv "${D}${bindir}/$p" "${D}${base_bindir}/$p"
200 fi
201 done
202 fi
203
204 install -d ${D}${sysconfdir}/default/
205 echo 'MOUNTALL="-t nonfs,nosmbfs,noncpfs"' > ${D}${sysconfdir}/default/mountall
206
207 rm -f ${D}${bindir}/chkdupexe
208
209 install -m 0755 ${B}/fcntl-lock ${D}${bindir}
210}
211
212do_install:append:class-target () {
213 if [ "${@bb.utils.filter('PACKAGECONFIG', 'pam', d)}" ]; then
214 install -d ${D}${sysconfdir}/pam.d
215 install -m 0644 ${WORKDIR}/runuser.pamd ${D}${sysconfdir}/pam.d/runuser
216 install -m 0644 ${WORKDIR}/runuser-l.pamd ${D}${sysconfdir}/pam.d/runuser-l
217 # Required for "su -" aka "su --login" because
218 # otherwise it uses "other", which has "auth pam_deny.so"
219 # and thus prevents the operation.
220 ln -s su ${D}${sysconfdir}/pam.d/su-l
221
222 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
223 install -d ${D}${nonarch_libdir}/tmpfiles.d
224 install -m 0644 ${S}/misc-utils/lastlog2-tmpfiles.conf.in \
225 ${D}${nonarch_libdir}/tmpfiles.d/lastlog2.conf
226 fi
227
228 if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
229 install -d ${D}${sysconfdir}/default/volatiles
230 echo "d root root 0755 /var/lib/lastlog none" \
231 > ${D}${sysconfdir}/default/volatiles/99_lastlog2
232 fi
233 fi
234}
235# nologin causes a conflict with shadow-native
236# kill causes a conflict with coreutils-native (if ${bindir}==${base_bindir})
237do_install:append:class-native () {
238 rm -f ${D}${base_sbindir}/nologin
239 rm -f ${D}${base_bindir}/kill
240}
241
242# dm-verity support introduces a circular build dependency, so util-linux-libuuid is split out for target builds
243# Need to build libuuid for uuidgen, but then delete it and let the other recipe ship it
244do_install:append () {
245 rm -rf ${D}${includedir}/uuid ${D}${libdir}/pkgconfig/uuid.pc ${D}${libdir}/libuuid* ${D}${base_libdir}/libuuid*
246}
247
248ALTERNATIVE_PRIORITY = "80"
249
250ALTERNATIVE_LINK_NAME[blkid] = "${base_sbindir}/blkid"
251ALTERNATIVE_LINK_NAME[blockdev] = "${base_sbindir}/blockdev"
252ALTERNATIVE_LINK_NAME[cal] = "${bindir}/cal"
253ALTERNATIVE_LINK_NAME[chfn] = "${bindir}/chfn"
254ALTERNATIVE_LINK_NAME[chsh] = "${bindir}/chsh"
255ALTERNATIVE_LINK_NAME[chrt] = "${bindir}/chrt"
256ALTERNATIVE_LINK_NAME[dmesg] = "${base_bindir}/dmesg"
257ALTERNATIVE_LINK_NAME[eject] = "${bindir}/eject"
258ALTERNATIVE_LINK_NAME[fallocate] = "${bindir}/fallocate"
259ALTERNATIVE_LINK_NAME[fdisk] = "${base_sbindir}/fdisk"
260ALTERNATIVE_LINK_NAME[findfs] = "${sbindir}/findfs"
261ALTERNATIVE_LINK_NAME[flock] = "${bindir}/flock"
262ALTERNATIVE_LINK_NAME[fsck] = "${base_sbindir}/fsck"
263ALTERNATIVE_LINK_NAME[fsfreeze] = "${sbindir}/fsfreeze"
264ALTERNATIVE_LINK_NAME[fstrim] = "${base_sbindir}/fstrim"
265ALTERNATIVE_LINK_NAME[getopt] = "${base_bindir}/getopt"
266ALTERNATIVE:${PN}-agetty = "getty"
267ALTERNATIVE_LINK_NAME[getty] = "${base_sbindir}/getty"
268ALTERNATIVE_TARGET[getty] = "${base_sbindir}/agetty"
269ALTERNATIVE_LINK_NAME[hexdump] = "${bindir}/hexdump"
270ALTERNATIVE_LINK_NAME[hwclock] = "${base_sbindir}/hwclock"
271ALTERNATIVE_LINK_NAME[ionice] = "${bindir}/ionice"
272ALTERNATIVE_LINK_NAME[ipcrm] = "${bindir}/ipcrm"
273ALTERNATIVE_LINK_NAME[ipcs] = "${bindir}/ipcs"
274ALTERNATIVE_LINK_NAME[kill] = "${base_bindir}/kill"
275ALTERNATIVE:${PN}-last = "last lastb"
276ALTERNATIVE_LINK_NAME[last] = "${bindir}/last"
277ALTERNATIVE_LINK_NAME[lastb] = "${bindir}/lastb"
278ALTERNATIVE_LINK_NAME[logger] = "${bindir}/logger"
279ALTERNATIVE_LINK_NAME[losetup] = "${base_sbindir}/losetup"
280ALTERNATIVE_LINK_NAME[mesg] = "${bindir}/mesg"
281ALTERNATIVE_LINK_NAME[mkswap] = "${base_sbindir}/mkswap"
282ALTERNATIVE_LINK_NAME[mcookie] = "${bindir}/mcookie"
283ALTERNATIVE_LINK_NAME[more] = "${base_bindir}/more"
284ALTERNATIVE_LINK_NAME[mount] = "${base_bindir}/mount"
285ALTERNATIVE_LINK_NAME[mountpoint] = "${base_bindir}/mountpoint"
286ALTERNATIVE_LINK_NAME[nologin] = "${base_sbindir}/nologin"
287ALTERNATIVE_LINK_NAME[nsenter] = "${bindir}/nsenter"
288ALTERNATIVE_LINK_NAME[pivot_root] = "${base_sbindir}/pivot_root"
289ALTERNATIVE_LINK_NAME[prlimit] = "${bindir}/prlimit"
290ALTERNATIVE_LINK_NAME[readprofile] = "${sbindir}/readprofile"
291ALTERNATIVE_LINK_NAME[renice] = "${bindir}/renice"
292ALTERNATIVE_LINK_NAME[rev] = "${bindir}/rev"
293ALTERNATIVE_LINK_NAME[rfkill] = "${sbindir}/rfkill"
294ALTERNATIVE_LINK_NAME[rtcwake] = "${sbindir}/rtcwake"
295ALTERNATIVE_LINK_NAME[scriptreplay] = "${bindir}/scriptreplay"
296ALTERNATIVE_LINK_NAME[setpriv] = "${bindir}/setpriv"
297ALTERNATIVE_LINK_NAME[setsid] = "${bindir}/setsid"
298ALTERNATIVE_LINK_NAME[su] = "${base_bindir}/su"
299ALTERNATIVE_LINK_NAME[sulogin] = "${base_sbindir}/sulogin"
300ALTERNATIVE_LINK_NAME[swapoff] = "${base_sbindir}/swapoff"
301ALTERNATIVE_LINK_NAME[swapon] = "${base_sbindir}/swapon"
302ALTERNATIVE_LINK_NAME[switch_root] = "${base_sbindir}/switch_root"
303ALTERNATIVE_LINK_NAME[taskset] = "${bindir}/taskset"
304ALTERNATIVE_LINK_NAME[umount] = "${base_bindir}/umount"
305ALTERNATIVE_LINK_NAME[unshare] = "${bindir}/unshare"
306ALTERNATIVE_LINK_NAME[utmpdump] = "${bindir}/utmpdump"
307ALTERNATIVE_LINK_NAME[uuidgen] = "${bindir}/uuidgen"
308ALTERNATIVE_LINK_NAME[wall] = "${bindir}/wall"
309
310ALTERNATIVE:${PN}-doc = "\
311blkid.8 eject.1 findfs.8 fsck.8 kill.1 last.1 lastb.1 libblkid.3 logger.1 mesg.1 \
312mountpoint.1 nologin.8 rfkill.8 sulogin.8 utmpdump.1 uuid.3 wall.1\
313"
314ALTERNATIVE:${PN}-doc += "${@bb.utils.contains('PACKAGECONFIG', 'pam', 'su.1', '', d)}"
315ALTERNATIVE:${PN}-doc += "${@bb.utils.contains('PACKAGECONFIG', 'chfn-chsh', 'chfn.1 chsh.1', '', d)}"
316
317ALTERNATIVE_LINK_NAME[blkid.8] = "${mandir}/man8/blkid.8"
318ALTERNATIVE_LINK_NAME[chfn.1] = "${mandir}/man1/chfn.1"
319ALTERNATIVE_LINK_NAME[chsh.1] = "${mandir}/man1/chsh.1"
320ALTERNATIVE_LINK_NAME[eject.1] = "${mandir}/man1/eject.1"
321ALTERNATIVE_LINK_NAME[findfs.8] = "${mandir}/man8/findfs.8"
322ALTERNATIVE_LINK_NAME[fsck.8] = "${mandir}/man8/fsck.8"
323ALTERNATIVE_LINK_NAME[kill.1] = "${mandir}/man1/kill.1"
324ALTERNATIVE_LINK_NAME[last.1] = "${mandir}/man1/last.1"
325ALTERNATIVE_LINK_NAME[lastb.1] = "${mandir}/man1/lastb.1"
326ALTERNATIVE_LINK_NAME[libblkid.3] = "${mandir}/man3/libblkid.3"
327ALTERNATIVE_LINK_NAME[logger.1] = "${mandir}/man1/logger.1"
328ALTERNATIVE_LINK_NAME[mesg.1] = "${mandir}/man1/mesg.1"
329ALTERNATIVE_LINK_NAME[mountpoint.1] = "${mandir}/man1/mountpoint.1"
330ALTERNATIVE_LINK_NAME[nologin.8] = "${mandir}/man8/nologin.8"
331ALTERNATIVE_LINK_NAME[rfkill.8] = "${mandir}/man8/rfkill.8"
332ALTERNATIVE_LINK_NAME[setpriv.1] = "${mandir}/man1/setpriv.1"
333ALTERNATIVE_LINK_NAME[su.1] = "${mandir}/man1/su.1"
334ALTERNATIVE_LINK_NAME[sulogin.8] = "${mandir}/man8/sulogin.8"
335ALTERNATIVE_LINK_NAME[utmpdump.1] = "${mandir}/man1/utmpdump.1"
336ALTERNATIVE_LINK_NAME[uuid.3] = "${mandir}/man3/uuid.3"
337ALTERNATIVE_LINK_NAME[wall.1] = "${mandir}/man1/wall.1"
338
339BBCLASSEXTEND = "native nativesdk"
340
341PTEST_BINDIR = "1"
342do_compile_ptest() {
343 oe_runmake buildtest-TESTS
344}
345
346do_install_ptest() {
347 mkdir -p ${D}${PTEST_PATH}/tests/ts
348 find . -name 'test*' -maxdepth 1 -type f -perm -111 -exec cp {} ${D}${PTEST_PATH} \;
349 find ./.libs -name 'sample*' -maxdepth 1 -type f -perm -111 -exec cp {} ${D}${PTEST_PATH} \;
350 find ./.libs -name 'test*' -maxdepth 1 -type f -perm -111 -exec cp {} ${D}${PTEST_PATH} \;
351
352 cp ${S}/tests/*.sh ${D}${PTEST_PATH}/tests/
353 cp -pR ${S}/tests/expected ${D}${PTEST_PATH}/tests/expected
354 cp -pR ${S}/tests/ts ${D}${PTEST_PATH}/tests/
355 cp ${B}/config.h ${D}${PTEST_PATH}
356
357 sed -i 's|@base_sbindir@|${base_sbindir}|g' ${D}${PTEST_PATH}/run-ptest
358
359 # chfn needs PAM
360 if ! ${@bb.utils.contains('PACKAGECONFIG', 'pam', 'true', 'false', d)}; then
361 rm -rf ${D}${PTEST_PATH}/tests/ts/chfn
362 fi
363 # remove raid tests, known failures and avoid dependency on mdadm therefore
364 # See https://github.com/util-linux/util-linux/commit/7519c3edab120b14623931d5ddb16fdc6e7cad5d
365 rm -rf ${D}${PTEST_PATH}/tests/ts/blkid/md-raid0-whole
366 rm -rf ${D}${PTEST_PATH}/tests/ts/blkid/md-raid1-part
367 rm -rf ${D}${PTEST_PATH}/tests/ts/blkid/md-raid1-whole
368 rm -rf ${D}${PTEST_PATH}/tests/ts/fdisk/align-512-4K-md
369}
370
371# Delete tests not working on musl
372do_install_ptest:append:libc-musl() {
373 for t in tests/ts/col/multibyte \
374 tests/ts/lib/timeutils \
375 tests/ts/misc/enosys \
376 tests/ts/dmesg/limit; do
377 rm -rf ${D}${PTEST_PATH}/$t
378 done
379}