patches and low-level development discussion
 help / color / mirror / code / Atom feed
From: Alyssa Ross <hi@alyssa.is>
To: "José Pekkarinen" <jose.pekkarinen@unikie.com>
Cc: devel@spectrum-os.org
Subject: Re: [PATCH] Add image configuration option
Date: Thu, 15 Sep 2022 13:22:07 +0000	[thread overview]
Message-ID: <87zgf0vklc.fsf@alyssa.is> (raw)
In-Reply-To: <CAJPV9Mor51-6-1AQNL=4ytfTBO_DzWoikuD_UakvKybDPRCf-Q@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 6015 bytes --]

José Pekkarinen <jose.pekkarinen@unikie.com> writes:

> On Thu, Sep 15, 2022 at 2:31 PM Alyssa Ross <hi@alyssa.is> wrote:
>
>> [...]
>> Okay, thanks for the explanation.  I think we can group some of these
>> together:
>>
>>  • Stuff that's already Nixpkgs configuration options or can be
>>    expressed through an overlay.  Whether to cross compile, what
>>    architecture to build for, whether to use a vendor kernel, etc.  This
>>    can already be handled through the existing configuration mechanism.
>>
>>  • VM customisation, including extra VMs, disabling Wayland, etc.  In my
>>    mind there are still some open questions around how this should be
>>    implemented exactly, but this is definitely something that needs to
>>    be more configurable.
>>
>>  • Whether to install extra stuff on the host system.  This covers
>>    things like debugging symbols and tools.
>>
>> Does that sound right to you?  Are there more that you can think of?
>> I'd like to understand the requirements here better, to help think about
>> what sort of configuration mechanisms might be required.
>
> This is a good summary, currently I can think of a coupel of more,
> which is a mechanism to provide upstream project configuration artifacts
> when nix allow to bypass their automated configs, for example, a kernel
> config when using manual config kernel nix package, a bit more unclear
> is how to provide upstream configs when nix is not flexible enough.

You mean you'd like to manually provide a Kconfig file, rathen than
using Nixpkgs' (not very good) structured config mechanism, right?
That should be possible with an overlay, but maybe some documentation
with an example would be a good idea?

> A mechanism to generate a full image from the nix generated artifacts
> putting together kernel, initrd, rootfs and ext partition so that the
> full image can be flashed in a sdcard of choice and use it. This would
> require to be configurable so that you can modify the partition table
> to suit vendor needs.

We've had some discussion about that already on the list and on IRC.  My
current view is that early boot firmware (U-Boot etc.) doesn't really
have anything to do with Spectrum.  They both run at different times,
and they communicate over a standard interface (EBBR [1]), so the
specifics of the firmware aren't really in scope for Spectrum itself and
belong elsewhere.  It doesn't make sense for Spectrum to be installing
U-Boot any more than it makes sense for U-Boot to be installing
Spectrum, or for Linux to be installing U-Boot — they are two separate
components.  (This isn't an approach unique to Spectrum — Fedora is
doing something similar.)

It can make sense to make an image that is a combination of U-Boot and
Spectrum, but that process should be part of an integration between the
two that exists one layer up, rather than part of either project.  For
example, you could do something like this:

	let
          spectrum = import <spectrum/img/live> {
            # config could either be loaded using the standard mechanism
            # or inlined here.
          };
          # It would also be possible to import individual components of
          # Spectrum and assemble them manually if even greater
          # flexibility was required, but I doubt that would be common.

          inherit (spectrum) pkgs;
          # I don't think a pkgs attribute currently exists on the
          # spectrum-live.img derivation, but it might make sense to add
          # for this sort of use case.

          uboot = pkgs.ubootRockPro64;
        in

        pkgs.runCommand "uboot+spectrum.img" {} ''
          # Use sfdisk (or maybe there's some better tool)
          # to create a partition table, and copy the U-boot image
          # and the Spectrum images into place.
          #
          # Spectrum is designed to accomodate this by not expecting
          # any of its partitions to be at any particular location
          # on disk.
        ''

Maybe this is another case where documentation and a worked example
would help?

[1]: https://arm-software.github.io/ebbr/index.html

> [...]
>> You're right — it's generally a bad thing if people have to patch
>> Spectrum to make it fit their needs.  I want to avoid that.  But most of
>> the things we've talked about so far don't feel to me like they're going
>> to lead to massive configuration files.  The exception is all the stuff
>> that's either Nixpkgs configuration or overlays, but the mechanism you
>> proposed here wouldn't help with that, because only a single
>> configuration file would be able to change anything in "pkgs", due to
>> the configuration files being merged using the non-recursive //
>> operator.  That's exactly why it's important to understand what the
>> needs are before we consider specific configuration mechanisms.  It's
>> difficult to figure out if an idea will actually make things easier
>> without seeing an example of the problem, and what difference to it the
>> proposed solution would make.
>
> Well, the exact point of that is to give you a small next step to move
> towards a more flexible configuration system, without loosing control
> to revert back if the situation doesn't look better. It is unlikely a more
> complex contribution would be acceptable for you if even a little one
> like this wouldn't make it.

Well, it's not the size of the change that's important, but whether it
can be demonstrated that the change solves a problem.  A big change to
fix a clear problem is fine!

But you've definitely pushed the conversation forward towards a more
flexible configuration system.  In particular, we definitely need to
think better about custom VMs and especially optional host components,
and it seems to me that we need good, task-oriented documentation about
how to accomplish things that are already possible using the existing
mechanisms.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

  reply	other threads:[~2022-09-15 13:22 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-15  7:35 [PATCH] Add image configuration option José Pekkarinen
2022-09-15  8:21 ` Alyssa Ross
2022-09-15 10:42   ` José Pekkarinen
2022-09-15 11:31     ` Alyssa Ross
2022-09-15 12:31       ` José Pekkarinen
2022-09-15 13:22         ` Alyssa Ross [this message]
2022-09-15 13:48           ` Ville Ilvonen
2022-09-15 14:00             ` Alyssa Ross
2022-09-15 14:09               ` Ville Ilvonen
2022-09-15 14:47                 ` Integrating Spectrum and platform firmware Alyssa Ross
2022-09-16  5:29                   ` Ville Ilvonen
2022-09-16  4:59           ` [PATCH] Add image configuration option José Pekkarinen
2022-09-16  7:25             ` Alyssa Ross

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=87zgf0vklc.fsf@alyssa.is \
    --to=hi@alyssa.is \
    --cc=devel@spectrum-os.org \
    --cc=jose.pekkarinen@unikie.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/crosvm
	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/nixpkgs
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock
	https://spectrum-os.org/git/www

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).