unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] Allow building other kernels
@ 2015-04-04 19:54 Andy Wingo
  2015-04-05 20:31 ` Mark H Weaver
  2015-04-05 20:50 ` Ludovic Courtès
  0 siblings, 2 replies; 4+ messages in thread
From: Andy Wingo @ 2015-04-04 19:54 UTC (permalink / raw)
  To: guix-devel

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

To use a different kernel, for example do:

  (kernel linux-mine)

  (initrd (lambda (file-systems . rest)
              (apply base-initrd file-systems
                                 #:linux linux-mine
                                 rest)))
                                                    
in your operating-system form.  A starting point for an alternate kernel
definition:

(define-public linux-mine
  (package
    (inherit linux-libre)
    (name "linux-mine")))



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Allow-specification-of-linux-kernel-when-making-an-i.patch --]
[-- Type: text/x-diff, Size: 3161 bytes --]

From 1dbdc673654f94868b0176876dd83fb8b5bfe68c Mon Sep 17 00:00:00 2001
From: Andy Wingo <wingo@pobox.com>
Date: Fri, 3 Apr 2015 12:25:26 +0200
Subject: [PATCH 1/3] Allow specification of #:linux kernel when making an
 initrd

* gnu/system/linux-initrd.scm (base-initrd): Add #:linux option to
  specify the linux kernel to use.
* gnu/system/vm.scm (expression->derivation-in-linux-vm): Propagate
  #:linux to base-initrd.
  (system-qemu-image, virtualized-operating-system): Delegate to the
  wrapped OS object's initrd builder, to allow the OS to specify the
  kernel.
---
 gnu/system/linux-initrd.scm | 4 ++--
 gnu/system/vm.scm           | 5 +++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm
index 9feb8f7..1914df9 100644
--- a/gnu/system/linux-initrd.scm
+++ b/gnu/system/linux-initrd.scm
@@ -147,6 +147,7 @@ initrd code."
                       qemu-networking?
                       virtio?
                       volatile-root?
+                      (linux linux-libre)
                       (extra-modules '()))
   "Return a monadic derivation that builds a generic initrd.  FILE-SYSTEMS is
 a list of file-systems to be mounted by the initrd, possibly in addition to
@@ -224,8 +225,7 @@ loaded at boot time in the order in which they appear."
              (open source target)))
          mapped-devices))
 
-  (mlet %store-monad ((kodir (flat-linux-module-directory linux-libre
-                                                          linux-modules)))
+  (mlet %store-monad ((kodir (flat-linux-module-directory linux linux-modules)))
     (expression->initrd
      #~(begin
          (use-modules (gnu build linux-boot)
diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm
index c93e26d..a551c89 100644
--- a/gnu/system/vm.scm
+++ b/gnu/system/vm.scm
@@ -149,6 +149,7 @@ made available under the /xchg CIFS share."
        (initrd       (if initrd                   ; use the default initrd?
                          (return initrd)
                          (base-initrd %linux-vm-file-systems
+                                      #:linux linux
                                       #:virtio? #t
                                       #:qemu-networking? #t))))
 
@@ -326,7 +327,7 @@ of the GNU system as described by OS."
   (let ((os (operating-system (inherit os)
               ;; Use an initrd with the whole QEMU shebang.
               (initrd (lambda (file-systems . rest)
-                        (apply base-initrd file-systems
+                        (apply (operating-system-initrd os) file-systems
                                #:virtio? #t
                                #:qemu-networking? #t
                                rest)))
@@ -409,7 +410,7 @@ environment with the store shared with the host.  MAPPINGS is a list of
 
   (operating-system (inherit os)
     (initrd (lambda (file-systems . rest)
-              (apply base-initrd file-systems
+              (apply (operating-system-initrd os) file-systems
                      #:volatile-root? #t
                      #:virtio? #t
                      #:qemu-networking? #t
-- 
2.2.1


[-- Attachment #3: Type: text/plain, Size: 26 bytes --]


-- 
http://wingolog.org/

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

* Re: [PATCH] Allow building other kernels
  2015-04-04 19:54 [PATCH] Allow building other kernels Andy Wingo
@ 2015-04-05 20:31 ` Mark H Weaver
  2015-04-05 22:28   ` Ludovic Courtès
  2015-04-05 20:50 ` Ludovic Courtès
  1 sibling, 1 reply; 4+ messages in thread
From: Mark H Weaver @ 2015-04-05 20:31 UTC (permalink / raw)
  To: Andy Wingo; +Cc: guix-devel

Andy Wingo <wingo@pobox.com> writes:

> To use a different kernel, for example do:
>
>   (kernel linux-mine)
>
>   (initrd (lambda (file-systems . rest)
>               (apply base-initrd file-systems
>                                  #:linux linux-mine
>                                  rest)))

It would be great if users could specify a custom kernel without having
to override the default value of 'initrd' like this.  I suppose this
could be arranged by passing #:linux (operating-system-kernel os) in
every call of the initrd procedure.

What do you think?  Ludovic?

      Mark


> From 1dbdc673654f94868b0176876dd83fb8b5bfe68c Mon Sep 17 00:00:00 2001
> From: Andy Wingo <wingo@pobox.com>
> Date: Fri, 3 Apr 2015 12:25:26 +0200
> Subject: [PATCH 1/3] Allow specification of #:linux kernel when making an
>  initrd
>
> * gnu/system/linux-initrd.scm (base-initrd): Add #:linux option to
>   specify the linux kernel to use.
> * gnu/system/vm.scm (expression->derivation-in-linux-vm): Propagate
>   #:linux to base-initrd.
>   (system-qemu-image, virtualized-operating-system): Delegate to the
>   wrapped OS object's initrd builder, to allow the OS to specify the
>   kernel.
> ---
>  gnu/system/linux-initrd.scm | 4 ++--
>  gnu/system/vm.scm           | 5 +++--
>  2 files changed, 5 insertions(+), 4 deletions(-)
>
>
> diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm
> index 9feb8f7..1914df9 100644
> --- a/gnu/system/linux-initrd.scm
> +++ b/gnu/system/linux-initrd.scm
> @@ -147,6 +147,7 @@ initrd code."
>                        qemu-networking?
>                        virtio?
>                        volatile-root?
> +                      (linux linux-libre)
>                        (extra-modules '()))
>    "Return a monadic derivation that builds a generic initrd.  FILE-SYSTEMS is
>  a list of file-systems to be mounted by the initrd, possibly in addition to
> @@ -224,8 +225,7 @@ loaded at boot time in the order in which they appear."
>               (open source target)))
>           mapped-devices))
>  
> -  (mlet %store-monad ((kodir (flat-linux-module-directory linux-libre
> -                                                          linux-modules)))
> +  (mlet %store-monad ((kodir (flat-linux-module-directory linux linux-modules)))
>      (expression->initrd
>       #~(begin
>           (use-modules (gnu build linux-boot)
> diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm
> index c93e26d..a551c89 100644
> --- a/gnu/system/vm.scm
> +++ b/gnu/system/vm.scm
> @@ -149,6 +149,7 @@ made available under the /xchg CIFS share."
>         (initrd       (if initrd                   ; use the default initrd?
>                           (return initrd)
>                           (base-initrd %linux-vm-file-systems
> +                                      #:linux linux
>                                        #:virtio? #t
>                                        #:qemu-networking? #t))))
>  
> @@ -326,7 +327,7 @@ of the GNU system as described by OS."
>    (let ((os (operating-system (inherit os)
>                ;; Use an initrd with the whole QEMU shebang.
>                (initrd (lambda (file-systems . rest)
> -                        (apply base-initrd file-systems
> +                        (apply (operating-system-initrd os) file-systems
>                                 #:virtio? #t
>                                 #:qemu-networking? #t
>                                 rest)))
> @@ -409,7 +410,7 @@ environment with the store shared with the host.  MAPPINGS is a list of
>  
>    (operating-system (inherit os)
>      (initrd (lambda (file-systems . rest)
> -              (apply base-initrd file-systems
> +              (apply (operating-system-initrd os) file-systems
>                       #:volatile-root? #t
>                       #:virtio? #t
>                       #:qemu-networking? #t
> -- 
>
> 2.2.1

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

* Re: [PATCH] Allow building other kernels
  2015-04-04 19:54 [PATCH] Allow building other kernels Andy Wingo
  2015-04-05 20:31 ` Mark H Weaver
@ 2015-04-05 20:50 ` Ludovic Courtès
  1 sibling, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2015-04-05 20:50 UTC (permalink / raw)
  To: Andy Wingo; +Cc: guix-devel

Andy Wingo <wingo@pobox.com> skribis:

> From 1dbdc673654f94868b0176876dd83fb8b5bfe68c Mon Sep 17 00:00:00 2001
> From: Andy Wingo <wingo@pobox.com>
> Date: Fri, 3 Apr 2015 12:25:26 +0200
> Subject: [PATCH 1/3] Allow specification of #:linux kernel when making an
>  initrd
>
> * gnu/system/linux-initrd.scm (base-initrd): Add #:linux option to
>   specify the linux kernel to use.
> * gnu/system/vm.scm (expression->derivation-in-linux-vm): Propagate
>   #:linux to base-initrd.
>   (system-qemu-image, virtualized-operating-system): Delegate to the
>   wrapped OS object's initrd builder, to allow the OS to specify the
>   kernel.

I’ve applied the patch with a slight difference: #:linux is
systematically passed from ‘operating-system-initrd-file’, as is done
for mapped devices.

Thanks!

Ludo’.

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

* Re: [PATCH] Allow building other kernels
  2015-04-05 20:31 ` Mark H Weaver
@ 2015-04-05 22:28   ` Ludovic Courtès
  0 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2015-04-05 22:28 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: Andy Wingo, guix-devel

Mark H Weaver <mhw@netris.org> skribis:

> Andy Wingo <wingo@pobox.com> writes:
>
>> To use a different kernel, for example do:
>>
>>   (kernel linux-mine)
>>
>>   (initrd (lambda (file-systems . rest)
>>               (apply base-initrd file-systems
>>                                  #:linux linux-mine
>>                                  rest)))
>
> It would be great if users could specify a custom kernel without having
> to override the default value of 'initrd' like this.  I suppose this
> could be arranged by passing #:linux (operating-system-kernel os) in
> every call of the initrd procedure.
>
> What do you think?  Ludovic?

(Our messages crossed.)  Agreed, and this is why 0d275f4 does things
slightly differently compared to the original patch.

Ludo’.

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

end of thread, other threads:[~2015-04-05 22:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-04 19:54 [PATCH] Allow building other kernels Andy Wingo
2015-04-05 20:31 ` Mark H Weaver
2015-04-05 22:28   ` Ludovic Courtès
2015-04-05 20:50 ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).