DistroKit Mailinglist
 help / color / mirror / Atom feed
From: Roland Hieber <rhi@pengutronix.de>
To: distrokit@pengutronix.de
Subject: Re: [DistroKit] [PATCH 7/8] rauc: add initial support
Date: Wed, 8 Mar 2023 10:45:40 +0100	[thread overview]
Message-ID: <20230308094540.pevw33qppwmxl2np@pengutronix.de> (raw)
In-Reply-To: <20230302160921.GS11792@pengutronix.de>

On Thu, Mar 02, 2023 at 05:09:21PM +0100, Michael Olbrich wrote:
> Hi,
> 
> On Thu, Mar 02, 2023 at 11:34:53AM +0100, Jan Lübbe wrote:
> > On Thu, 2023-03-02 at 10:41 +0100, Roland Hieber wrote:
> > > On Mon, Feb 13, 2023 at 08:37:25AM +0100, Jan Lübbe wrote:
> > > > On Sun, 2023-02-12 at 23:14 +0100, Roland Hieber wrote:
> > > > > +++ b/projectroot/etc/rauc/system.conf
> > > > > @@ -0,0 +1,16 @@
> > > > > +[system]
> > > > > +compatible=@RAUC_BUNDLE_COMPATIBLE@
> > > > > +bootloader=barebox
> > > > > +
> > > > 
> > > > Please disable support for plain bundles.
> > > 
> > > ACK.
> > > 
> > > > Also, add a rauc data directory on the data partition so that we can use
> > > > adaptive updates and keep a global slot status file.
> > > 
> > > Okay, this turned out to be a bit more involved, because although there
> > > is a data partition, it currently not mounted, because there is no mount
> > > unit for it and also no fstab entry, and it also there's no file system
> > > on it because systemd-autoformat@mmcblk3.service fails to run because
> > > mkfs cannot find the partition because after the previous steps which
> > > resize the partition to fill the maximum space on the SD card result in
> > > the partition table needing to be re-read by the kernel, which fails
> > > because the rootfs from the same block device is already mounted.

This turned out to be the wrong interpretation of mine. The autoformat
service did not run because the data partition is the last partition in
the image, and only contains null bytes, which genimage cleverly strips
from the generated hdimage. So when I dd the image to the SD card
without changing the partition sizes, the old ext4 superblock which was
created on the data partition during previous test runs was not
overwritten, so libblkid thinks there is still a file system on the
partition, and the ENV{ID_FS_USAGE}!="filesystem" in udev doesn't
trigger.

I've fixed up the genimage config to zero out the first few kilobytes on
the data partitions now and will include that patch in my next series.

The part with mkfs not finding the partition was because I had
refactored the service unit, and was missing a set of braces around the
partx calls, so the second partx call to re-add the partition didn't
happen. So the current solution with sfdisk and partx did work in
principle.

 - Roland

> > > 
> > > And that is my current yak shaving status… I think the 'correct' way to
> > > do this would be using systemd-repart [1] before the rootfs is mounted
> > > (but maybe we need an initrd for that…? not sure…), or simply use the
> > > existing 512 MB data partition generated by genimage and let the user
> > > resize it manually when needed.
> > > 
> > > [1]: https://www.freedesktop.org/software/systemd/man/systemd-repart.html
> > 
> > On the LXA TAC we currently use systemd-repart for this:
> > https://github.com/linux-automation/meta-lxatac/tree/langdale/meta-lxatac-bsp/recipes-core/lxatac-repart
> > 
> > We use it from the running system (not initramfs).
> 
> Userspace can change the partition layout manually. systemd-repart does
> this internally via fdisk_reread_changes(). That in turn calls the BLKPG
> ioctl. So with the right tool you can resize a partition at runtime even if
> it's on the same device as the root partition.
> 
> Michael
> 
> -- 
> Pengutronix e.K.                           |                             |
> Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

-- 
Roland Hieber, Pengutronix e.K.          | r.hieber@pengutronix.de     |
Steuerwalder Str. 21                     | https://www.pengutronix.de/ |
31137 Hildesheim, Germany                | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686         | Fax:   +49-5121-206917-5555 |



  reply	other threads:[~2023-03-08  9:45 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-12 22:14 [DistroKit] [PATCH 0/8] v7a: add redundant update support via RAUC Roland Hieber
2023-02-12 22:14 ` [DistroKit] [PATCH 1/8] rauc-udev: add a compatibility layer for mapping partitions Roland Hieber
2023-02-13  9:43   ` Michael Olbrich
2023-03-02  9:33     ` Roland Hieber
2023-02-12 22:14 ` [DistroKit] [PATCH 2/8] v7a: add RAUC support for qemu-vexpress Roland Hieber
2023-03-08  9:33   ` Roland Hieber
2023-02-12 22:14 ` [DistroKit] [PATCH 3/8] v7a: add RAUC support for beaglebone black Roland Hieber
2023-02-12 22:14 ` [DistroKit] [PATCH 4/8] v7a: add RAUC support for rpi3 Roland Hieber
2023-02-12 22:14 ` [DistroKit] [PATCH 5/8] v7a: add RAUC support for riotboard Roland Hieber
2023-02-12 22:14 ` [DistroKit] [PATCH 6/8] v7a: kernel: enable features necessary for RAUC Roland Hieber
2023-02-13  7:33   ` Jan Lübbe
2023-02-12 22:14 ` [DistroKit] [PATCH 7/8] rauc: add initial support Roland Hieber
2023-02-13  7:37   ` Jan Lübbe
2023-03-02  9:41     ` Roland Hieber
2023-03-02 10:34       ` Jan Lübbe
2023-03-02 16:09         ` Michael Olbrich
2023-03-08  9:45           ` Roland Hieber [this message]
2023-02-12 22:14 ` [DistroKit] [PATCH 8/8] v7a: enable RAUC bundle creation Roland Hieber
2023-02-13  7:42   ` Jan Lübbe
2023-04-25 18:38     ` Roland Hieber
2023-02-13  7:48 ` [DistroKit] [PATCH 0/8] v7a: add redundant update support via RAUC Marco Felsch
2023-02-13  9:35   ` Roland Hieber
2023-03-07 12:04 ` Ahmad Fatoum
2023-03-08 10:11   ` Roland Hieber

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=20230308094540.pevw33qppwmxl2np@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