Hi Muhammad,
you are sending multiple times the same patch with the same version
number, it is difficult to track. I have already applied 2/3 and 3/3 and
the follow-up to 3/3, so this patch has nothing to do anymore with the
series.
On 17.06.22 09:19, Hamza, Muhammad wrote:
> swupdate-usb service uses a fixed mount point which caters block devices
> with one partition only. If a device has multiple partitions
> swupdate-usb service launches for every partition and tries to mount it
> at same mount point which is not a clean way. This also results in
> failures during un-mounting even if the update is performed successfully.
>
> This is due to the fact that when multiple partitons are mounted at same
> mount point, it acts like a stack and with each un-mount the latest
> mounted partition is removed. An example case is if a USB with 3
> partitions are plugged in it launches services for all, say all
> partitions are mounted in sequence as sda1, sda2 and sda3.
>
> However, if only one partiton say sda2 contains the update image it will
> start update from it and services for sda1 and sda3 will exit as no
> image is present in them. This will cause services for
>
The use case for this is for end users, generally not aware of Linux,
that just load the SWU and copy it on a fresh bought USP pen. USB pen
are sold for Windows, they have no partition table, they are pre
formatted with VFAT, and Linux find a single /dev/%I (mostly sda).
In case of multiple partitions, it raises the question what should be
done: search for any SWU ? Provide a menu to the customer to select ? Do
nothing because it cannot decide, if a HMI is availbvale ? These
questions are very specific to each project, and this service is mostly
overridden in customer's project.
I am not sure what should be done with multiple SWUs. Should be tried to
run an update for all of them ? And then, which order ?
Anyway, I can merge this - it remains an example (maybe it should be
written somewhere). The integrator should check it and verify with the
own project.
Which is the difference with previous versions, if any ?
> sda1 and sda3 to run umount twice on /mnt/ but second partition in
> mounting sequence was sda2 which is busy, and it would fail to un-mount.
> Now when swupdate-usb@sda2 will exit after update it will run umount
> once and one partition will still be left mounted as corresponding
> umount for that service failed.
>
> This commit introduces a change that for every partiton a unique mount
> point is created, and when done, that mount point is removed, this
> ensures no such conficts occur and every service uses a mount point
> unique to the partiton against which service was launched. This also
> replaces mount point 'mnt' with 'tmp' to guarantee writable mount-point
> in-case the rootfs is read-only.
>
Not clear what happens when multiple SUs are stored, IMO is becoming
messy. I do not know if a general solution can be found, maybe executing
a script before swupdate-client that will decide if the update should be
performed or not.
> Signed-off-by: Muhammad Hamza <
muhamma...@mentor.com
> <mailto:
muhamma...@mentor.com>>
>
> ---
>
> recipes-support/swupdate/swupdate/swupdate-usb@.service
> <mailto:
recipes-support/swupdate/swupdate/swupdate-usb@.service> | 8
> +++++---
>
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/recipes-support/swupdate/swupdate/swupdate-usb@.service
> <mailto:
a/recipes-support/swupdate/swupdate/swupdate-usb@.service>
> b/recipes-support/swupdate/swupdate/swupdate-usb@.service
> <mailto:
b/recipes-support/swupdate/swupdate/swupdate-usb@.service>
>
> index df1a408..cf36b2c 100644
>
> --- a/recipes-support/swupdate/swupdate/swupdate-usb@.service
> <mailto:
a/recipes-support/swupdate/swupdate/swupdate-usb@.service>
>
> +++ b/recipes-support/swupdate/swupdate/swupdate-usb@.service
> <mailto:
b/recipes-support/swupdate/swupdate/swupdate-usb@.service>
>
> @@ -4,6 +4,8 @@ Requires=swupdate.service
> Requires=swupdate-progress.service
>
> [Service]
>
> -ExecStartPre=/bin/mount /dev/%I /mnt
>
> -ExecStart=/bin/sh -c "swupdate-client -v /mnt/*.swu"
>
> -ExecStopPost=/bin/umount /mnt
>
> +ExecStartPre=/bin/mkdir -p /tmp/%I
>
> +ExecStartPre=/bin/mount /dev/%I /tmp/%I ExecStart=/bin/sh -c
>
> +"swupdate-client -v /tmp/%I/*.swu"
>
> +ExecStopPost=/bin/umount /tmp/%I
>
> +ExecStopPost=/bin/rmdir /tmp/%I
>
> --
>
> 2.25.1
>
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany