summaryrefslogtreecommitdiffstats
path: root/rules
diff options
context:
space:
mode:
authorRoland Hieber <rhi@pengutronix.de>2023-11-03 23:52:48 +0100
committerRobert Schwebel <r.schwebel@pengutronix.de>2023-12-13 17:08:17 +0100
commitec4e919d7f81fc57f1f524a7b89f21066524191d (patch)
treebdd9f2fc2a039299ded8457b97c3027fd5e15089 /rules
parentf397dda05b517306fe13323ea2af882ec159c12d (diff)
downloadDistroKit-ec4e919d7f81fc57f1f524a7b89f21066524191d.tar.gz
DistroKit-ec4e919d7f81fc57f1f524a7b89f21066524191d.tar.xz
datapartition: generate partitions via systemd-repart
Generating the second rootfs and the data partition on the first boot has the advantage that the generated images can get even smaller, and we can resize the data partition on-the-fly to fill the available space on the boot medium. Specify a minimum of 200 MiB for the first and second root partitions just so that both are of equal size. (This will fit any root.ext2 in any of our platforms with about 25% of space left.) If the first root partition in the image is smaller, it will get resized too, including the filesystem it contains. 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> Link: https://lore.pengutronix.de/20231103225253.1349209-6-rhi@pengutronix.de Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
Diffstat (limited to 'rules')
-rw-r--r--rules/datapartition.in3
-rw-r--r--rules/datapartition.make11
2 files changed, 10 insertions, 4 deletions
diff --git a/rules/datapartition.in b/rules/datapartition.in
index 4343e7c..5b8c737 100644
--- a/rules/datapartition.in
+++ b/rules/datapartition.in
@@ -2,4 +2,7 @@
config DATAPARTITION
tristate
+ select RC_ONCE
+ select SYSTEMD
+ select SYSTEMD_REPART
default y
diff --git a/rules/datapartition.make b/rules/datapartition.make
index b79bcf0..8084480 100644
--- a/rules/datapartition.make
+++ b/rules/datapartition.make
@@ -1,6 +1,7 @@
# -*-makefile-*-
#
# Copyright (C) 2016 by Robert Schwebel <r.schwebel@pengutronix.de>
+# Copyright (C) 2023 Roland Hieber, Pengutronix <rhi@pengutronix.de>
#
# For further information about the PTXdist project and license conditions
# see the README file.
@@ -26,10 +27,12 @@ $(STATEDIR)/datapartition.targetinstall:
@$(call install_fixup,datapartition,AUTHOR,"Robert Schwebel <r.schwebel@pengutronix.de>")
@$(call install_fixup,datapartition,DESCRIPTION,missing)
- @$(call install_alternative, datapartition, 0, 0, 0644, \
- /usr/lib/systemd/system/systemd-autoformat@.service)
- @$(call install_alternative, datapartition, 0, 0, 0644, \
- /usr/lib/udev/rules.d/91-mkfs-ext4.rules)
+ @# Note: we only want to call systemd-repart in rc-once, so don't
+ @# install the configs to any path picked up by systemd-repart.service
+ @$(call install_alternative_tree, datapartition, 0, 0, \
+ /etc/repart.rc-once.d/)
+ @$(call install_alternative, datapartition, 0, 0, 0755, \
+ /etc/rc.once.d/repart)
@$(call install_finish,datapartition)