mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH] gptfdisk: add new package
@ 2025-01-24 19:06 Jonas Rebmann
  2025-01-29 14:24 ` Roland Hieber
  0 siblings, 1 reply; 4+ messages in thread
From: Jonas Rebmann @ 2025-01-24 19:06 UTC (permalink / raw)
  To: ptxdist; +Cc: Jonas Rebmann

GPT fdisk is a set of tools to work with GUID partition tables: gdisk,
cgdisk, sgdisk and fixparts

Of particular interest to embedded devices is sgdisk, the noninteractive
tool, which, amongst other functionality, allows relocating the backup
(alternative) GPT header to the end of the disk. This may be needed
after flashing a GPT disk image created for a smaller disk size e.g. to
account for fluctuation in disk size amongst hardware revisions.

The curses based cgdisk makes use of the wide char ncurses variant. As
ptxdist currently, unlike some linux distributions, does not set up
ncursesw/ncurses.h as a symlink to ncurses.h, gptfdisk is patched to
include ncurses from the standard path.

Signed-off-by: Jonas Rebmann <jre@pengutronix.de>
---
 ...urses-never-include-ncurses-from-ncursesw.patch | 24 +++++++
 patches/gptfdisk-1.0.10/series                     |  4 ++
 rules/gptfdisk.in                                  | 42 +++++++++++
 rules/gptfdisk.make                                | 82 ++++++++++++++++++++++
 4 files changed, 152 insertions(+)

diff --git a/patches/gptfdisk-1.0.10/0001-gptcurses-never-include-ncurses-from-ncursesw.patch b/patches/gptfdisk-1.0.10/0001-gptcurses-never-include-ncurses-from-ncursesw.patch
new file mode 100644
index 0000000000000000000000000000000000000000..f320e8eb1802e8b15418c5a57fa53a05d99a21c1
--- /dev/null
+++ b/patches/gptfdisk-1.0.10/0001-gptcurses-never-include-ncurses-from-ncursesw.patch
@@ -0,0 +1,24 @@
+From: Jonas Rebmann <jre@pengutronix.de>
+Date: Fri, 24 Jan 2025 15:21:29 +0100
+Subject: [PATCH] gptcurses: never include ncurses from ncursesw
+
+---
+ gptcurses.cc | 4 ----
+ 1 file changed, 4 deletions(-)
+
+diff --git a/gptcurses.cc b/gptcurses.cc
+index b47670094d73..476fc43d6cdb 100644
+--- a/gptcurses.cc
++++ b/gptcurses.cc
+@@ -23,11 +23,7 @@
+ #include <iostream>
+ #include <string>
+ #include <sstream>
+-#if defined (__APPLE__) || (__FreeBSD__)
+ #include <ncurses.h>
+-#else
+-#include <ncursesw/ncurses.h>
+-#endif
+ #include "gptcurses.h"
+ #include "support.h"
+ 
diff --git a/patches/gptfdisk-1.0.10/series b/patches/gptfdisk-1.0.10/series
new file mode 100644
index 0000000000000000000000000000000000000000..d8006ace5377ef0eeb23e2e3e4174474a53560b6
--- /dev/null
+++ b/patches/gptfdisk-1.0.10/series
@@ -0,0 +1,4 @@
+# generated by git-ptx-patches
+#tag:base --start-number 1
+0001-gptcurses-never-include-ncurses-from-ncursesw.patch
+# f271468e860c32391bf01fdd0d73b3ac  - git-ptx-patches magic
diff --git a/rules/gptfdisk.in b/rules/gptfdisk.in
new file mode 100644
index 0000000000000000000000000000000000000000..6632effd34e7ad30f06cc93f3f57b8b3ceffc9a3
--- /dev/null
+++ b/rules/gptfdisk.in
@@ -0,0 +1,42 @@
+## SECTION=disk_and_file
+
+config GPTFDISK
+	tristate
+	prompt "gptfdisk"
+	select LIBUUID
+	select LIBPOPT			if GPTFDISK_SGDISK
+	select NCURSES			if GPTFDISK_CGDISK
+	select NCURSES_WIDE_CHAR	if GPTFDISK_CGDISK
+	help
+	  GPT fdisk is a set of text-mode partitioning tools. The gdisk,
+	  cgdisk, and sgdisk programs work on Globally Unique Identifier (GUID)
+	  Partition Table (GPT) disks, rather than on the older (and once more
+	  common) Master Boot Record (MBR) partition tables.
+
+if GPTFDISK
+
+config GPTFDISK_GDISK
+	bool
+	prompt "gdisk"
+	help
+	  Interactive GUID partition table (GPT) manipulator
+
+config GPTFDISK_CGDISK
+	bool
+	prompt "cgdisk"
+	help
+	  Curses-based GUID partition table (GPT) manipulator
+
+config GPTFDISK_SGDISK
+	bool
+	prompt "sgdisk"
+	help
+	  Command-line GUID partition table (GPT) manipulator for Linux and Unix
+
+config GPTFDISK_FIXPARTS
+	bool
+	prompt "fixparts"
+	help
+ 	  MBR partition table repair utility
+
+endif
diff --git a/rules/gptfdisk.make b/rules/gptfdisk.make
new file mode 100644
index 0000000000000000000000000000000000000000..29455dc9332bbe33ac14afb37c170dab2ceeb35e
--- /dev/null
+++ b/rules/gptfdisk.make
@@ -0,0 +1,82 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2025 by Jonas Rebmann <jre@pengutronix.de>
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+#
+# We provide this package
+#
+PACKAGES-$(PTXCONF_GPTFDISK) += gptfdisk
+
+#
+# Paths and names
+#
+GPTFDISK_VERSION	:= 1.0.10
+GPTFDISK_MD5		:= 1970269eb7a97560e238611524b7797a
+GPTFDISK		:= gptfdisk-$(GPTFDISK_VERSION)
+GPTFDISK_SUFFIX		:= tar.gz
+GPTFDISK_URL		:= https://downloads.sourceforge.net/project/gptfdisk/gptfdisk/$(GPTFDISK_VERSION)/$(GPTFDISK).$(GPTFDISK_SUFFIX)
+GPTFDISK_SOURCE		:= $(SRCDIR)/$(GPTFDISK).$(GPTFDISK_SUFFIX)
+GPTFDISK_DIR		:= $(BUILDDIR)/$(GPTFDISK)
+GPTFDISK_LICENSE	:= GPL-2.0-only
+GPTFDISK_LICENSE_FILES	:= file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552
+
+# ----------------------------------------------------------------------------
+# Prepare
+# ----------------------------------------------------------------------------
+
+GPTFDISK_TOOLS-$(PTXCONF_GPTFDISK_GDISK)	+= gdisk
+GPTFDISK_TOOLS-$(PTXCONF_GPTFDISK_CGDISK)	+= cgdisk
+GPTFDISK_TOOLS-$(PTXCONF_GPTFDISK_SGDISK)	+= sgdisk
+GPTFDISK_TOOLS-$(PTXCONF_GPTFDISK_FIXPARTS)	+= fixparts
+
+ifeq ($(strip $(GPTFDISK_TOOLS-y)),)
+$(error At least one PTXCONF_GPTFDISK_* option must be enabled)
+endif
+
+GPTFDISK_CONF_TOOL	:= NO
+
+GPTFDISK_MAKE_ENV	:= \
+	$(CROSS_ENV) \
+	PREFIX=/usr
+
+GPTFDISK_MAKE_OPT	:= \
+	TARGET=linux \
+	$(GPTFDISK_TOOLS-y)
+
+# ----------------------------------------------------------------------------
+# Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/gptfdisk.install:
+	@$(call targetinfo)
+	@$(call world/execute, GPTFDISK, \
+		install -m755 -v \
+		$(addprefix $(GPTFDISK_DIR)/,$(GPTFDISK_TOOLS-y)) \
+		$(GPTFDISK_PKGDIR)/usr/bin/)
+	@$(call touch)
+
+# ----------------------------------------------------------------------------
+# Target-Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/gptfdisk.targetinstall:
+	@$(call targetinfo)
+
+	@$(call install_init, gptfdisk)
+	@$(call install_fixup, gptfdisk,PRIORITY,optional)
+	@$(call install_fixup, gptfdisk,SECTION,base)
+	@$(call install_fixup, gptfdisk,AUTHOR,"Jonas Rebmann <jre@pengutronix.de>")
+	@$(call install_fixup, gptfdisk,DESCRIPTION,"GPT disk partitioning tools")
+
+	@$(foreach tool,$(GPTFDISK_TOOLS-y), \
+		$(call install_copy, gptfdisk, 0, 0, 0755, -, /usr/bin/$(tool))$(ptx/nl))
+
+	@$(call install_finish, gptfdisk)
+
+	@$(call touch)
+
+# vim: syntax=make

---
base-commit: 1b82c74e1f1f2048cb08a381def774ea2f8e7227
change-id: 20250124-gptfdisk-b77ce7d11992

Best regards,
-- 
Jonas Rebmann <jre@pengutronix.de>




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ptxdist] [PATCH] gptfdisk: add new package
  2025-01-24 19:06 [ptxdist] [PATCH] gptfdisk: add new package Jonas Rebmann
@ 2025-01-29 14:24 ` Roland Hieber
  2025-01-30  9:32   ` Jonas Rebmann
  2025-01-30 13:13   ` Michael Olbrich
  0 siblings, 2 replies; 4+ messages in thread
From: Roland Hieber @ 2025-01-29 14:24 UTC (permalink / raw)
  To: Jonas Rebmann; +Cc: ptxdist

On Fri, Jan 24, 2025 at 08:06:02PM +0100, Jonas Rebmann wrote:
> GPT fdisk is a set of tools to work with GUID partition tables: gdisk,
> cgdisk, sgdisk and fixparts
> 
> Of particular interest to embedded devices is sgdisk, the noninteractive
> tool, which, amongst other functionality, allows relocating the backup
> (alternative) GPT header to the end of the disk. This may be needed
> after flashing a GPT disk image created for a smaller disk size e.g. to
> account for fluctuation in disk size amongst hardware revisions.
> 
> The curses based cgdisk makes use of the wide char ncurses variant. As
> ptxdist currently, unlike some linux distributions, does not set up
> ncursesw/ncurses.h as a symlink to ncurses.h, gptfdisk is patched to
> include ncurses from the standard path.
> 
> Signed-off-by: Jonas Rebmann <jre@pengutronix.de>
> ---
>  ...urses-never-include-ncurses-from-ncursesw.patch | 24 +++++++
>  patches/gptfdisk-1.0.10/series                     |  4 ++
>  rules/gptfdisk.in                                  | 42 +++++++++++
>  rules/gptfdisk.make                                | 82 ++++++++++++++++++++++
>  4 files changed, 152 insertions(+)
> 
> diff --git a/patches/gptfdisk-1.0.10/0001-gptcurses-never-include-ncurses-from-ncursesw.patch b/patches/gptfdisk-1.0.10/0001-gptcurses-never-include-ncurses-from-ncursesw.patch
> new file mode 100644
> index 0000000000000000000000000000000000000000..f320e8eb1802e8b15418c5a57fa53a05d99a21c1
> --- /dev/null
> +++ b/patches/gptfdisk-1.0.10/0001-gptcurses-never-include-ncurses-from-ncursesw.patch
> @@ -0,0 +1,24 @@
> +From: Jonas Rebmann <jre@pengutronix.de>
> +Date: Fri, 24 Jan 2025 15:21:29 +0100
> +Subject: [PATCH] gptcurses: never include ncurses from ncursesw
> +
> +---
> + gptcurses.cc | 4 ----
> + 1 file changed, 4 deletions(-)
> +
> +diff --git a/gptcurses.cc b/gptcurses.cc
> +index b47670094d73..476fc43d6cdb 100644
> +--- a/gptcurses.cc
> ++++ b/gptcurses.cc
> +@@ -23,11 +23,7 @@
> + #include <iostream>
> + #include <string>
> + #include <sstream>
> +-#if defined (__APPLE__) || (__FreeBSD__)
> + #include <ncurses.h>
> +-#else
> +-#include <ncursesw/ncurses.h>
> +-#endif
> + #include "gptcurses.h"
> + #include "support.h"
> + 
> diff --git a/patches/gptfdisk-1.0.10/series b/patches/gptfdisk-1.0.10/series
> new file mode 100644
> index 0000000000000000000000000000000000000000..d8006ace5377ef0eeb23e2e3e4174474a53560b6
> --- /dev/null
> +++ b/patches/gptfdisk-1.0.10/series
> @@ -0,0 +1,4 @@
> +# generated by git-ptx-patches
> +#tag:base --start-number 1
> +0001-gptcurses-never-include-ncurses-from-ncursesw.patch
> +# f271468e860c32391bf01fdd0d73b3ac  - git-ptx-patches magic
> diff --git a/rules/gptfdisk.in b/rules/gptfdisk.in
> new file mode 100644
> index 0000000000000000000000000000000000000000..6632effd34e7ad30f06cc93f3f57b8b3ceffc9a3
> --- /dev/null
> +++ b/rules/gptfdisk.in
> @@ -0,0 +1,42 @@
> +## SECTION=disk_and_file
> +
> +config GPTFDISK
> +	tristate
> +	prompt "gptfdisk"
> +	select LIBUUID
> +	select LIBPOPT			if GPTFDISK_SGDISK
> +	select NCURSES			if GPTFDISK_CGDISK
> +	select NCURSES_WIDE_CHAR	if GPTFDISK_CGDISK
> +	help
> +	  GPT fdisk is a set of text-mode partitioning tools. The gdisk,
> +	  cgdisk, and sgdisk programs work on Globally Unique Identifier (GUID)
> +	  Partition Table (GPT) disks, rather than on the older (and once more
> +	  common) Master Boot Record (MBR) partition tables.
> +
> +if GPTFDISK
> +
> +config GPTFDISK_GDISK
> +	bool
> +	prompt "gdisk"
> +	help
> +	  Interactive GUID partition table (GPT) manipulator
> +
> +config GPTFDISK_CGDISK
> +	bool
> +	prompt "cgdisk"
> +	help
> +	  Curses-based GUID partition table (GPT) manipulator
> +
> +config GPTFDISK_SGDISK
> +	bool
> +	prompt "sgdisk"
> +	help
> +	  Command-line GUID partition table (GPT) manipulator for Linux and Unix
> +
> +config GPTFDISK_FIXPARTS
> +	bool
> +	prompt "fixparts"
> +	help
> + 	  MBR partition table repair utility
> +
> +endif
> diff --git a/rules/gptfdisk.make b/rules/gptfdisk.make
> new file mode 100644
> index 0000000000000000000000000000000000000000..29455dc9332bbe33ac14afb37c170dab2ceeb35e
> --- /dev/null
> +++ b/rules/gptfdisk.make
> @@ -0,0 +1,82 @@
> +# -*-makefile-*-
> +#
> +# Copyright (C) 2025 by Jonas Rebmann <jre@pengutronix.de>
> +#
> +# For further information about the PTXdist project and license conditions
> +# see the README file.
> +#
> +
> +#
> +# We provide this package
> +#
> +PACKAGES-$(PTXCONF_GPTFDISK) += gptfdisk
> +
> +#
> +# Paths and names
> +#
> +GPTFDISK_VERSION	:= 1.0.10
> +GPTFDISK_MD5		:= 1970269eb7a97560e238611524b7797a
> +GPTFDISK		:= gptfdisk-$(GPTFDISK_VERSION)
> +GPTFDISK_SUFFIX		:= tar.gz
> +GPTFDISK_URL		:= https://downloads.sourceforge.net/project/gptfdisk/gptfdisk/$(GPTFDISK_VERSION)/$(GPTFDISK).$(GPTFDISK_SUFFIX)
> +GPTFDISK_SOURCE		:= $(SRCDIR)/$(GPTFDISK).$(GPTFDISK_SUFFIX)
> +GPTFDISK_DIR		:= $(BUILDDIR)/$(GPTFDISK)
> +GPTFDISK_LICENSE	:= GPL-2.0-only
> +GPTFDISK_LICENSE_FILES	:= file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552
> +
> +# ----------------------------------------------------------------------------
> +# Prepare
> +# ----------------------------------------------------------------------------
> +
> +GPTFDISK_TOOLS-$(PTXCONF_GPTFDISK_GDISK)	+= gdisk
> +GPTFDISK_TOOLS-$(PTXCONF_GPTFDISK_CGDISK)	+= cgdisk
> +GPTFDISK_TOOLS-$(PTXCONF_GPTFDISK_SGDISK)	+= sgdisk
> +GPTFDISK_TOOLS-$(PTXCONF_GPTFDISK_FIXPARTS)	+= fixparts
> +
> +ifeq ($(strip $(GPTFDISK_TOOLS-y)),)
> +$(error At least one PTXCONF_GPTFDISK_* option must be enabled)
> +endif

As a bonus you could put a warning in the menu file:

    comment "At least one GPTFDISK_* option must be enabled!"
        depends on !GPTFDISK_GDISK && !GPTFDISK_CGDISK && !GPTFDISK_SGDISK && !GPTFDISK_FIXPARTS

(similar to the busybox vs. coreutils comments), but I think catching it in the
make file is sufficient as well.

> +
> +GPTFDISK_CONF_TOOL	:= NO
> +
> +GPTFDISK_MAKE_ENV	:= \
> +	$(CROSS_ENV) \
> +	PREFIX=/usr
> +
> +GPTFDISK_MAKE_OPT	:= \
> +	TARGET=linux \
> +	$(GPTFDISK_TOOLS-y)
> +
> +# ----------------------------------------------------------------------------
> +# Install
> +# ----------------------------------------------------------------------------
> +
> +$(STATEDIR)/gptfdisk.install:
> +	@$(call targetinfo)
> +	@$(call world/execute, GPTFDISK, \
> +		install -m755 -v \
> +		$(addprefix $(GPTFDISK_DIR)/,$(GPTFDISK_TOOLS-y)) \
> +		$(GPTFDISK_PKGDIR)/usr/bin/)
> +	@$(call touch)
> +
> +# ----------------------------------------------------------------------------
> +# Target-Install
> +# ----------------------------------------------------------------------------
> +
> +$(STATEDIR)/gptfdisk.targetinstall:
> +	@$(call targetinfo)
> +
> +	@$(call install_init, gptfdisk)
> +	@$(call install_fixup, gptfdisk,PRIORITY,optional)
> +	@$(call install_fixup, gptfdisk,SECTION,base)
> +	@$(call install_fixup, gptfdisk,AUTHOR,"Jonas Rebmann <jre@pengutronix.de>")
> +	@$(call install_fixup, gptfdisk,DESCRIPTION,"GPT disk partitioning tools")
> +
> +	@$(foreach tool,$(GPTFDISK_TOOLS-y), \
> +		$(call install_copy, gptfdisk, 0, 0, 0755, -, /usr/bin/$(tool))$(ptx/nl))
> +
> +	@$(call install_finish, gptfdisk)
> +
> +	@$(call touch)
> +
> +# vim: syntax=make

Reviewed-by: Roland Hieber <rhi@pengutronix.de>

 - Roland

> 
> ---
> base-commit: 1b82c74e1f1f2048cb08a381def774ea2f8e7227
> change-id: 20250124-gptfdisk-b77ce7d11992
> 
> Best regards,
> -- 
> Jonas Rebmann <jre@pengutronix.de>
> 
> 
> 

-- 
Roland Hieber, Pengutronix e.K.          | rhi@pengutronix.de          |
Steuerwalder Str. 21                     | https://www.pengutronix.de/ |
31137 Hildesheim, Germany                | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686         | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ptxdist] [PATCH] gptfdisk: add new package
  2025-01-29 14:24 ` Roland Hieber
@ 2025-01-30  9:32   ` Jonas Rebmann
  2025-01-30 13:13   ` Michael Olbrich
  1 sibling, 0 replies; 4+ messages in thread
From: Jonas Rebmann @ 2025-01-30  9:32 UTC (permalink / raw)
  To: ptxdist, Roland Hieber

Hi,

On 29/01/2025 15.24, Roland Hieber wrote:
> On Fri, Jan 24, 2025 at 08:06:02PM +0100, Jonas Rebmann wrote:
>> GPT fdisk is a set of tools to work with GUID partition tables: gdisk,
>> cgdisk, sgdisk and fixparts

The Patch is not ready for merge.

>> Of particular interest to embedded devices is sgdisk, the noninteractive
>> tool, which, amongst other functionality, allows relocating the backup
>> (alternative) GPT header to the end of the disk. This may be needed
>> after flashing a GPT disk image created for a smaller disk size e.g. to
>> account for fluctuation in disk size amongst hardware revisions.
>>
>> The curses based cgdisk makes use of the wide char ncurses variant. As
>> ptxdist currently, unlike some linux distributions, does not set up
>> ncursesw/ncurses.h as a symlink to ncurses.h, gptfdisk is patched to
>> include ncurses from the standard path.
>>
>> Signed-off-by: Jonas Rebmann <jre@pengutronix.de>
>> ---
>>   ...urses-never-include-ncurses-from-ncursesw.patch | 24 +++++++
>>   patches/gptfdisk-1.0.10/series                     |  4 ++
>>   rules/gptfdisk.in                                  | 42 +++++++++++
>>   rules/gptfdisk.make                                | 82 ++++++++++++++++++++++
>>   4 files changed, 152 insertions(+)
>>
>> diff --git a/patches/gptfdisk-1.0.10/0001-gptcurses-never-include-ncurses-from-ncursesw.patch b/patches/gptfdisk-1.0.10/0001-gptcurses-never-include-ncurses-from-ncursesw.patch
>> new file mode 100644
>> index 0000000000000000000000000000000000000000..f320e8eb1802e8b15418c5a57fa53a05d99a21c1
>> --- /dev/null
>> +++ b/patches/gptfdisk-1.0.10/0001-gptcurses-never-include-ncurses-from-ncursesw.patch
>> @@ -0,0 +1,24 @@
>> +From: Jonas Rebmann <jre@pengutronix.de>
>> +Date: Fri, 24 Jan 2025 15:21:29 +0100
>> +Subject: [PATCH] gptcurses: never include ncurses from ncursesw
>> +
>> +---
>> + gptcurses.cc | 4 ----
>> + 1 file changed, 4 deletions(-)
>> +
>> +diff --git a/gptcurses.cc b/gptcurses.cc
>> +index b47670094d73..476fc43d6cdb 100644
>> +--- a/gptcurses.cc
>> ++++ b/gptcurses.cc
>> +@@ -23,11 +23,7 @@
>> + #include <iostream>
>> + #include <string>
>> + #include <sstream>
>> +-#if defined (__APPLE__) || (__FreeBSD__)
>> + #include <ncurses.h>
>> +-#else
>> +-#include <ncursesw/ncurses.h>
>> +-#endif
>> + #include "gptcurses.h"
>> + #include "support.h"
>> +
>> diff --git a/patches/gptfdisk-1.0.10/series b/patches/gptfdisk-1.0.10/series
>> new file mode 100644
>> index 0000000000000000000000000000000000000000..d8006ace5377ef0eeb23e2e3e4174474a53560b6
>> --- /dev/null
>> +++ b/patches/gptfdisk-1.0.10/series
>> @@ -0,0 +1,4 @@
>> +# generated by git-ptx-patches
>> +#tag:base --start-number 1
>> +0001-gptcurses-never-include-ncurses-from-ncursesw.patch
>> +# f271468e860c32391bf01fdd0d73b3ac  - git-ptx-patches magic
>> diff --git a/rules/gptfdisk.in b/rules/gptfdisk.in
>> new file mode 100644
>> index 0000000000000000000000000000000000000000..6632effd34e7ad30f06cc93f3f57b8b3ceffc9a3
>> --- /dev/null
>> +++ b/rules/gptfdisk.in
>> @@ -0,0 +1,42 @@
>> +## SECTION=disk_and_file
>> +
>> +config GPTFDISK
>> +	tristate
>> +	prompt "gptfdisk"
>> +	select LIBUUID
>> +	select LIBPOPT			if GPTFDISK_SGDISK
>> +	select NCURSES			if GPTFDISK_CGDISK
>> +	select NCURSES_WIDE_CHAR	if GPTFDISK_CGDISK
>> +	help
>> +	  GPT fdisk is a set of text-mode partitioning tools. The gdisk,
>> +	  cgdisk, and sgdisk programs work on Globally Unique Identifier (GUID)
>> +	  Partition Table (GPT) disks, rather than on the older (and once more
>> +	  common) Master Boot Record (MBR) partition tables.
>> +
>> +if GPTFDISK
>> +
>> +config GPTFDISK_GDISK
>> +	bool
>> +	prompt "gdisk"
>> +	help
>> +	  Interactive GUID partition table (GPT) manipulator
>> +
>> +config GPTFDISK_CGDISK
>> +	bool
>> +	prompt "cgdisk"
>> +	help
>> +	  Curses-based GUID partition table (GPT) manipulator
>> +
>> +config GPTFDISK_SGDISK
>> +	bool
>> +	prompt "sgdisk"
>> +	help
>> +	  Command-line GUID partition table (GPT) manipulator for Linux and Unix
>> +
>> +config GPTFDISK_FIXPARTS
>> +	bool
>> +	prompt "fixparts"
>> +	help
>> + 	  MBR partition table repair utility
>> +
>> +endif
>> diff --git a/rules/gptfdisk.make b/rules/gptfdisk.make
>> new file mode 100644
>> index 0000000000000000000000000000000000000000..29455dc9332bbe33ac14afb37c170dab2ceeb35e
>> --- /dev/null
>> +++ b/rules/gptfdisk.make
>> @@ -0,0 +1,82 @@
>> +# -*-makefile-*-
>> +#
>> +# Copyright (C) 2025 by Jonas Rebmann <jre@pengutronix.de>
>> +#
>> +# For further information about the PTXdist project and license conditions
>> +# see the README file.
>> +#
>> +
>> +#
>> +# We provide this package
>> +#
>> +PACKAGES-$(PTXCONF_GPTFDISK) += gptfdisk
>> +
>> +#
>> +# Paths and names
>> +#
>> +GPTFDISK_VERSION	:= 1.0.10
>> +GPTFDISK_MD5		:= 1970269eb7a97560e238611524b7797a
>> +GPTFDISK		:= gptfdisk-$(GPTFDISK_VERSION)
>> +GPTFDISK_SUFFIX		:= tar.gz
>> +GPTFDISK_URL		:= https://downloads.sourceforge.net/project/gptfdisk/gptfdisk/$(GPTFDISK_VERSION)/$(GPTFDISK).$(GPTFDISK_SUFFIX)
>> +GPTFDISK_SOURCE		:= $(SRCDIR)/$(GPTFDISK).$(GPTFDISK_SUFFIX)
>> +GPTFDISK_DIR		:= $(BUILDDIR)/$(GPTFDISK)
>> +GPTFDISK_LICENSE	:= GPL-2.0-only
>> +GPTFDISK_LICENSE_FILES	:= file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552
>> +
>> +# ----------------------------------------------------------------------------
>> +# Prepare
>> +# ----------------------------------------------------------------------------
>> +
>> +GPTFDISK_TOOLS-$(PTXCONF_GPTFDISK_GDISK)	+= gdisk
>> +GPTFDISK_TOOLS-$(PTXCONF_GPTFDISK_CGDISK)	+= cgdisk
>> +GPTFDISK_TOOLS-$(PTXCONF_GPTFDISK_SGDISK)	+= sgdisk
>> +GPTFDISK_TOOLS-$(PTXCONF_GPTFDISK_FIXPARTS)	+= fixparts
>> +
>> +ifeq ($(strip $(GPTFDISK_TOOLS-y)),)
>> +$(error At least one PTXCONF_GPTFDISK_* option must be enabled)
>> +endif
> 
> As a bonus you could put a warning in the menu file:
> 
>      comment "At least one GPTFDISK_* option must be enabled!"
>          depends on !GPTFDISK_GDISK && !GPTFDISK_CGDISK && !GPTFDISK_SGDISK && !GPTFDISK_FIXPARTS
> 
> (similar to the busybox vs. coreutils comments), but I think catching it in the
> make file is sufficient as well.

I will consider it. Will create a v2 anyway because we noticed the 
present check may be evaluated when PTXCONF_GPTFDISK is unselected, 
leading to ptxdist erroring solely because the rule is present.

>> +
>> +GPTFDISK_CONF_TOOL	:= NO
>> +
>> +GPTFDISK_MAKE_ENV	:= \
>> +	$(CROSS_ENV) \
>> +	PREFIX=/usr
>> +
>> +GPTFDISK_MAKE_OPT	:= \
>> +	TARGET=linux \
>> +	$(GPTFDISK_TOOLS-y)
>> +
>> +# ----------------------------------------------------------------------------
>> +# Install
>> +# ----------------------------------------------------------------------------
>> +
>> +$(STATEDIR)/gptfdisk.install:
>> +	@$(call targetinfo)
>> +	@$(call world/execute, GPTFDISK, \
>> +		install -m755 -v \
>> +		$(addprefix $(GPTFDISK_DIR)/,$(GPTFDISK_TOOLS-y)) \
>> +		$(GPTFDISK_PKGDIR)/usr/bin/)
>> +	@$(call touch)
>> +
>> +# ----------------------------------------------------------------------------
>> +# Target-Install
>> +# ----------------------------------------------------------------------------
>> +
>> +$(STATEDIR)/gptfdisk.targetinstall:
>> +	@$(call targetinfo)
>> +
>> +	@$(call install_init, gptfdisk)
>> +	@$(call install_fixup, gptfdisk,PRIORITY,optional)
>> +	@$(call install_fixup, gptfdisk,SECTION,base)
>> +	@$(call install_fixup, gptfdisk,AUTHOR,"Jonas Rebmann <jre@pengutronix.de>")
>> +	@$(call install_fixup, gptfdisk,DESCRIPTION,"GPT disk partitioning tools")
>> +
>> +	@$(foreach tool,$(GPTFDISK_TOOLS-y), \
>> +		$(call install_copy, gptfdisk, 0, 0, 0755, -, /usr/bin/$(tool))$(ptx/nl))
>> +
>> +	@$(call install_finish, gptfdisk)
>> +
>> +	@$(call touch)
>> +
>> +# vim: syntax=make
> 
> Reviewed-by: Roland Hieber <rhi@pengutronix.de>
> 
>   - Roland
> 
>>
>> ---
>> base-commit: 1b82c74e1f1f2048cb08a381def774ea2f8e7227
>> change-id: 20250124-gptfdisk-b77ce7d11992
>>
>> Best regards,
>> -- 
>> Jonas Rebmann <jre@pengutronix.de>
>>
>>
>>
> 


-- 
Pengutronix e.K.                          | Jonas Rebmann               |
Steuerwalder Str. 21                      | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                 | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686          | Fax:   +49-5121-206917-9    |



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ptxdist] [PATCH] gptfdisk: add new package
  2025-01-29 14:24 ` Roland Hieber
  2025-01-30  9:32   ` Jonas Rebmann
@ 2025-01-30 13:13   ` Michael Olbrich
  1 sibling, 0 replies; 4+ messages in thread
From: Michael Olbrich @ 2025-01-30 13:13 UTC (permalink / raw)
  To: Roland Hieber; +Cc: Jonas Rebmann, ptxdist

On Wed, Jan 29, 2025 at 03:24:14PM +0100, Roland Hieber wrote:
> On Fri, Jan 24, 2025 at 08:06:02PM +0100, Jonas Rebmann wrote:
> > GPT fdisk is a set of tools to work with GUID partition tables: gdisk,
> > cgdisk, sgdisk and fixparts
> > 
> > Of particular interest to embedded devices is sgdisk, the noninteractive
> > tool, which, amongst other functionality, allows relocating the backup
> > (alternative) GPT header to the end of the disk. This may be needed
> > after flashing a GPT disk image created for a smaller disk size e.g. to
> > account for fluctuation in disk size amongst hardware revisions.
> > 
> > The curses based cgdisk makes use of the wide char ncurses variant. As
> > ptxdist currently, unlike some linux distributions, does not set up
> > ncursesw/ncurses.h as a symlink to ncurses.h, gptfdisk is patched to
> > include ncurses from the standard path.
> > 
> > Signed-off-by: Jonas Rebmann <jre@pengutronix.de>
> > ---
> >  ...urses-never-include-ncurses-from-ncursesw.patch | 24 +++++++
> >  patches/gptfdisk-1.0.10/series                     |  4 ++
> >  rules/gptfdisk.in                                  | 42 +++++++++++
> >  rules/gptfdisk.make                                | 82 ++++++++++++++++++++++
> >  4 files changed, 152 insertions(+)
> > 
> > diff --git a/patches/gptfdisk-1.0.10/0001-gptcurses-never-include-ncurses-from-ncursesw.patch b/patches/gptfdisk-1.0.10/0001-gptcurses-never-include-ncurses-from-ncursesw.patch
> > new file mode 100644
> > index 0000000000000000000000000000000000000000..f320e8eb1802e8b15418c5a57fa53a05d99a21c1
> > --- /dev/null
> > +++ b/patches/gptfdisk-1.0.10/0001-gptcurses-never-include-ncurses-from-ncursesw.patch
> > @@ -0,0 +1,24 @@
> > +From: Jonas Rebmann <jre@pengutronix.de>
> > +Date: Fri, 24 Jan 2025 15:21:29 +0100
> > +Subject: [PATCH] gptcurses: never include ncurses from ncursesw
> > +
> > +---
> > + gptcurses.cc | 4 ----
> > + 1 file changed, 4 deletions(-)
> > +
> > +diff --git a/gptcurses.cc b/gptcurses.cc
> > +index b47670094d73..476fc43d6cdb 100644
> > +--- a/gptcurses.cc
> > ++++ b/gptcurses.cc
> > +@@ -23,11 +23,7 @@
> > + #include <iostream>
> > + #include <string>
> > + #include <sstream>
> > +-#if defined (__APPLE__) || (__FreeBSD__)
> > + #include <ncurses.h>
> > +-#else
> > +-#include <ncursesw/ncurses.h>
> > +-#endif
> > + #include "gptcurses.h"
> > + #include "support.h"
> > + 
> > diff --git a/patches/gptfdisk-1.0.10/series b/patches/gptfdisk-1.0.10/series
> > new file mode 100644
> > index 0000000000000000000000000000000000000000..d8006ace5377ef0eeb23e2e3e4174474a53560b6
> > --- /dev/null
> > +++ b/patches/gptfdisk-1.0.10/series
> > @@ -0,0 +1,4 @@
> > +# generated by git-ptx-patches
> > +#tag:base --start-number 1
> > +0001-gptcurses-never-include-ncurses-from-ncursesw.patch
> > +# f271468e860c32391bf01fdd0d73b3ac  - git-ptx-patches magic
> > diff --git a/rules/gptfdisk.in b/rules/gptfdisk.in
> > new file mode 100644
> > index 0000000000000000000000000000000000000000..6632effd34e7ad30f06cc93f3f57b8b3ceffc9a3
> > --- /dev/null
> > +++ b/rules/gptfdisk.in
> > @@ -0,0 +1,42 @@
> > +## SECTION=disk_and_file
> > +
> > +config GPTFDISK

This should be menuconfig and ... 

> > +	tristate
> > +	prompt "gptfdisk"

	prompt "gptfdisk        "

(add enough spaces to align the '->' in 'ptxdist menuconfig').

> > +	select LIBUUID
> > +	select LIBPOPT			if GPTFDISK_SGDISK
> > +	select NCURSES			if GPTFDISK_CGDISK
> > +	select NCURSES_WIDE_CHAR	if GPTFDISK_CGDISK
> > +	help
> > +	  GPT fdisk is a set of text-mode partitioning tools. The gdisk,
> > +	  cgdisk, and sgdisk programs work on Globally Unique Identifier (GUID)
> > +	  Partition Table (GPT) disks, rather than on the older (and once more
> > +	  common) Master Boot Record (MBR) partition tables.
> > +
> > +if GPTFDISK
> > +
> > +config GPTFDISK_GDISK
> > +	bool
> > +	prompt "gdisk"
> > +	help
> > +	  Interactive GUID partition table (GPT) manipulator
> > +
> > +config GPTFDISK_CGDISK
> > +	bool
> > +	prompt "cgdisk"
> > +	help
> > +	  Curses-based GUID partition table (GPT) manipulator
> > +
> > +config GPTFDISK_SGDISK
> > +	bool
> > +	prompt "sgdisk"
> > +	help
> > +	  Command-line GUID partition table (GPT) manipulator for Linux and Unix
> > +
> > +config GPTFDISK_FIXPARTS
> > +	bool
> > +	prompt "fixparts"
> > +	help
> > + 	  MBR partition table repair utility
> > +
> > +endif
> > diff --git a/rules/gptfdisk.make b/rules/gptfdisk.make
> > new file mode 100644
> > index 0000000000000000000000000000000000000000..29455dc9332bbe33ac14afb37c170dab2ceeb35e
> > --- /dev/null
> > +++ b/rules/gptfdisk.make
> > @@ -0,0 +1,82 @@
> > +# -*-makefile-*-
> > +#
> > +# Copyright (C) 2025 by Jonas Rebmann <jre@pengutronix.de>
> > +#
> > +# For further information about the PTXdist project and license conditions
> > +# see the README file.
> > +#
> > +
> > +#
> > +# We provide this package
> > +#
> > +PACKAGES-$(PTXCONF_GPTFDISK) += gptfdisk
> > +
> > +#
> > +# Paths and names
> > +#
> > +GPTFDISK_VERSION	:= 1.0.10
> > +GPTFDISK_MD5		:= 1970269eb7a97560e238611524b7797a
> > +GPTFDISK		:= gptfdisk-$(GPTFDISK_VERSION)
> > +GPTFDISK_SUFFIX		:= tar.gz
> > +GPTFDISK_URL		:= https://downloads.sourceforge.net/project/gptfdisk/gptfdisk/$(GPTFDISK_VERSION)/$(GPTFDISK).$(GPTFDISK_SUFFIX)
> > +GPTFDISK_SOURCE		:= $(SRCDIR)/$(GPTFDISK).$(GPTFDISK_SUFFIX)
> > +GPTFDISK_DIR		:= $(BUILDDIR)/$(GPTFDISK)
> > +GPTFDISK_LICENSE	:= GPL-2.0-only
> > +GPTFDISK_LICENSE_FILES	:= file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552
> > +
> > +# ----------------------------------------------------------------------------
> > +# Prepare
> > +# ----------------------------------------------------------------------------
> > +
> > +GPTFDISK_TOOLS-$(PTXCONF_GPTFDISK_GDISK)	+= gdisk
> > +GPTFDISK_TOOLS-$(PTXCONF_GPTFDISK_CGDISK)	+= cgdisk
> > +GPTFDISK_TOOLS-$(PTXCONF_GPTFDISK_SGDISK)	+= sgdisk
> > +GPTFDISK_TOOLS-$(PTXCONF_GPTFDISK_FIXPARTS)	+= fixparts
> > +
> > +ifeq ($(strip $(GPTFDISK_TOOLS-y)),)
> > +$(error At least one PTXCONF_GPTFDISK_* option must be enabled)
> > +endif
> 
> As a bonus you could put a warning in the menu file:
> 
>     comment "At least one GPTFDISK_* option must be enabled!"
>         depends on !GPTFDISK_GDISK && !GPTFDISK_CGDISK && !GPTFDISK_SGDISK && !GPTFDISK_FIXPARTS
> 
> (similar to the busybox vs. coreutils comments), but I think catching it in the
> make file is sufficient as well.

I think it's a good idea. We cannot really enforce it but having this
message sounds nice.

Michael

> > +
> > +GPTFDISK_CONF_TOOL	:= NO
> > +
> > +GPTFDISK_MAKE_ENV	:= \
> > +	$(CROSS_ENV) \
> > +	PREFIX=/usr
> > +
> > +GPTFDISK_MAKE_OPT	:= \
> > +	TARGET=linux \
> > +	$(GPTFDISK_TOOLS-y)
> > +
> > +# ----------------------------------------------------------------------------
> > +# Install
> > +# ----------------------------------------------------------------------------
> > +
> > +$(STATEDIR)/gptfdisk.install:
> > +	@$(call targetinfo)
> > +	@$(call world/execute, GPTFDISK, \
> > +		install -m755 -v \
> > +		$(addprefix $(GPTFDISK_DIR)/,$(GPTFDISK_TOOLS-y)) \
> > +		$(GPTFDISK_PKGDIR)/usr/bin/)
> > +	@$(call touch)
> > +
> > +# ----------------------------------------------------------------------------
> > +# Target-Install
> > +# ----------------------------------------------------------------------------
> > +
> > +$(STATEDIR)/gptfdisk.targetinstall:
> > +	@$(call targetinfo)
> > +
> > +	@$(call install_init, gptfdisk)
> > +	@$(call install_fixup, gptfdisk,PRIORITY,optional)
> > +	@$(call install_fixup, gptfdisk,SECTION,base)
> > +	@$(call install_fixup, gptfdisk,AUTHOR,"Jonas Rebmann <jre@pengutronix.de>")
> > +	@$(call install_fixup, gptfdisk,DESCRIPTION,"GPT disk partitioning tools")
> > +
> > +	@$(foreach tool,$(GPTFDISK_TOOLS-y), \
> > +		$(call install_copy, gptfdisk, 0, 0, 0755, -, /usr/bin/$(tool))$(ptx/nl))
> > +
> > +	@$(call install_finish, gptfdisk)
> > +
> > +	@$(call touch)
> > +
> > +# vim: syntax=make
> 
> Reviewed-by: Roland Hieber <rhi@pengutronix.de>
> 
>  - Roland
> 
> > 
> > ---
> > base-commit: 1b82c74e1f1f2048cb08a381def774ea2f8e7227
> > change-id: 20250124-gptfdisk-b77ce7d11992
> > 
> > Best regards,
> > -- 
> > Jonas Rebmann <jre@pengutronix.de>
> > 
> > 
> > 
> 
> -- 
> Roland Hieber, Pengutronix e.K.          | rhi@pengutronix.de          |
> Steuerwalder Str. 21                     | https://www.pengutronix.de/ |
> 31137 Hildesheim, Germany                | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686         | Fax:   +49-5121-206917-5555 |
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-01-30 13:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-24 19:06 [ptxdist] [PATCH] gptfdisk: add new package Jonas Rebmann
2025-01-29 14:24 ` Roland Hieber
2025-01-30  9:32   ` Jonas Rebmann
2025-01-30 13:13   ` Michael Olbrich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox