patches and low-level development discussion
 help / color / mirror / code / Atom feed
* [PATCH] rootfs: make rootfs kernel configurable
@ 2023-01-09 14:34 Ivan Nikolaenko
  2023-01-10 20:31 ` Alyssa Ross
  0 siblings, 1 reply; 3+ messages in thread
From: Ivan Nikolaenko @ 2023-01-09 14:34 UTC (permalink / raw)
  To: devel; +Cc: Ivan Nikolaenko

This patch makes it possible to use custom linux kernel.
This is needed in case of porting Spectrum OS to the other
hardware than generic-x86.

To override rootfs kernel, define "spectrum_kernel" in the
customization overlay.

Signed-off-by: Ivan Nikolaenko <ivan.nikolaenko@unikie.com>
---
 host/rootfs/default.nix | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/host/rootfs/default.nix b/host/rootfs/default.nix
index 0a84f55..b853250 100644
--- a/host/rootfs/default.nix
+++ b/host/rootfs/default.nix
@@ -81,7 +81,7 @@ let
     imports = [ (modulesPath + "/profiles/all-hardware.nix") ];
   });
 
-  kernel = pkgs.linux_latest;
+  kernel = pkgs.spectrum_kernel or pkgs.linux_latest;
 
   appvm = import ../../img/app {
     inherit config;
-- 
2.34.1



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] rootfs: make rootfs kernel configurable
  2023-01-09 14:34 [PATCH] rootfs: make rootfs kernel configurable Ivan Nikolaenko
@ 2023-01-10 20:31 ` Alyssa Ross
  2023-01-10 21:20   ` Alyssa Ross
  0 siblings, 1 reply; 3+ messages in thread
From: Alyssa Ross @ 2023-01-10 20:31 UTC (permalink / raw)
  To: Ivan Nikolaenko; +Cc: devel

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

On Mon, Jan 09, 2023 at 04:34:33PM +0200, Ivan Nikolaenko wrote:
> This patch makes it possible to use custom linux kernel.
> This is needed in case of porting Spectrum OS to the other
> hardware than generic-x86.
>
> To override rootfs kernel, define "spectrum_kernel" in the
> customization overlay.
>
> Signed-off-by: Ivan Nikolaenko <ivan.nikolaenko@unikie.com>
> ---
>  host/rootfs/default.nix | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Did you change your mind from the approach you suggested in your
previous email? [1]  I liked that approach, because it didn't require
adding something custom to the global Nixpkgs namespace that's only used
in one place, outside of Nixpkgs.

[1]: https://spectrum-os.org/lists/archives/spectrum-devel/4d41315a-05d2-747c-3708-37f7c8c34684@unikie.com/

>
> diff --git a/host/rootfs/default.nix b/host/rootfs/default.nix
> index 0a84f55..b853250 100644
> --- a/host/rootfs/default.nix
> +++ b/host/rootfs/default.nix
> @@ -81,7 +81,7 @@ let
>      imports = [ (modulesPath + "/profiles/all-hardware.nix") ];
>    });
>
> -  kernel = pkgs.linux_latest;
> +  kernel = pkgs.spectrum_kernel or pkgs.linux_latest;
>
>    appvm = import ../../img/app {
>      inherit config;
> --
> 2.34.1
>
>

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] rootfs: make rootfs kernel configurable
  2023-01-10 20:31 ` Alyssa Ross
@ 2023-01-10 21:20   ` Alyssa Ross
  0 siblings, 0 replies; 3+ messages in thread
From: Alyssa Ross @ 2023-01-10 21:20 UTC (permalink / raw)
  To: Ivan Nikolaenko; +Cc: devel

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

On Tue, Jan 10, 2023 at 08:31:21PM +0000, Alyssa Ross wrote:
> On Mon, Jan 09, 2023 at 04:34:33PM +0200, Ivan Nikolaenko wrote:
> > This patch makes it possible to use custom linux kernel.
> > This is needed in case of porting Spectrum OS to the other
> > hardware than generic-x86.
> >
> > To override rootfs kernel, define "spectrum_kernel" in the
> > customization overlay.
> >
> > Signed-off-by: Ivan Nikolaenko <ivan.nikolaenko@unikie.com>
> > ---
> >  host/rootfs/default.nix | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
>
> Did you change your mind from the approach you suggested in your
> previous email? [1]  I liked that approach, because it didn't require
> adding something custom to the global Nixpkgs namespace that's only used
> in one place, outside of Nixpkgs.

Actually, I'm guessing the reason for doing it this way is that then
even if you want to import e.g. release/live rather than host/rootfs,
it's still easy to override the kernel.

So to preserve that nice property, there are a couple of possibilities
for how we could approach this:

 - Just override linux_latest in your overlay.  The advantage to that is
   that it means Spectrum doesn't have to worry about the concept of a
   custom kernel, but the disadvantage is that it might mean unecessary
   rebuilds or other problems caused by packages that don't expect
   linux_latest to be something custom.

 - Add a "hostKernel" option to the config attribute set.  This would
   work very similarly to what you have here.  It just means that we're
   using our own namespace rather than the Nixpkgs one.

The first option is best for me, because it means no changes to Spectrum
are required, but if it's causing you problems, then I wouldn't mind
adding the config option.

> [1]: https://spectrum-os.org/lists/archives/spectrum-devel/4d41315a-05d2-747c-3708-37f7c8c34684@unikie.com/
>
> >
> > diff --git a/host/rootfs/default.nix b/host/rootfs/default.nix
> > index 0a84f55..b853250 100644
> > --- a/host/rootfs/default.nix
> > +++ b/host/rootfs/default.nix
> > @@ -81,7 +81,7 @@ let
> >      imports = [ (modulesPath + "/profiles/all-hardware.nix") ];
> >    });
> >
> > -  kernel = pkgs.linux_latest;
> > +  kernel = pkgs.spectrum_kernel or pkgs.linux_latest;
> >
> >    appvm = import ../../img/app {
> >      inherit config;
> > --
> > 2.34.1
> >
> >



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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-01-10 21:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-09 14:34 [PATCH] rootfs: make rootfs kernel configurable Ivan Nikolaenko
2023-01-10 20:31 ` Alyssa Ross
2023-01-10 21:20   ` Alyssa Ross

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).