diff options
Diffstat (limited to 'projectroot/usr')
6 files changed, 53 insertions, 20 deletions
diff --git a/projectroot/usr/lib/systemd/system/mnt-data.mount b/projectroot/usr/lib/systemd/system/mnt-data.mount new file mode 100644 index 0000000..4f41816 --- /dev/null +++ b/projectroot/usr/lib/systemd/system/mnt-data.mount @@ -0,0 +1,6 @@ +[Unit] +Description=Mount data partition + +[Mount] +What=/dev/disk/by-usage/data +Where=/mnt/data diff --git a/projectroot/usr/lib/systemd/system/rauc-mark-good.service b/projectroot/usr/lib/systemd/system/rauc-mark-good.service new file mode 100644 index 0000000..89f5659 --- /dev/null +++ b/projectroot/usr/lib/systemd/system/rauc-mark-good.service @@ -0,0 +1,14 @@ +[Unit] +Description=RAUC Good-marking Service +ConditionKernelCommandLine=|bootchooser.active +ConditionKernelCommandLine=|rauc.slot +Requires=boot-complete.target +After=boot-complete.target + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/usr/bin/rauc status mark-good + +[Install] +WantedBy=multi-user.target diff --git a/projectroot/usr/lib/systemd/system/systemd-autoformat@.service b/projectroot/usr/lib/systemd/system/systemd-autoformat@.service deleted file mode 100644 index 7522140..0000000 --- a/projectroot/usr/lib/systemd/system/systemd-autoformat@.service +++ /dev/null @@ -1,15 +0,0 @@ -[Unit] -Before=mnt-data.mount systemd-fsck@%i.service -Description=Create ext4 Data Partition -ConditionPathExists=/dev/%i - -[Service] -Environment=DATAPARTITION=3 -Type=oneshot -# resize partition to maximum -ExecStart=/bin/sh -c 'echo ",+" | sfdisk --force -N$DATAPARTITION /dev/mmcblk0' -# force kernel to reload the partition size of partition 3 -ExecStart=/usr/sbin/partx -d -n $DATAPARTITION /dev/mmcblk0 -ExecStart=/usr/sbin/partx -a -n $DATAPARTITION /dev/mmcblk0 -# create filesystem (this service is only started if we have none) -ExecStart=/sbin/mkfs.ext4 /dev/%i diff --git a/projectroot/usr/lib/udev/of_base_compatible b/projectroot/usr/lib/udev/of_base_compatible new file mode 100755 index 0000000..07c7f76 --- /dev/null +++ b/projectroot/usr/lib/udev/of_base_compatible @@ -0,0 +1,4 @@ +#!/bin/sh +# SPDX-License-Identifier: 0-BSD +# SPDX-FileCopyrightText: 2021 Roland Hieber, Pengutronix <rhi@pengutronix.de> +printf 'OF_BASE_COMPATIBLE="%s"\n' "$(tr '\0' ' ' < /sys/firmware/devicetree/base/compatible)" diff --git a/projectroot/usr/lib/udev/rules.d/90-rauc-partitions.rules b/projectroot/usr/lib/udev/rules.d/90-rauc-partitions.rules new file mode 100644 index 0000000..1975b1c --- /dev/null +++ b/projectroot/usr/lib/udev/rules.d/90-rauc-partitions.rules @@ -0,0 +1,29 @@ +# SPDX-License-Identifier: 0-BSD +# SPDX-FileCopyrightText: 2021 Roland Hieber, Pengutronix <rhi@pengutronix.de> + +ACTION=="remove", GOTO="rauc_partitions_end" +SUBSYSTEM!="block", GOTO="rauc_partitions_end" + +IMPORT{program}="of_base_compatible" + +# Add symlinks named /dev/disk/by-usage/{data,rootfs0,rootfs1} pointing +# to the correct partitions based on the device tree compatible + +# first part: find out the boot disk on known platforms +ENV{OF_BASE_COMPATIBLE}=="*arm,vexpress,v2p-ca9*", ENV{ID_PATH}=="platform-bus@40000000:motherboard-bus@40000000:iofpga@7,00000000-amba-10005000.mmci", TAG+="boot_disk" +ENV{OF_BASE_COMPATIBLE}=="*lxa,stm32mp157c-mc1*", ENV{ID_PATH}=="platform-soc-amba-58005000.mmc", TAG+="boot_disk" +ENV{OF_BASE_COMPATIBLE}=="*ti,am335x-bone-black*", ENV{ID_PATH}=="platform-48060000.mmc", TAG+="boot_disk" +ENV{OF_BASE_COMPATIBLE}=="*raspberrypi,3-model-b*", ENV{ID_PATH}=="platform-3f202000.mmc", TAG+="boot_disk" +ENV{OF_BASE_COMPATIBLE}=="*riot,imx6s-riotboard*", ENV{ID_PATH}=="platform-2198000.mmc", TAG+="boot_disk" +ENV{OF_BASE_COMPATIBLE}=="*radxa,rock3a*", ENV{ID_PATH}=="platform-fe2b0000.mmc", TAG+="boot_disk" +ENV{OF_BASE_COMPATIBLE}=="*tq,imx8mp-tqma8mpql-mba8mpxl*" ENV{ID_PATH}=="platform-30b50000.mmc", TAG+="boot_disk" + +# second part: create /dev/disk/by-usage/ symlinks +ENV{DEVTYPE}!="partition", GOTO="rauc_partitions_end" + +# symlinks based on GPT partition labels +TAGS=="boot_disk", ENV{ID_PART_ENTRY_NAME}=="root-A", SYMLINK+="disk/by-usage/rootfs0" +TAGS=="boot_disk", ENV{ID_PART_ENTRY_NAME}=="root-B", SYMLINK+="disk/by-usage/rootfs1" +TAGS=="boot_disk", ENV{ID_PART_ENTRY_NAME}=="data", SYMLINK+="disk/by-usage/data" + +LABEL="rauc_partitions_end" diff --git a/projectroot/usr/lib/udev/rules.d/91-mkfs-ext4.rules b/projectroot/usr/lib/udev/rules.d/91-mkfs-ext4.rules deleted file mode 100644 index 8af8f6c..0000000 --- a/projectroot/usr/lib/udev/rules.d/91-mkfs-ext4.rules +++ /dev/null @@ -1,5 +0,0 @@ -ACTION!="add", GOTO="systemd-autoformat-ext4-devices_end" -SUBSYSTEM!="block", GOTO="systemd-autoformat-ext4-devices_end" -ENV{ID_FS_USAGE}!="filesystem", SUBSYSTEMS=="mmc", KERNEL=="mmcblk0p3", ENV{ID_PART_ENTRY_TYPE}=="0x83", ENV{ID_FS_TYPE}!="ext4", ENV{SYSTEMD_WANTS}+="systemd-autoformat@$name.service" - -LABEL="systemd-autoformat-ext4-devices_end" |