From: Chen Qi <qi.c...@windriver.com>

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.

Signed-off-by: Chen Qi <qi.c...@windriver.com>
---
 ...2.40.2.bb => util-linux-libuuid_2.40.4.bb} |   0
 meta/recipes-core/util-linux/util-linux.inc   |   6 +-
 ...x-securedir-and-pam_lastlog2-install.patch |  82 ------
 ...dd-sector-size-commanand-line-option.patch |  90 +++++++
 ...dd-sector-size-commanand-line-option.patch | 105 ++++++++
 ...-and-sfdisk-sector-size-improvements.patch | 252 ------------------
 ...l-linux_2.40.2.bb => util-linux_2.40.4.bb} |   0
 7 files changed, 198 insertions(+), 337 deletions(-)
 rename meta/recipes-core/util-linux/{util-linux-libuuid_2.40.2.bb => 
util-linux-libuuid_2.40.4.bb} (100%)
 delete mode 100644 
meta/recipes-core/util-linux/util-linux/0001-autotools-fix-securedir-and-pam_lastlog2-install.patch
 create mode 100644 
meta/recipes-core/util-linux/util-linux/0001-cfdisk-add-sector-size-commanand-line-option.patch
 create mode 100644 
meta/recipes-core/util-linux/util-linux/0002-sfdisk-add-sector-size-commanand-line-option.patch
 delete mode 100644 
meta/recipes-core/util-linux/util-linux/libfdisk-cfdisk-and-sfdisk-sector-size-improvements.patch
 rename meta/recipes-core/util-linux/{util-linux_2.40.2.bb => 
util-linux_2.40.4.bb} (100%)

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
similarity index 100%
rename from meta/recipes-core/util-linux/util-linux-libuuid_2.40.2.bb
rename to 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
            file://display_testname_for_subtest.patch \
            file://avoid_parallel_tests.patch \
            file://fcntl-lock.c \
-           file://0001-autotools-fix-securedir-and-pam_lastlog2-install.patch \
-           file://libfdisk-cfdisk-and-sfdisk-sector-size-improvements.patch \
+           file://0001-cfdisk-add-sector-size-commanand-line-option.patch \
+           file://0002-sfdisk-add-sector-size-commanand-line-option.patch \
            "
 
-SRC_URI[sha256sum] = 
"d78b37a66f5922d70edf3bdfb01a6b33d34ed3c3cafd6628203b2a2b67c8e8b3"
+SRC_URI[sha256sum] = 
"5c1daf733b04e9859afdc3bd87cc481180ee0f88b5c0946b16fdec931975fb79"
 
 CVE_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 @@
-From f912fb1bbb0ff5af2736d154347a3b9fc40476eb Mon Sep 17 00:00:00 2001
-From: Karel Zak <k...@redhat.com>
-Date: Tue, 27 Aug 2024 12:00:21 +0200
-Subject: [PATCH] autotools: fix securedir and pam_lastlog2 install
-
-Addresses: https://github.com/util-linux/util-linux/pull/3173
-Signed-off-by: Karel Zak <k...@redhat.com>
-
-Upstream-Status: Backport
-[https://github.com/util-linux/util-linux/commit/9c787eaac43f5f01146f792b0239f587e4b81202]
-
-Signed-off-by: Yi Zhao <yi.z...@windriver.com>
----
- Makefile.am                    | 6 +++---
- configure.ac                   | 6 +++---
- pam_lastlog2/src/Makemodule.am | 2 +-
- 3 files changed, 7 insertions(+), 7 deletions(-)
-
-diff --git a/Makefile.am b/Makefile.am
-index ee2d553..a5dcaea 100644
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -56,7 +56,7 @@ usrsbin_exec_PROGRAMS =
- man_MANS =
- pkgconfig_DATA =
- usrlib_exec_LTLIBRARIES =
--usrsecurelib_exec_LTLIBRARIES =
-+securelib_exec_LTLIBRARIES =
- bin_PROGRAMS =
- sbin_PROGRAMS =
- dist_usrbin_exec_SCRIPTS =
-@@ -155,11 +155,11 @@ EXTRA_DIST += \
- # pylibmountexec module must be installed after usrlib_exec libraries,
- # otherwise the libtool relink step will fail to find libmount.la and
- # will try -lmount which is possibly not available.
--# The same for usrsecurelib_exec and liblastlog2.la
-+# The same for securelib_exec and liblastlog2.la
- #
- # So introduce this dependency rule:
- # install-pylibmountexecLTLIBRARIES: install-usrlib_execLTLIBRARIES
--# install-usrsecurelib_execLTLIBRARIES: install-usrlib_execLTLIBRARIES
-+# install-securelib_execLTLIBRARIES: install-usrlib_execLTLIBRARIES
- @verbatim_extra_dependency@
- 
- #
-diff --git a/configure.ac b/configure.ac
-index 0375d29..134cf38 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -123,8 +123,8 @@ AS_CASE([$libdir],
- )
- AC_SUBST([usrlib_execdir])
- 
--usrsecurelib_execdir='${usrlib_execdir}/security'
--AC_SUBST([usrsecurelib_execdir])
-+securelib_execdir='${libdir}/security'
-+AC_SUBST([securelib_execdir])
- 
- # static configuration maintaned by packages (e.g. /usr/lib)
- AC_ARG_VAR([SYSCONFSTATICDIR],
-@@ -2767,7 +2767,7 @@ verbatim_extra_dependency='
- # otherwise the libtool relink step will fail to find libmount.la and
- # will try -lmount which is possibly not available.
- install-pylibmountexecLTLIBRARIES: install-usrlib_execLTLIBRARIES
--install-usrsecurelib_execLTLIBRARIES: install-usrlib_execLTLIBRARIES
-+install-securelib_execLTLIBRARIES: install-usrlib_execLTLIBRARIES
- 
- '
- AC_SUBST([verbatim_extra_dependency])
-diff --git a/pam_lastlog2/src/Makemodule.am b/pam_lastlog2/src/Makemodule.am
-index 6d23653..a2becac 100644
---- a/pam_lastlog2/src/Makemodule.am
-+++ b/pam_lastlog2/src/Makemodule.am
-@@ -1,4 +1,4 @@
--usrsecurelib_exec_LTLIBRARIES += pam_lastlog2.la
-+securelib_exec_LTLIBRARIES += pam_lastlog2.la
- 
- pam_lastlog2_la_SOURCES = \
-       pam_lastlog2/src/pam_lastlog2.c
--- 
-2.25.1
-
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 @@
+From 724b95ee6847613e23ca18f4918d4e65ff5b270e Mon Sep 17 00:00:00 2001
+From: Karel Zak <k...@redhat.com>
+Date: Mon, 14 Oct 2024 15:48:46 +0200
+Subject: [PATCH 1/2] cfdisk: add --sector-size commanand line option
+
+* improves compatibility with fdisk
+* add ability to work with disk images where libfdisk defaults to 512
+
+Signed-off-by: Karel Zak <k...@redhat.com>
+
+Upstream-Status: Backport [fd38ee2274f7a30393d3839dfce556260355c3fa]
+
+Signed-off-by: Chen Qi <qi.c...@windriver.com>
+---
+ disk-utils/cfdisk.8.adoc |  3 +++
+ disk-utils/cfdisk.c      | 15 ++++++++++++++-
+ 2 files changed, 17 insertions(+), 1 deletion(-)
+
+diff --git a/disk-utils/cfdisk.8.adoc b/disk-utils/cfdisk.8.adoc
+index 97fad621d..759f39f0e 100644
+--- a/disk-utils/cfdisk.8.adoc
++++ b/disk-utils/cfdisk.8.adoc
+@@ -55,6 +55,9 @@ Use exclusive BSD lock for device or file it operates. The 
optional argument _mo
+ *-r*, *--read-only*::
+ Forced open in read-only mode.
+ 
++*-b*, *--sector-size* _sectorsize_::
++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_.
++
+ *-z*, *--zero*::
+ 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.
+ 
+diff --git a/disk-utils/cfdisk.c b/disk-utils/cfdisk.c
+index 183b7671e..f37e2d72a 100644
+--- a/disk-utils/cfdisk.c
++++ b/disk-utils/cfdisk.c
+@@ -2739,6 +2739,8 @@ static void __attribute__((__noreturn__)) usage(void)
+             _("     --lock[=<mode>]      use exclusive device lock (%s, %s or 
%s)\n"), "yes", "no", "nonblock");
+       fputs(_(" -r, --read-only          forced open cfdisk in read-only 
mode\n"), out);
+ 
++      fputs(_(" -b, --sector-size <size> physical and logical sector 
size\n"), out);
++
+       fputs(USAGE_SEPARATOR, out);
+       fprintf(out, USAGE_HELP_OPTIONS(26));
+ 
+@@ -2751,6 +2753,7 @@ int main(int argc, char *argv[])
+       const char *diskpath = NULL, *lockmode = NULL;
+       int rc, c, colormode = UL_COLORMODE_UNDEF;
+       int read_only = 0;
++      size_t user_ss = 0;
+       struct cfdisk _cf = { .lines_idx = 0 },
+                     *cf = &_cf;
+       enum {
+@@ -2760,6 +2763,7 @@ int main(int argc, char *argv[])
+               { "color",   optional_argument, NULL, 'L' },
+               { "lock",    optional_argument, NULL, OPT_LOCK },
+               { "help",    no_argument,       NULL, 'h' },
++              { "sector-size", required_argument, NULL, 'b' },
+               { "version", no_argument,       NULL, 'V' },
+               { "zero",    no_argument,       NULL, 'z' },
+               { "read-only", no_argument,     NULL, 'r' },
+@@ -2771,8 +2775,15 @@ int main(int argc, char *argv[])
+       textdomain(PACKAGE);
+       close_stdout_atexit();
+ 
+-      while((c = getopt_long(argc, argv, "L::hVzr", longopts, NULL)) != -1) {
++      while((c = getopt_long(argc, argv, "b:L::hVzr", longopts, NULL)) != -1) 
{
+               switch(c) {
++              case 'b':
++                      user_ss = strtou32_or_err(optarg,
++                                      _("invalid sector size argument"));
++                      if (user_ss != 512 && user_ss != 1024 &&
++                          user_ss != 2048 && user_ss != 4096)
++                              errx(EXIT_FAILURE, _("invalid sector size 
argument"));
++                      break;
+               case 'h':
+                       usage();
+                       break;
+@@ -2811,6 +2822,8 @@ int main(int argc, char *argv[])
+       cf->cxt = fdisk_new_context();
+       if (!cf->cxt)
+               err(EXIT_FAILURE, _("failed to allocate libfdisk context"));
++      if (user_ss)
++              fdisk_save_user_sector_size(cf->cxt, user_ss, user_ss);
+ 
+       fdisk_set_ask(cf->cxt, ask_callback, (void *) cf);
+ 
+-- 
+2.25.1
+
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 @@
+From 96570c03f46e0a5c17e721737a38c717c67e358b Mon Sep 17 00:00:00 2001
+From: Karel Zak <k...@redhat.com>
+Date: Mon, 14 Oct 2024 15:50:40 +0200
+Subject: [PATCH 2/2] sfdisk: add --sector-size commanand line option
+
+* improves compatibility with fdisk
+* add ability to work with disk images where libfdisk defaults to 512
+
+Addresses: https://github.com/util-linux/util-linux/pull/3235
+Signed-off-by: Karel Zak <k...@redhat.com>
+
+Upstream-Status: Backport [ef7b76baa17ddb5414691fa8f49d61415c30871c]
+
+Signed-off-by: Chen Qi <qi.c...@windriver.com>
+---
+ disk-utils/sfdisk.8.adoc |  5 ++++-
+ disk-utils/sfdisk.c      | 14 ++++++++++++++
+ 2 files changed, 18 insertions(+), 1 deletion(-)
+
+diff --git a/disk-utils/sfdisk.8.adoc b/disk-utils/sfdisk.8.adoc
+index bc3ff9bb8..d1eaa3712 100644
+--- a/disk-utils/sfdisk.8.adoc
++++ b/disk-utils/sfdisk.8.adoc
+@@ -201,6 +201,9 @@ The default list of columns may be extended if _list_ is 
specified in the format
+ *-q*, *--quiet*::
+ Suppress extra info messages.
+ 
++*--sector-size* _sectorsize_::
++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_.
++
+ *-u*, *--unit S*::
+ Deprecated option. Only the sector unit is supported. This option is not 
supported when using the *--show-size* command.
+ 
+@@ -249,7 +252,7 @@ Specify the maximal number of GPT partitions.
+ *grain*::
+ 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.
+ *sector-size*::
+-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.
++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.
+ 
+ Note that it is only possible to use header lines before the first partition 
is specified in the input.
+ 
+diff --git a/disk-utils/sfdisk.c b/disk-utils/sfdisk.c
+index d8dd8d296..97d426559 100644
+--- a/disk-utils/sfdisk.c
++++ b/disk-utils/sfdisk.c
+@@ -2084,6 +2084,8 @@ static void __attribute__((__noreturn__)) usage(void)
+             _("     --color[=<when>]      colorize output (%s, %s or %s)\n"), 
"auto", "always", "never");
+       fprintf(out,
+               "                             %s\n", USAGE_COLORS_DEFAULT);
++      fputs(_("     --sector-size <size>  physical and logical sector 
size\n"), out);
++
+       fprintf(out,
+             _("     --lock[=<mode>]       use exclusive device lock (%s, %s 
or %s)\n"), "yes", "no", "nonblock");
+       fputs(_(" -N, --partno <num>        specify partition number\n"), out);
+@@ -2120,6 +2122,7 @@ int main(int argc, char *argv[])
+       const char *outarg = NULL;
+       int rc = -EINVAL, c, longidx = -1, bytes = 0;
+       int colormode = UL_COLORMODE_UNDEF;
++      size_t user_ss = 0;
+       struct sfdisk _sf = {
+               .partno = -1,
+               .wipemode = WIPEMODE_AUTO,
+@@ -2145,6 +2148,7 @@ int main(int argc, char *argv[])
+               OPT_NOTELL,
+               OPT_RELOCATE,
+               OPT_LOCK,
++              OPT_SECTORSIZE
+       };
+ 
+       static const struct option longopts[] = {
+@@ -2174,6 +2178,7 @@ int main(int argc, char *argv[])
+               { "output",  required_argument, NULL, 'o' },
+               { "partno",  required_argument, NULL, 'N' },
+               { "reorder", no_argument,       NULL, 'r' },
++              { "sector-size", required_argument, NULL, OPT_SECTORSIZE },
+               { "show-geometry", no_argument, NULL, 'g' },
+               { "quiet",   no_argument,       NULL, 'q' },
+               { "verify",  no_argument,       NULL, 'V' },
+@@ -2373,6 +2378,13 @@ int main(int argc, char *argv[])
+                               sf->lockmode = optarg;
+                       }
+                       break;
++              case OPT_SECTORSIZE:
++                      user_ss = strtou32_or_err(optarg,
++                                      _("invalid sector size argument"));
++                      if (user_ss != 512 && user_ss != 1024 &&
++                          user_ss != 2048 && user_ss != 4096)
++                              errx(EXIT_FAILURE, _("invalid sector size 
argument"));
++                      break;
+               default:
+                       errtryhelp(EXIT_FAILURE);
+               }
+@@ -2383,6 +2395,8 @@ int main(int argc, char *argv[])
+       sfdisk_init(sf);
+       if (bytes)
+               fdisk_set_size_unit(sf->cxt, FDISK_SIZEUNIT_BYTES);
++      if (user_ss)
++              fdisk_save_user_sector_size(sf->cxt, user_ss, user_ss);
+ 
+       if (outarg)
+               init_fields(NULL, outarg, NULL);
+-- 
+2.25.1
+
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 @@
-From 7ada6547fcd1f649fadaa8021ff21e3e0f431459 Mon Sep 17 00:00:00 2001
-From: Karel Zak <k...@redhat.com>
-Date: Mon, 14 Oct 2024 11:45:32 +0200
-Subject: [PATCH 1/4] libfdisk: make sure libblkid uses the same sector size
-
-Libfdisk uses libblkid to check for filesystems on the device. It
-makes sense for both libraries to share the logical sector size
-setting, as this setting can be modified by using the fdisk command
-line.
-
-We do not see this as an issue, as filesystem detection rarely depends
-on sector size (with the exception of some RAIDs). Additionally,
-libblkid is usually intelligent enough to check multiple locations
-independently of the current device's sector size setting.
-
-Addresses: https://github.com/util-linux/util-linux/pull/3235
-
-Upstream-Status: Submitted [https://github.com/util-linux/util-linux/pull/3237]
-
-Signed-off-by: Karel Zak <k...@redhat.com>
----
- libfdisk/src/wipe.c | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/libfdisk/src/wipe.c b/libfdisk/src/wipe.c
-index bb5f1bb38bf..f389ed4194a 100644
---- a/libfdisk/src/wipe.c
-+++ b/libfdisk/src/wipe.c
-@@ -133,6 +133,7 @@ int fdisk_do_wipe(struct fdisk_context *cxt)
-                       DBG(WIPE, ul_debugobj(wp, "blkid_probe_set_device() 
failed [rc=%d]", rc));
-                       return rc;
-               }
-+              blkid_probe_set_sectorsize(pr, cxt->sector_size);
- 
-               DBG(WIPE, ul_debugobj(wp, " wiping..."));
-               blkid_wipe_all(pr);
-@@ -176,6 +177,8 @@ int fdisk_check_collisions(struct fdisk_context *cxt)
-       free(cxt->collision);
-       cxt->collision = NULL;
- 
-+      blkid_probe_set_sectorsize(pr, cxt->sector_size);
-+
-       blkid_probe_enable_superblocks(pr, 1);
-       blkid_probe_set_superblocks_flags(pr, BLKID_SUBLKS_TYPE |
-                                             BLKID_SUBLKS_BADCSUM);
-
-From 54f9a79301dcf492cab8e07134f96a921d367aa0 Mon Sep 17 00:00:00 2001
-From: Karel Zak <k...@redhat.com>
-Date: Mon, 14 Oct 2024 15:47:03 +0200
-Subject: [PATCH 2/4] fdisk: (man) improve --sector-size description
-
-Signed-off-by: Karel Zak <k...@redhat.com>
----
- disk-utils/fdisk.8.adoc | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/disk-utils/fdisk.8.adoc b/disk-utils/fdisk.8.adoc
-index cb72b4a3ea5..5941aa34968 100644
---- a/disk-utils/fdisk.8.adoc
-+++ b/disk-utils/fdisk.8.adoc
-@@ -40,7 +40,7 @@ Note that *partx*(8) provides a rich interface for scripts 
to print disk layouts
- == OPTIONS
- 
- *-b*, *--sector-size* _sectorsize_::
--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_.
-+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_.
- 
- *-B*, *--protect-boot*::
- Don't erase the beginning of the first disk sector when creating a new disk 
label. This feature is supported for GPT and MBR.
-
-From fd38ee2274f7a30393d3839dfce556260355c3fa Mon Sep 17 00:00:00 2001
-From: Karel Zak <k...@redhat.com>
-Date: Mon, 14 Oct 2024 15:48:46 +0200
-Subject: [PATCH 3/4] cfdisk: add --sector-size commanand line option
-
-* improves compatibility with fdisk
-* add ability to work with disk images where libfdisk defaults to 512
-
-Signed-off-by: Karel Zak <k...@redhat.com>
----
- disk-utils/cfdisk.8.adoc |  3 +++
- disk-utils/cfdisk.c      | 15 ++++++++++++++-
- 2 files changed, 17 insertions(+), 1 deletion(-)
-
-diff --git a/disk-utils/cfdisk.8.adoc b/disk-utils/cfdisk.8.adoc
-index 97fad621d12..759f39f0e1a 100644
---- a/disk-utils/cfdisk.8.adoc
-+++ b/disk-utils/cfdisk.8.adoc
-@@ -55,6 +55,9 @@ Use exclusive BSD lock for device or file it operates. The 
optional argument _mo
- *-r*, *--read-only*::
- Forced open in read-only mode.
- 
-+*-b*, *--sector-size* _sectorsize_::
-+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_.
-+
- *-z*, *--zero*::
- 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.
- 
-diff --git a/disk-utils/cfdisk.c b/disk-utils/cfdisk.c
-index 2e0aada474a..bc1c87d83e4 100644
---- a/disk-utils/cfdisk.c
-+++ b/disk-utils/cfdisk.c
-@@ -2731,6 +2731,8 @@ static void __attribute__((__noreturn__)) usage(void)
-             _("     --lock[=<mode>]      use exclusive device lock (%s, %s or 
%s)\n"), "yes", "no", "nonblock");
-       fputs(_(" -r, --read-only          forced open cfdisk in read-only 
mode\n"), out);
- 
-+      fputs(_(" -b, --sector-size <size> physical and logical sector 
size\n"), out);
-+
-       fputs(USAGE_SEPARATOR, out);
-       fprintf(out, USAGE_HELP_OPTIONS(26));
- 
-@@ -2743,6 +2745,7 @@ int main(int argc, char *argv[])
-       const char *diskpath = NULL, *lockmode = NULL;
-       int rc, c, colormode = UL_COLORMODE_UNDEF;
-       int read_only = 0;
-+      size_t user_ss = 0;
-       struct cfdisk _cf = { .lines_idx = 0 },
-                     *cf = &_cf;
-       enum {
-@@ -2752,6 +2755,7 @@ int main(int argc, char *argv[])
-               { "color",   optional_argument, NULL, 'L' },
-               { "lock",    optional_argument, NULL, OPT_LOCK },
-               { "help",    no_argument,       NULL, 'h' },
-+              { "sector-size", required_argument, NULL, 'b' },
-               { "version", no_argument,       NULL, 'V' },
-               { "zero",    no_argument,       NULL, 'z' },
-               { "read-only", no_argument,     NULL, 'r' },
-@@ -2763,8 +2767,15 @@ int main(int argc, char *argv[])
-       textdomain(PACKAGE);
-       close_stdout_atexit();
- 
--      while((c = getopt_long(argc, argv, "L::hVzr", longopts, NULL)) != -1) {
-+      while((c = getopt_long(argc, argv, "b:L::hVzr", longopts, NULL)) != -1) 
{
-               switch(c) {
-+              case 'b':
-+                      user_ss = strtou32_or_err(optarg,
-+                                      _("invalid sector size argument"));
-+                      if (user_ss != 512 && user_ss != 1024 &&
-+                          user_ss != 2048 && user_ss != 4096)
-+                              errx(EXIT_FAILURE, _("invalid sector size 
argument"));
-+                      break;
-               case 'h':
-                       usage();
-                       break;
-@@ -2803,6 +2814,8 @@ int main(int argc, char *argv[])
-       cf->cxt = fdisk_new_context();
-       if (!cf->cxt)
-               err(EXIT_FAILURE, _("failed to allocate libfdisk context"));
-+      if (user_ss)
-+              fdisk_save_user_sector_size(cf->cxt, user_ss, user_ss);
- 
-       fdisk_set_ask(cf->cxt, ask_callback, (void *) cf);
- 
-
-From ef7b76baa17ddb5414691fa8f49d61415c30871c Mon Sep 17 00:00:00 2001
-From: Karel Zak <k...@redhat.com>
-Date: Mon, 14 Oct 2024 15:50:40 +0200
-Subject: [PATCH 4/4] sfdisk: add --sector-size commanand line option
-
-* improves compatibility with fdisk
-* add ability to work with disk images where libfdisk defaults to 512
-
-Addresses: https://github.com/util-linux/util-linux/pull/3235
-Signed-off-by: Karel Zak <k...@redhat.com>
----
- disk-utils/sfdisk.8.adoc |  5 ++++-
- disk-utils/sfdisk.c      | 14 ++++++++++++++
- 2 files changed, 18 insertions(+), 1 deletion(-)
-
-diff --git a/disk-utils/sfdisk.8.adoc b/disk-utils/sfdisk.8.adoc
-index 26ccad5a3b2..ce9e97b7682 100644
---- a/disk-utils/sfdisk.8.adoc
-+++ b/disk-utils/sfdisk.8.adoc
-@@ -208,6 +208,9 @@ The default list of columns may be extended if _list_ is 
specified in the format
- *-q*, *--quiet*::
- Suppress extra info messages.
- 
-+*--sector-size* _sectorsize_::
-+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_.
-+
- *-u*, *--unit S*::
- Deprecated option. Only the sector unit is supported. This option is not 
supported when using the *--show-size* command.
- 
-@@ -256,7 +259,7 @@ Specify the maximal number of GPT partitions.
- *grain*::
- 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.
- *sector-size*::
--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.
-+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.
- 
- Note that it is only possible to use header lines before the first partition 
is specified in the input.
- 
-diff --git a/disk-utils/sfdisk.c b/disk-utils/sfdisk.c
-index cf402007b51..5e7c1d926e4 100644
---- a/disk-utils/sfdisk.c
-+++ b/disk-utils/sfdisk.c
-@@ -2155,6 +2155,8 @@ static void __attribute__((__noreturn__)) usage(void)
-             _("     --color[=<when>]      colorize output (%s, %s or %s)\n"), 
"auto", "always", "never");
-       fprintf(out,
-               "                             %s\n", USAGE_COLORS_DEFAULT);
-+      fputs(_("     --sector-size <size>  physical and logical sector 
size\n"), out);
-+
-       fprintf(out,
-             _("     --lock[=<mode>]       use exclusive device lock (%s, %s 
or %s)\n"), "yes", "no", "nonblock");
-       fputs(_(" -N, --partno <num>        specify partition number\n"), out);
-@@ -2191,6 +2193,7 @@ int main(int argc, char *argv[])
-       const char *outarg = NULL;
-       int rc = -EINVAL, c, longidx = -1, bytes = 0;
-       int colormode = UL_COLORMODE_UNDEF;
-+      size_t user_ss = 0;
-       struct sfdisk _sf = {
-               .partno = -1,
-               .wipemode = WIPEMODE_AUTO,
-@@ -2217,6 +2220,7 @@ int main(int argc, char *argv[])
-               OPT_NOTELL,
-               OPT_RELOCATE,
-               OPT_LOCK,
-+              OPT_SECTORSIZE
-       };
- 
-       static const struct option longopts[] = {
-@@ -2246,6 +2250,7 @@ int main(int argc, char *argv[])
-               { "output",  required_argument, NULL, 'o' },
-               { "partno",  required_argument, NULL, 'N' },
-               { "reorder", no_argument,       NULL, 'r' },
-+              { "sector-size", required_argument, NULL, OPT_SECTORSIZE },
-               { "show-geometry", no_argument, NULL, 'g' },
-               { "quiet",   no_argument,       NULL, 'q' },
-               { "verify",  no_argument,       NULL, 'V' },
-@@ -2450,6 +2455,13 @@ int main(int argc, char *argv[])
-                               sf->lockmode = optarg;
-                       }
-                       break;
-+              case OPT_SECTORSIZE:
-+                      user_ss = strtou32_or_err(optarg,
-+                                      _("invalid sector size argument"));
-+                      if (user_ss != 512 && user_ss != 1024 &&
-+                          user_ss != 2048 && user_ss != 4096)
-+                              errx(EXIT_FAILURE, _("invalid sector size 
argument"));
-+                      break;
-               default:
-                       errtryhelp(EXIT_FAILURE);
-               }
-@@ -2460,6 +2472,8 @@ int main(int argc, char *argv[])
-       sfdisk_init(sf);
-       if (bytes)
-               fdisk_set_size_unit(sf->cxt, FDISK_SIZEUNIT_BYTES);
-+      if (user_ss)
-+              fdisk_save_user_sector_size(sf->cxt, user_ss, user_ss);
- 
-       if (outarg)
-               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
similarity index 100%
rename from meta/recipes-core/util-linux/util-linux_2.40.2.bb
rename to meta/recipes-core/util-linux/util-linux_2.40.4.bb
-- 
2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#211377): 
https://lists.openembedded.org/g/openembedded-core/message/211377
Mute This Topic: https://lists.openembedded.org/mt/111179335/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to