From: Roland Hieber <rhi@pengutronix.de>
To: distrokit@pengutronix.de
Cc: Roland Hieber <rhi@pengutronix.de>
Subject: [DistroKit] [PATCH next v3 3/4] squash! datapartition: generate partitions via systemd-repart
Date: Wed, 13 Dec 2023 15:47:49 +0100 [thread overview]
Message-ID: <20231213144750.1899431-4-rhi@pengutronix.de> (raw)
In-Reply-To: <20231213144750.1899431-1-rhi@pengutronix.de>
[@rsc: please replace the last paragraph in the original commit
message by the following text:]
Remove the old systemd-autoformat service and the mkfs-ext4 udev rule,
which also only handled the case where the data partition was the third
partition on the disk (which is not always the case anymore since we
have partitions for barebox-state or device-specific firmware), and
replace it with a call to systemd-repart if the root partition is on a
disk that we can actually repartition (i.e. /dev/root is not emulated
via qemu; this should also match the case when we are running from
initrd, but this has not been tested.)
Use a custom Type UUID instead of "linux-generic" for the data partition
to prevent systemd-repart from matching any bootloader partitions that
could throw off the matching algorithm (e.g. on STM32MP1).
Signed-off-by: Roland Hieber <rhi@pengutronix.de>
---
projectroot/etc/rc.once.d/repart | 10 ++++++++--
projectroot/etc/repart.rc-once.d/30-data.conf | 3 ++-
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/projectroot/etc/rc.once.d/repart b/projectroot/etc/rc.once.d/repart
index 675c4e3e57f4..c84ab31f67a1 100755
--- a/projectroot/etc/rc.once.d/repart
+++ b/projectroot/etc/rc.once.d/repart
@@ -1,3 +1,9 @@
#!/bin/sh
-echo "Repartitioning the root disk..."
-systemd-repart --dry-run=no --definitions=/etc/repart.rc-once.d/
+if rdev | grep -q '/dev/hd.*[0-9]\|/dev/mmcblk.*[0-9]\|/dev/sd.*[0-9]\|/dev/vd.*[0-9])'; then
+ echo "Repartitioning the root disk..."
+ systemd-repart --dry-run=no --definitions=/etc/repart.rc-once.d/
+else
+ # root is not on a partitionable disk; probably running in qemu or initrd
+ echo "Note: no root device or root not on a disk, not running systemd-repart"
+ exit 0
+fi
diff --git a/projectroot/etc/repart.rc-once.d/30-data.conf b/projectroot/etc/repart.rc-once.d/30-data.conf
index cc5aebfd87d3..1f663bc275d6 100644
--- a/projectroot/etc/repart.rc-once.d/30-data.conf
+++ b/projectroot/etc/repart.rc-once.d/30-data.conf
@@ -1,6 +1,7 @@
[Partition]
Label=data
-Type=linux-generic
+# don't use "linux-generic" to prevent incorrectly matching any bootloader partitions
+Type=da7af157-d639-49e9-89a0-fc74beeb8954
SizeMinBytes=200M
Weight=999999
Format=ext4
--
2.39.2
next prev parent reply other threads:[~2023-12-13 14:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-13 14:47 [DistroKit] [PATCH next v3 0/4] refactor data partition setup Roland Hieber
2023-12-13 14:47 ` [DistroKit] [PATCH next v3 1/4] systemd: make systemd-repart work for mips Roland Hieber
2023-12-13 14:47 ` [DistroKit] [PATCH next v3 2/4] busybox: enable rdev to find out the root device Roland Hieber
2023-12-13 14:47 ` Roland Hieber [this message]
2023-12-13 14:47 ` [DistroKit] [PATCH next v3 4/4] fixup! rauc-udev: generate symlinks based on GPT partition labels Roland Hieber
2023-12-13 16:25 ` [DistroKit] [PATCH next v3 0/4] refactor data partition setup Robert Schwebel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231213144750.1899431-4-rhi@pengutronix.de \
--to=rhi@pengutronix.de \
--cc=distrokit@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox