mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
doc: cookbook: Update instructions for building a custom kernel.
* doc/guix-cookbook.texi (Customizing the Kernel): Update. Change-Id: I4451f038219c73b685fa3e80e1b05c729d4bea35 Signed-off-by: Ludovic Courtès <ludo@gnu.org> Modified-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
parent
a2ef2bcbfd
commit
0e144a0da2
1 changed files with 17 additions and 32 deletions
|
@ -1725,43 +1725,28 @@ this, it is not actually easy to include a custom kernel configuration from the
|
||||||
definition, but don't worry, there are other ways to work with what we do have.
|
definition, but don't worry, there are other ways to work with what we do have.
|
||||||
|
|
||||||
There are two ways to create a kernel with a custom kernel configuration. The
|
There are two ways to create a kernel with a custom kernel configuration. The
|
||||||
first is to provide a standard @file{.config} file during the build process by
|
first is to provide a standard @file{defconfig} to @code{customize-linux}
|
||||||
including an actual @file{.config} file as a native input to our custom
|
procedure. To produce such file you need to obtain Linux source code, create a
|
||||||
kernel. The following is a snippet from the custom @code{'configure} phase of
|
@file{.config} file (using @code{make menuconfig} command, for example) or
|
||||||
the @code{make-linux-libre} package definition:
|
provide one you already have. After that you will need to run
|
||||||
|
@code{make savedefconfig} command within the kernel source tree---this will
|
||||||
|
produce the @file{defconfig} file which we can be used to build a custom kernel.
|
||||||
|
|
||||||
|
Below is a sample kernel package.
|
||||||
|
|
||||||
@lisp
|
@lisp
|
||||||
(let ((build (assoc-ref %standard-phases 'build))
|
(define-public my-linux-libre
|
||||||
(config (assoc-ref (or native-inputs inputs) "kconfig")))
|
|
||||||
|
|
||||||
;; Use a custom kernel configuration file or a default
|
|
||||||
;; configuration file.
|
|
||||||
(if config
|
|
||||||
(begin
|
|
||||||
(copy-file config ".config")
|
|
||||||
(chmod ".config" #o666))
|
|
||||||
(invoke "make" ,defconfig)))
|
|
||||||
@end lisp
|
|
||||||
|
|
||||||
Below is a sample kernel package. The @code{linux-libre} package is nothing
|
|
||||||
special and can be inherited from and have its fields overridden like any
|
|
||||||
other package:
|
|
||||||
|
|
||||||
@lisp
|
|
||||||
(define-public linux-libre/E2140
|
|
||||||
(package
|
(package
|
||||||
(inherit linux-libre)
|
(inherit (customize-linux
|
||||||
(native-inputs
|
#:linux linux-libre
|
||||||
`(("kconfig" ,(local-file "E2140.config"))
|
#:defconfig
|
||||||
,@@(alist-delete "kconfig"
|
(local-file "defconfig")))
|
||||||
(package-native-inputs linux-libre))))))
|
(name "my-linux-libre")))
|
||||||
@end lisp
|
@end lisp
|
||||||
|
|
||||||
In the same directory as the file defining @code{linux-libre-E2140} is a file
|
In the same directory as the file defining @code{my-linux-libre} is a file
|
||||||
named @file{E2140.config}, which is an actual kernel configuration file. The
|
named @file{defconfig}. This way you way you can provide kernel options
|
||||||
@code{defconfig} keyword of @code{make-linux-libre} is left blank here, so the
|
you want to have in the result kernel.
|
||||||
only kernel configuration in the package is the one which was included in the
|
|
||||||
@code{native-inputs} field.
|
|
||||||
|
|
||||||
The second way to create a custom kernel is to pass a new value to the
|
The second way to create a custom kernel is to pass a new value to the
|
||||||
@code{extra-options} keyword of the @code{make-linux-libre} procedure. The
|
@code{extra-options} keyword of the @code{make-linux-libre} procedure. The
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue