summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core
diff options
context:
space:
mode:
authorChen Qi <Qi.Chen@windriver.com>2025-02-14 00:39:27 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-02-18 11:56:04 +0000
commit06614551ac86a2f7ba7c44a0fbc79095859e689c (patch)
treee8f7780cb8b5b5c966f287323d25da1b8a200549 /meta/recipes-core
parentf8f333fb0e4e091cb586f625cfe9f356b97b46af (diff)
downloadpoky-06614551ac86a2f7ba7c44a0fbc79095859e689c.tar.gz
util-linux/util-linux-libuuid: upgrade from 2.40.2 to 2.40.4
The following patch dropped because it is in the new version: - 0001-autotools-fix-securedir-and-pam_lastlog2-install.patch libfdisk-cfdisk-and-sfdisk-sector-size-improvements.patch is replaced by two new patches: - 0001-cfdisk-add-sector-size-commanand-line-option.patch - 0002-sfdisk-add-sector-size-commanand-line-option.patch This is because the original patch is a squash of four patches and two of them are in the new version. So extract the remaining two that are not in the current version and make them separate patches for better tracking. (From OE-Core rev: e87b9bccc52bfba0c48db4920c0996d7dd6a0866) Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core')
-rw-r--r--meta/recipes-core/util-linux/util-linux-libuuid_2.40.4.bb (renamed from meta/recipes-core/util-linux/util-linux-libuuid_2.40.2.bb)0
-rw-r--r--meta/recipes-core/util-linux/util-linux.inc6
-rw-r--r--meta/recipes-core/util-linux/util-linux/0001-autotools-fix-securedir-and-pam_lastlog2-install.patch82
-rw-r--r--meta/recipes-core/util-linux/util-linux/0001-cfdisk-add-sector-size-commanand-line-option.patch90
-rw-r--r--meta/recipes-core/util-linux/util-linux/0002-sfdisk-add-sector-size-commanand-line-option.patch105
-rw-r--r--meta/recipes-core/util-linux/util-linux/libfdisk-cfdisk-and-sfdisk-sector-size-improvements.patch252
-rw-r--r--meta/recipes-core/util-linux/util-linux_2.40.4.bb (renamed from meta/recipes-core/util-linux/util-linux_2.40.2.bb)0
7 files changed, 198 insertions, 337 deletions
diff --git a/meta/recipes-core/util-linux/util-linux-libuuid_2.40.2.bb b/meta/recipes-core/util-linux/util-linux-libuuid_2.40.4.bb
index ec04c1d384..ec04c1d384 100644
--- a/meta/recipes-core/util-linux/util-linux-libuuid_2.40.2.bb
+++ b/meta/recipes-core/util-linux/util-linux-libuuid_2.40.4.bb
diff --git a/meta/recipes-core/util-linux/util-linux.inc b/meta/recipes-core/util-linux/util-linux.inc
index 580ff488e4..4e8701ffdf 100644
--- a/meta/recipes-core/util-linux/util-linux.inc
+++ b/meta/recipes-core/util-linux/util-linux.inc
@@ -38,10 +38,10 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/util-linux/v${MAJOR_VERSION}/util-lin
38 file://display_testname_for_subtest.patch \ 38 file://display_testname_for_subtest.patch \
39 file://avoid_parallel_tests.patch \ 39 file://avoid_parallel_tests.patch \
40 file://fcntl-lock.c \ 40 file://fcntl-lock.c \
41 file://0001-autotools-fix-securedir-and-pam_lastlog2-install.patch \ 41 file://0001-cfdisk-add-sector-size-commanand-line-option.patch \
42 file://libfdisk-cfdisk-and-sfdisk-sector-size-improvements.patch \ 42 file://0002-sfdisk-add-sector-size-commanand-line-option.patch \
43 " 43 "
44 44
45SRC_URI[sha256sum] = "d78b37a66f5922d70edf3bdfb01a6b33d34ed3c3cafd6628203b2a2b67c8e8b3" 45SRC_URI[sha256sum] = "5c1daf733b04e9859afdc3bd87cc481180ee0f88b5c0946b16fdec931975fb79"
46 46
47CVE_PRODUCT = "util-linux" 47CVE_PRODUCT = "util-linux"
diff --git a/meta/recipes-core/util-linux/util-linux/0001-autotools-fix-securedir-and-pam_lastlog2-install.patch b/meta/recipes-core/util-linux/util-linux/0001-autotools-fix-securedir-and-pam_lastlog2-install.patch
deleted file mode 100644
index 272e574a77..0000000000
--- a/meta/recipes-core/util-linux/util-linux/0001-autotools-fix-securedir-and-pam_lastlog2-install.patch
+++ /dev/null
@@ -1,82 +0,0 @@
1From f912fb1bbb0ff5af2736d154347a3b9fc40476eb Mon Sep 17 00:00:00 2001
2From: Karel Zak <kzak@redhat.com>
3Date: Tue, 27 Aug 2024 12:00:21 +0200
4Subject: [PATCH] autotools: fix securedir and pam_lastlog2 install
5
6Addresses: https://github.com/util-linux/util-linux/pull/3173
7Signed-off-by: Karel Zak <kzak@redhat.com>
8
9Upstream-Status: Backport
10[https://github.com/util-linux/util-linux/commit/9c787eaac43f5f01146f792b0239f587e4b81202]
11
12Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
13---
14 Makefile.am | 6 +++---
15 configure.ac | 6 +++---
16 pam_lastlog2/src/Makemodule.am | 2 +-
17 3 files changed, 7 insertions(+), 7 deletions(-)
18
19diff --git a/Makefile.am b/Makefile.am
20index ee2d553..a5dcaea 100644
21--- a/Makefile.am
22+++ b/Makefile.am
23@@ -56,7 +56,7 @@ usrsbin_exec_PROGRAMS =
24 man_MANS =
25 pkgconfig_DATA =
26 usrlib_exec_LTLIBRARIES =
27-usrsecurelib_exec_LTLIBRARIES =
28+securelib_exec_LTLIBRARIES =
29 bin_PROGRAMS =
30 sbin_PROGRAMS =
31 dist_usrbin_exec_SCRIPTS =
32@@ -155,11 +155,11 @@ EXTRA_DIST += \
33 # pylibmountexec module must be installed after usrlib_exec libraries,
34 # otherwise the libtool relink step will fail to find libmount.la and
35 # will try -lmount which is possibly not available.
36-# The same for usrsecurelib_exec and liblastlog2.la
37+# The same for securelib_exec and liblastlog2.la
38 #
39 # So introduce this dependency rule:
40 # install-pylibmountexecLTLIBRARIES: install-usrlib_execLTLIBRARIES
41-# install-usrsecurelib_execLTLIBRARIES: install-usrlib_execLTLIBRARIES
42+# install-securelib_execLTLIBRARIES: install-usrlib_execLTLIBRARIES
43 @verbatim_extra_dependency@
44
45 #
46diff --git a/configure.ac b/configure.ac
47index 0375d29..134cf38 100644
48--- a/configure.ac
49+++ b/configure.ac
50@@ -123,8 +123,8 @@ AS_CASE([$libdir],
51 )
52 AC_SUBST([usrlib_execdir])
53
54-usrsecurelib_execdir='${usrlib_execdir}/security'
55-AC_SUBST([usrsecurelib_execdir])
56+securelib_execdir='${libdir}/security'
57+AC_SUBST([securelib_execdir])
58
59 # static configuration maintaned by packages (e.g. /usr/lib)
60 AC_ARG_VAR([SYSCONFSTATICDIR],
61@@ -2767,7 +2767,7 @@ verbatim_extra_dependency='
62 # otherwise the libtool relink step will fail to find libmount.la and
63 # will try -lmount which is possibly not available.
64 install-pylibmountexecLTLIBRARIES: install-usrlib_execLTLIBRARIES
65-install-usrsecurelib_execLTLIBRARIES: install-usrlib_execLTLIBRARIES
66+install-securelib_execLTLIBRARIES: install-usrlib_execLTLIBRARIES
67
68 '
69 AC_SUBST([verbatim_extra_dependency])
70diff --git a/pam_lastlog2/src/Makemodule.am b/pam_lastlog2/src/Makemodule.am
71index 6d23653..a2becac 100644
72--- a/pam_lastlog2/src/Makemodule.am
73+++ b/pam_lastlog2/src/Makemodule.am
74@@ -1,4 +1,4 @@
75-usrsecurelib_exec_LTLIBRARIES += pam_lastlog2.la
76+securelib_exec_LTLIBRARIES += pam_lastlog2.la
77
78 pam_lastlog2_la_SOURCES = \
79 pam_lastlog2/src/pam_lastlog2.c
80--
812.25.1
82
diff --git a/meta/recipes-core/util-linux/util-linux/0001-cfdisk-add-sector-size-commanand-line-option.patch b/meta/recipes-core/util-linux/util-linux/0001-cfdisk-add-sector-size-commanand-line-option.patch
new file mode 100644
index 0000000000..73031318d2
--- /dev/null
+++ b/meta/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/recipes-core/util-linux/util-linux/0002-sfdisk-add-sector-size-commanand-line-option.patch b/meta/recipes-core/util-linux/util-linux/0002-sfdisk-add-sector-size-commanand-line-option.patch
new file mode 100644
index 0000000000..8d47d8de71
--- /dev/null
+++ b/meta/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/recipes-core/util-linux/util-linux/libfdisk-cfdisk-and-sfdisk-sector-size-improvements.patch b/meta/recipes-core/util-linux/util-linux/libfdisk-cfdisk-and-sfdisk-sector-size-improvements.patch
deleted file mode 100644
index 356194a8ba..0000000000
--- a/meta/recipes-core/util-linux/util-linux/libfdisk-cfdisk-and-sfdisk-sector-size-improvements.patch
+++ /dev/null
@@ -1,252 +0,0 @@
1From 7ada6547fcd1f649fadaa8021ff21e3e0f431459 Mon Sep 17 00:00:00 2001
2From: Karel Zak <kzak@redhat.com>
3Date: Mon, 14 Oct 2024 11:45:32 +0200
4Subject: [PATCH 1/4] libfdisk: make sure libblkid uses the same sector size
5
6Libfdisk uses libblkid to check for filesystems on the device. It
7makes sense for both libraries to share the logical sector size
8setting, as this setting can be modified by using the fdisk command
9line.
10
11We do not see this as an issue, as filesystem detection rarely depends
12on sector size (with the exception of some RAIDs). Additionally,
13libblkid is usually intelligent enough to check multiple locations
14independently of the current device's sector size setting.
15
16Addresses: https://github.com/util-linux/util-linux/pull/3235
17
18Upstream-Status: Submitted [https://github.com/util-linux/util-linux/pull/3237]
19
20Signed-off-by: Karel Zak <kzak@redhat.com>
21---
22 libfdisk/src/wipe.c | 3 +++
23 1 file changed, 3 insertions(+)
24
25diff --git a/libfdisk/src/wipe.c b/libfdisk/src/wipe.c
26index bb5f1bb38bf..f389ed4194a 100644
27--- a/libfdisk/src/wipe.c
28+++ b/libfdisk/src/wipe.c
29@@ -133,6 +133,7 @@ int fdisk_do_wipe(struct fdisk_context *cxt)
30 DBG(WIPE, ul_debugobj(wp, "blkid_probe_set_device() failed [rc=%d]", rc));
31 return rc;
32 }
33+ blkid_probe_set_sectorsize(pr, cxt->sector_size);
34
35 DBG(WIPE, ul_debugobj(wp, " wiping..."));
36 blkid_wipe_all(pr);
37@@ -176,6 +177,8 @@ int fdisk_check_collisions(struct fdisk_context *cxt)
38 free(cxt->collision);
39 cxt->collision = NULL;
40
41+ blkid_probe_set_sectorsize(pr, cxt->sector_size);
42+
43 blkid_probe_enable_superblocks(pr, 1);
44 blkid_probe_set_superblocks_flags(pr, BLKID_SUBLKS_TYPE |
45 BLKID_SUBLKS_BADCSUM);
46
47From 54f9a79301dcf492cab8e07134f96a921d367aa0 Mon Sep 17 00:00:00 2001
48From: Karel Zak <kzak@redhat.com>
49Date: Mon, 14 Oct 2024 15:47:03 +0200
50Subject: [PATCH 2/4] fdisk: (man) improve --sector-size description
51
52Signed-off-by: Karel Zak <kzak@redhat.com>
53---
54 disk-utils/fdisk.8.adoc | 2 +-
55 1 file changed, 1 insertion(+), 1 deletion(-)
56
57diff --git a/disk-utils/fdisk.8.adoc b/disk-utils/fdisk.8.adoc
58index cb72b4a3ea5..5941aa34968 100644
59--- a/disk-utils/fdisk.8.adoc
60+++ b/disk-utils/fdisk.8.adoc
61@@ -40,7 +40,7 @@ Note that *partx*(8) provides a rich interface for scripts to print disk layouts
62 == OPTIONS
63
64 *-b*, *--sector-size* _sectorsize_::
65-Specify the sector size of the disk. Valid values are 512, 1024, 2048, and 4096. (Recent kernels know the sector size. Use this option only on old kernels or to override the kernel's ideas.) Since util-linux-2.17, *fdisk* differentiates between logical and physical sector size. This option changes both sector sizes to _sectorsize_.
66+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_.
67
68 *-B*, *--protect-boot*::
69 Don't erase the beginning of the first disk sector when creating a new disk label. This feature is supported for GPT and MBR.
70
71From fd38ee2274f7a30393d3839dfce556260355c3fa Mon Sep 17 00:00:00 2001
72From: Karel Zak <kzak@redhat.com>
73Date: Mon, 14 Oct 2024 15:48:46 +0200
74Subject: [PATCH 3/4] cfdisk: add --sector-size commanand line option
75
76* improves compatibility with fdisk
77* add ability to work with disk images where libfdisk defaults to 512
78
79Signed-off-by: Karel Zak <kzak@redhat.com>
80---
81 disk-utils/cfdisk.8.adoc | 3 +++
82 disk-utils/cfdisk.c | 15 ++++++++++++++-
83 2 files changed, 17 insertions(+), 1 deletion(-)
84
85diff --git a/disk-utils/cfdisk.8.adoc b/disk-utils/cfdisk.8.adoc
86index 97fad621d12..759f39f0e1a 100644
87--- a/disk-utils/cfdisk.8.adoc
88+++ b/disk-utils/cfdisk.8.adoc
89@@ -55,6 +55,9 @@ Use exclusive BSD lock for device or file it operates. The optional argument _mo
90 *-r*, *--read-only*::
91 Forced open in read-only mode.
92
93+*-b*, *--sector-size* _sectorsize_::
94+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_.
95+
96 *-z*, *--zero*::
97 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.
98
99diff --git a/disk-utils/cfdisk.c b/disk-utils/cfdisk.c
100index 2e0aada474a..bc1c87d83e4 100644
101--- a/disk-utils/cfdisk.c
102+++ b/disk-utils/cfdisk.c
103@@ -2731,6 +2731,8 @@ static void __attribute__((__noreturn__)) usage(void)
104 _(" --lock[=<mode>] use exclusive device lock (%s, %s or %s)\n"), "yes", "no", "nonblock");
105 fputs(_(" -r, --read-only forced open cfdisk in read-only mode\n"), out);
106
107+ fputs(_(" -b, --sector-size <size> physical and logical sector size\n"), out);
108+
109 fputs(USAGE_SEPARATOR, out);
110 fprintf(out, USAGE_HELP_OPTIONS(26));
111
112@@ -2743,6 +2745,7 @@ int main(int argc, char *argv[])
113 const char *diskpath = NULL, *lockmode = NULL;
114 int rc, c, colormode = UL_COLORMODE_UNDEF;
115 int read_only = 0;
116+ size_t user_ss = 0;
117 struct cfdisk _cf = { .lines_idx = 0 },
118 *cf = &_cf;
119 enum {
120@@ -2752,6 +2755,7 @@ int main(int argc, char *argv[])
121 { "color", optional_argument, NULL, 'L' },
122 { "lock", optional_argument, NULL, OPT_LOCK },
123 { "help", no_argument, NULL, 'h' },
124+ { "sector-size", required_argument, NULL, 'b' },
125 { "version", no_argument, NULL, 'V' },
126 { "zero", no_argument, NULL, 'z' },
127 { "read-only", no_argument, NULL, 'r' },
128@@ -2763,8 +2767,15 @@ int main(int argc, char *argv[])
129 textdomain(PACKAGE);
130 close_stdout_atexit();
131
132- while((c = getopt_long(argc, argv, "L::hVzr", longopts, NULL)) != -1) {
133+ while((c = getopt_long(argc, argv, "b:L::hVzr", longopts, NULL)) != -1) {
134 switch(c) {
135+ case 'b':
136+ user_ss = strtou32_or_err(optarg,
137+ _("invalid sector size argument"));
138+ if (user_ss != 512 && user_ss != 1024 &&
139+ user_ss != 2048 && user_ss != 4096)
140+ errx(EXIT_FAILURE, _("invalid sector size argument"));
141+ break;
142 case 'h':
143 usage();
144 break;
145@@ -2803,6 +2814,8 @@ int main(int argc, char *argv[])
146 cf->cxt = fdisk_new_context();
147 if (!cf->cxt)
148 err(EXIT_FAILURE, _("failed to allocate libfdisk context"));
149+ if (user_ss)
150+ fdisk_save_user_sector_size(cf->cxt, user_ss, user_ss);
151
152 fdisk_set_ask(cf->cxt, ask_callback, (void *) cf);
153
154
155From ef7b76baa17ddb5414691fa8f49d61415c30871c Mon Sep 17 00:00:00 2001
156From: Karel Zak <kzak@redhat.com>
157Date: Mon, 14 Oct 2024 15:50:40 +0200
158Subject: [PATCH 4/4] sfdisk: add --sector-size commanand line option
159
160* improves compatibility with fdisk
161* add ability to work with disk images where libfdisk defaults to 512
162
163Addresses: https://github.com/util-linux/util-linux/pull/3235
164Signed-off-by: Karel Zak <kzak@redhat.com>
165---
166 disk-utils/sfdisk.8.adoc | 5 ++++-
167 disk-utils/sfdisk.c | 14 ++++++++++++++
168 2 files changed, 18 insertions(+), 1 deletion(-)
169
170diff --git a/disk-utils/sfdisk.8.adoc b/disk-utils/sfdisk.8.adoc
171index 26ccad5a3b2..ce9e97b7682 100644
172--- a/disk-utils/sfdisk.8.adoc
173+++ b/disk-utils/sfdisk.8.adoc
174@@ -208,6 +208,9 @@ The default list of columns may be extended if _list_ is specified in the format
175 *-q*, *--quiet*::
176 Suppress extra info messages.
177
178+*--sector-size* _sectorsize_::
179+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_.
180+
181 *-u*, *--unit S*::
182 Deprecated option. Only the sector unit is supported. This option is not supported when using the *--show-size* command.
183
184@@ -256,7 +259,7 @@ Specify the maximal number of GPT partitions.
185 *grain*::
186 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.
187 *sector-size*::
188-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.
189+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.
190
191 Note that it is only possible to use header lines before the first partition is specified in the input.
192
193diff --git a/disk-utils/sfdisk.c b/disk-utils/sfdisk.c
194index cf402007b51..5e7c1d926e4 100644
195--- a/disk-utils/sfdisk.c
196+++ b/disk-utils/sfdisk.c
197@@ -2155,6 +2155,8 @@ static void __attribute__((__noreturn__)) usage(void)
198 _(" --color[=<when>] colorize output (%s, %s or %s)\n"), "auto", "always", "never");
199 fprintf(out,
200 " %s\n", USAGE_COLORS_DEFAULT);
201+ fputs(_(" --sector-size <size> physical and logical sector size\n"), out);
202+
203 fprintf(out,
204 _(" --lock[=<mode>] use exclusive device lock (%s, %s or %s)\n"), "yes", "no", "nonblock");
205 fputs(_(" -N, --partno <num> specify partition number\n"), out);
206@@ -2191,6 +2193,7 @@ int main(int argc, char *argv[])
207 const char *outarg = NULL;
208 int rc = -EINVAL, c, longidx = -1, bytes = 0;
209 int colormode = UL_COLORMODE_UNDEF;
210+ size_t user_ss = 0;
211 struct sfdisk _sf = {
212 .partno = -1,
213 .wipemode = WIPEMODE_AUTO,
214@@ -2217,6 +2220,7 @@ int main(int argc, char *argv[])
215 OPT_NOTELL,
216 OPT_RELOCATE,
217 OPT_LOCK,
218+ OPT_SECTORSIZE
219 };
220
221 static const struct option longopts[] = {
222@@ -2246,6 +2250,7 @@ int main(int argc, char *argv[])
223 { "output", required_argument, NULL, 'o' },
224 { "partno", required_argument, NULL, 'N' },
225 { "reorder", no_argument, NULL, 'r' },
226+ { "sector-size", required_argument, NULL, OPT_SECTORSIZE },
227 { "show-geometry", no_argument, NULL, 'g' },
228 { "quiet", no_argument, NULL, 'q' },
229 { "verify", no_argument, NULL, 'V' },
230@@ -2450,6 +2455,13 @@ int main(int argc, char *argv[])
231 sf->lockmode = optarg;
232 }
233 break;
234+ case OPT_SECTORSIZE:
235+ user_ss = strtou32_or_err(optarg,
236+ _("invalid sector size argument"));
237+ if (user_ss != 512 && user_ss != 1024 &&
238+ user_ss != 2048 && user_ss != 4096)
239+ errx(EXIT_FAILURE, _("invalid sector size argument"));
240+ break;
241 default:
242 errtryhelp(EXIT_FAILURE);
243 }
244@@ -2460,6 +2472,8 @@ int main(int argc, char *argv[])
245 sfdisk_init(sf);
246 if (bytes)
247 fdisk_set_size_unit(sf->cxt, FDISK_SIZEUNIT_BYTES);
248+ if (user_ss)
249+ fdisk_save_user_sector_size(sf->cxt, user_ss, user_ss);
250
251 if (outarg)
252 init_fields(NULL, outarg, NULL);
diff --git a/meta/recipes-core/util-linux/util-linux_2.40.2.bb b/meta/recipes-core/util-linux/util-linux_2.40.4.bb
index 81bd298dd9..81bd298dd9 100644
--- a/meta/recipes-core/util-linux/util-linux_2.40.2.bb
+++ b/meta/recipes-core/util-linux/util-linux_2.40.4.bb