Skip to content

add createnv command to create environment partition

Sascha Hauer barebox 2 versions – Applied

Status from this message: Applied, thanks!

Get series with b4
b4 am [email protected] change-id 20250602-createnv-11c4279116d4

Versions newest first

  1. v2 Latest5 patches 1 replyApplied
  2. v15 patches 7 repliesApplied

Changes in v2 from the cover letter

- Move MCI_STARTUP_NONE to first entry to make it the default (Ahmad)
- make 8MiB offset for first usable LBA configurable (Marco)
- Link to v1: https://lore.barebox.org/[email protected]

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/5partitions: efi: calculate instead of hardcode gpt header fieldscommon/partitions/efi.c+9 -60 replies
2/5partitions: Start partitions at 8MiB offsetcommon/partitions.c common/partitions/efi.c include/partitions.h+53 -20 replies
3/5cdev: fix cdev_open_by_name() misusecommands/devlookup.c commands/findmnt.c commands/parted.c +3 more+27 -90 replies
4/5commands: create createnv commandcommands/Kconfig commands/Makefile commands/createnv.c+198 -00 replies
5/5mci: add option to detect non-removable cards during startupdrivers/mci/Kconfig drivers/mci/mci-core.c include/mci.h+25 -30 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/5] add createnv command to create environment partition

We want to move away from describing the barebox environment explicitly in the device tree and instead motivate usage of GPT partitions for the envrionment. This series creates a createnv command to facilitate this. It creates an environment partition on the specified device and if necessary also a GPT partition table. In the simplest case a "createnv" without arguments will create a partition on the device barebox itself booted from. Both the device and the size of the partition can be specified on the command line.

As the first GPT partition as well as the GPT partition entries might conflict with a barebox written on the device on certain SoCs this series also includes patches to move the first partition up to the 8MiB boundary leaving space for a barebox binary written onto the raw device. On Some SoCs (i.MX7 and earlier) the GPT partition entries also collide with the barebox binary, so these are moved up to just below the 8MiB boundary.

---
Changes in v2:
- Move MCI_STARTUP_NONE to first entry to make it the default (Ahmad)
- make 8MiB offset for first usable LBA configurable (Marco)
- Link to v1: https://lore.barebox.org/[email protected]

---
Sascha Hauer (5):
partitions: efi: calculate instead of hardcode gpt header fields
partitions: Start partitions at 8MiB offset
cdev: fix cdev_open_by_name() misuse
commands: create createnv command
mci: add option to detect non-removable cards during startup

 commands/Kconfig        |  18 +++++
 commands/Makefile       |   1 +
 commands/createnv.c     | 179 ++++++++++++++++++++++++++++++++++++++++++++++++
 commands/devlookup.c    |   4 +-
 commands/findmnt.c      |   2 +-
 commands/parted.c       |   2 +-
 common/partitions.c     |  45 ++++++++++++
 common/partitions/efi.c |  21 ++++--
 drivers/mci/Kconfig     |  21 +++++-
 drivers/mci/mci-core.c  |   6 +-
 fs/devfs-core.c         |  17 ++++-
 fs/fs.c                 |   6 +-
 include/driver.h        |   5 ++
 include/mci.h           |   1 +
 include/partitions.h    |   2 +
 15 files changed, 311 insertions(+), 19 deletions(-)

---
base-commit: b7a40f473de4de2307eabfa6a7a25be895ea1365
change-id: 20250602-createnv-11c4279116d4

Best regards,

Signature · 1 line
Sascha Hauer <[email protected]>