mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Tobias Waldekranz <tobias@waldekranz.com>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 0/5] dm: Initial work on a device mapper
Date: Sun, 31 Aug 2025 09:48:32 +0200	[thread overview]
Message-ID: <87h5xo3p9r.fsf@waldekranz.com> (raw)
In-Reply-To: <aLFk86Wk1uSR0JQl@pengutronix.de>

On fre, aug 29, 2025 at 10:29, Sascha Hauer <s.hauer@pengutronix.de> wrote:
> Hi Tobias,
>
> On Thu, Aug 28, 2025 at 05:05:25PM +0200, Tobias Waldekranz wrote:
>> Start work on adding a device mapper that is compatible with the
>> corresponding subsystem in Linux.
>> 
>> This is the foundation of several higher level abstractions, for
>> example:
>> 
>> - LVM: Linux Volume manager. Dynamically allocates logical volumes
>>   from one or more storage devices, manages RAID arrays, etc.
>> 
>> - LUKS: Linux Unified Key Setup. Transparent disk
>>   encryption/decryption.
>> 
>> - dm-verity: Transparent integrity checking of block devices.
>
> That's great stuff. We are also interested especially in dm-verity as
> that would allow us to get rid of separate partitions for the Kernel
> image and maybe even the FIT image format we currently use whenever we
> need signed Kernel images.

We are sort of in the same boat. We wrap our rootfs in an FIT header,
just because that is the only format U-Boot knows how to verify. After
verification, we strip off the header, mount it, and then sysboot from
it, with the kernel and DTBs in /boot on the squash.

Just shipping the fs with verity data (+ possibly FEC, in the future)
and a signature would be _so_ much nicer.

>> 
>> This is part of an exploratory project for investigating how we could
>> boot Infix[1] in a more platform-independent way. I.e., my intention
>> is to eventually add support for some of the features mentioned above,
>> assuming we don't hit any major road blocks. The rest of this letter
>> just gives context for how we got here and where we would like to take
>> Barebox. If that is not interesting, feel free to stop reading here :)
>> 
>> Our idea is to relegate U-Boot to serve only as a UEFI firmware on the
>> platforms where we can't escape it, and then do most of our boot logic
>> in Barebox instead. Primarily we want to do this for two reasons:
>> 
>> 1. Being able to ship barebox as an EFI app means we can use the same
>>    boot logic on x86 machines as we to on everything else.
>> 
>> 2. Barebox is a much higher quality code base to work in than
>>    U-Boot. I'm sorry, but it just is.
>> 
>> Barebox would thus take the place occupied by systemd-boot in many
>> distro setups. So why not go with systemd-boot?
>> 
>> 1. Infix does not run systemd as PID 1, so reusing their bootloader is
>>    awkward.
>> 
>> 2. Infix ships as a single immutable filesystem image, including
>>    kernel, DTBs, etc. So we want to extract these files from the
>>    filesystem before booting the kernel. This is not supported by
>>    systemd-boot, AFAIK - all boot files must live on the ESP.
>> 
>> 3. We would like to manage our devices' non-volatile storage with LVM,
>>    and not be bound to a fixed partition table. This will give us more
>>    flexibility in growing our image, efficiently having images of
>>    varying sizes installed, etc.
>> 
>> Therefore, our plan is (roughly):
>> 
>> 1. Add dm-verity support
>> 2. Add dm-verity root-hash-signature verification support
>> 
>> With that, we can securely extract kernel+DTB from our filesystem
>> without having to sign them individually.
>
> Ok, it seems we have the same goals ;)

Very glad to hear it! :)

>> 
>> 3. Add basic LVM support, no RAID or anything, just basic (linear)
>>    logical volumes.
>> 
>> This will allow us to install multiple versions of Infix on individual
>> logical volumes, which Barebox can then find and boot from.
>> 
>> 4. Add high-level helpers for working with DPS disks and DDI images.
>> 
>> I really like the Linux Userspace API Group's thinking around
>> Discoverable Partitions Specification (DPS) and Discoverable Disk
>> Images (DDI). I think it would be great if Barebox had knowledge about
>> these patterns, and could automatically set up the dm-verity
>> configuration for a partition when available, for example.
>
> I haven't looked into this yet, but it sounds good. It's a good thing
> when barebox can just do the right thing without much configuration.
>
>> 
>> My hope is that this plan sparks some ideas and reflections. If so, I
>> would love to hear them. If not, sorry for the wall of text :)
>
> Well I am very open for adding DM and dm-verity support to barebox. We
> would likely have done it anyway at some point, but that could have
> taken some time.

Cool! I did a toy implementation in Python yesterday, just to convince
myself I understood how it works, and it was actually very straight
forward. So if this series is eventually merged, I hope to follow up
with an implementation of dm-verity pretty quickly.

> Sascha
>
> -- 
> 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 |



  reply	other threads:[~2025-08-31  7:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-28 15:05 Tobias Waldekranz
2025-08-28 15:05 ` [PATCH 1/5] string: add strtok/strtokv Tobias Waldekranz
2025-08-28 15:05 ` [PATCH 2/5] dm: Add initial device mapper infrastructure Tobias Waldekranz
2025-08-28 15:05 ` [PATCH 3/5] dm: linear: Add linear target Tobias Waldekranz
2025-08-29  5:56   ` Ahmad Fatoum
2025-08-28 15:05 ` [PATCH 4/5] test: self: dm: Add test of " Tobias Waldekranz
2025-08-28 15:05 ` [PATCH 5/5] commands: dmsetup: Basic command set for dm device management Tobias Waldekranz
2025-08-29  8:29 ` [PATCH 0/5] dm: Initial work on a device mapper Sascha Hauer
2025-08-31  7:48   ` Tobias Waldekranz [this message]
2025-08-29 11:24 ` Ahmad Fatoum
2025-08-31  7:48   ` Tobias Waldekranz

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=87h5xo3p9r.fsf@waldekranz.com \
    --to=tobias@waldekranz.com \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@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