mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 00/12] Partition table manipulation support
@ 2024-02-19  8:31 Sascha Hauer
  2024-02-19  8:31 ` [PATCH 01/12] partitions: dos: save indention level Sascha Hauer
                   ` (12 more replies)
  0 siblings, 13 replies; 18+ messages in thread
From: Sascha Hauer @ 2024-02-19  8:31 UTC (permalink / raw)
  To: Barebox List

This series adds support for changing partition tables. There is both a
C API and a new command to create partition tables, to create partitions
or to delete partitions. Both MSDOS and GPT tables are supported,
although MSDOS currently lacks support for logical partitions which is
left as a future exercise.

The partition manipulation command mimics GNU Parted which has a quite
convenient API for use in scripts. Some examples for the command are:

Print a partition table:

$ parted mmc0 print

create a new partition table:

$ parted mmc0 mklabel gpt

create a new partition table and add a partition beginning at offset
1MiB ending at offset 128MiB:

$ parted mmc0 mklabel gpt mkpart rootfs ext4 1MiB 128MiB

The same, using KiB as unit and printing the result at the end:

$ parted mmc0 unit KiB mklabel gpt mkpart rootfs ext4 1024 131072 print

Original GNU Parted has several heuristics to adjust a new partition's
borders between existing partitions. These have all been left out so
far. Also toggling a bootable flag is not yet implemented. So there are
still things to do, but I think this is enough to be useful already.

Sascha

Sascha Hauer (12):
  partitions: dos: save indention level
  partition: allocate struct partition_desc in parser
  partition: allocate struct partition in parser
  partition: efi: keep raw data
  uuid: implement random uuid/guid
  linux/sizes.h: add more defines
  partition: add PARTITION_LINUX_DATA_GUID define
  partitions: move parser.h to include/partitions.h
  partitions: implement partition manipulation support
  partitions: dos: implement partition manipulation support
  partitions: efi: implement partition manipulation support
  commands: add parted

 commands/Kconfig           |  21 +++
 commands/Makefile          |   2 +-
 commands/parted.c          | 374 +++++++++++++++++++++++++++++++++++++
 common/Kconfig             |   3 +
 common/partitions.c        | 167 ++++++++++++++---
 common/partitions/Kconfig  |   1 +
 common/partitions/dos.c    | 331 ++++++++++++++++++++++++++++----
 common/partitions/efi.c    | 297 ++++++++++++++++++++++++++++-
 common/partitions/parser.h |  43 -----
 include/efi/partition.h    |   3 +
 include/linux/sizes.h      |  12 ++
 include/partitions.h       |  67 +++++++
 lib/uuid.c                 |  30 +++
 13 files changed, 1229 insertions(+), 122 deletions(-)
 create mode 100644 commands/parted.c
 delete mode 100644 common/partitions/parser.h
 create mode 100644 include/partitions.h

-- 
2.39.2




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

end of thread, other threads:[~2024-02-29  7:16 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-19  8:31 [PATCH 00/12] Partition table manipulation support Sascha Hauer
2024-02-19  8:31 ` [PATCH 01/12] partitions: dos: save indention level Sascha Hauer
2024-02-19  8:31 ` [PATCH 02/12] partition: allocate struct partition_desc in parser Sascha Hauer
2024-02-19  8:31 ` [PATCH 03/12] partition: allocate struct partition " Sascha Hauer
2024-02-19  8:31 ` [PATCH 04/12] partition: efi: keep raw data Sascha Hauer
2024-02-19  8:31 ` [PATCH 05/12] uuid: implement random uuid/guid Sascha Hauer
2024-02-19  8:31 ` [PATCH 06/12] linux/sizes.h: add more defines Sascha Hauer
2024-02-19  8:31 ` [PATCH 07/12] partition: add PARTITION_LINUX_DATA_GUID define Sascha Hauer
2024-02-19  8:31 ` [PATCH 08/12] partitions: move parser.h to include/partitions.h Sascha Hauer
2024-02-19  8:31 ` [PATCH 09/12] partitions: implement partition manipulation support Sascha Hauer
2024-02-19  8:31 ` [PATCH 10/12] partitions: dos: " Sascha Hauer
2024-02-28 17:37   ` Ahmad Fatoum
2024-02-29  7:16     ` Sascha Hauer
2024-02-19  8:31 ` [PATCH 11/12] partitions: efi: " Sascha Hauer
2024-02-28 17:36   ` Ahmad Fatoum
2024-02-19  8:31 ` [PATCH 12/12] commands: add parted Sascha Hauer
2024-02-19  9:38   ` Ulrich Ölmann
2024-02-20 10:47 ` [PATCH 00/12] Partition table manipulation support Sascha Hauer

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