gnu: linux: Turn %default-extra-linux-options into a procedure.
This is to allow version-specific options to the list of defaults. * gnu/packages/linux.scm (%default-extra-linux-options): Transform to... (default-extra-linux-options): ... this procedure, which accepts a 'version' argument. (make-linux-libre, linux-libre-arm-generic, linux-libre-arm-generic-5.10) (linux-libre-arm-generic-5.4, linux-libre-arm64-generic) (linux-libre-arm64-generic-5.10, linux-libre-arm64-generic-5.4) (linux-libre-riscv64-generic, linux-libre-mips64el-fuloong2e) (linux-libre-with-bpf): Adjust accordingly. * doc/guix-cookbook.texi (Customizing the Kernel): Adjust accordingly. Change-Id: Ifd3be8b7ed8699bada224a938dbc84205366ff3d
This commit is contained in:
		
							parent
							
								
									c3566fccb6
								
							
						
					
					
						commit
						4114060cd0
					
				
					 2 changed files with 21 additions and 20 deletions
				
			
		|  | @ -1682,7 +1682,7 @@ creates a package. | ||||||
|                             ;; See kernel-config for an example. |                             ;; See kernel-config for an example. | ||||||
|                             (configuration-file #f) |                             (configuration-file #f) | ||||||
|                             (defconfig "defconfig") |                             (defconfig "defconfig") | ||||||
|                             (extra-options %default-extra-linux-options)) |                             (extra-options (default-extra-linux-options version))) | ||||||
|   ...) |   ...) | ||||||
| @end lisp | @end lisp | ||||||
| 
 | 
 | ||||||
|  | @ -1750,7 +1750,7 @@ The second way to create a custom kernel is to pass a new value to the | ||||||
| it: | it: | ||||||
| 
 | 
 | ||||||
| @lisp | @lisp | ||||||
| (define %default-extra-linux-options | (define (default-extra-linux-options version) | ||||||
|   `(;; https://lists.gnu.org/archive/html/guix-devel/2014-04/msg00039.html |   `(;; https://lists.gnu.org/archive/html/guix-devel/2014-04/msg00039.html | ||||||
|    ("CONFIG_DEVPTS_MULTIPLE_INSTANCES" . #true) |    ("CONFIG_DEVPTS_MULTIPLE_INSTANCES" . #true) | ||||||
|    ;; Modules required for initrd: |    ;; Modules required for initrd: | ||||||
|  | @ -1800,7 +1800,7 @@ custom kernel: | ||||||
|           %file-systems |           %file-systems | ||||||
|           %efi-support |           %efi-support | ||||||
|           %emulation |           %emulation | ||||||
|           (@@@@ (gnu packages linux) %default-extra-linux-options))) |           ((@@@@ (gnu packages linux) default-extra-linux-options) version))) | ||||||
| 
 | 
 | ||||||
| (define-public linux-libre-macbook41 | (define-public linux-libre-macbook41 | ||||||
|   ;; XXX: Access the internal 'make-linux-libre*' procedure, which is |   ;; XXX: Access the internal 'make-linux-libre*' procedure, which is | ||||||
|  | @ -1814,11 +1814,12 @@ custom kernel: | ||||||
|    #:extra-options %macbook41-config-options)) |    #:extra-options %macbook41-config-options)) | ||||||
| @end lisp | @end lisp | ||||||
| 
 | 
 | ||||||
| In the above example @code{%file-systems} is a collection of flags enabling | In the above example @code{%file-systems} is a collection of flags | ||||||
| different file system support, @code{%efi-support} enables EFI support and | enabling different file system support, @code{%efi-support} enables EFI | ||||||
| @code{%emulation} enables a x86_64-linux machine to act in 32-bit mode also. | support and @code{%emulation} enables a x86_64-linux machine to act in | ||||||
| @code{%default-extra-linux-options} are the ones quoted above, which had to be | 32-bit mode also.  The @code{default-extra-linux-options} procedure is | ||||||
| added in since they were replaced in the @code{extra-options} keyword. | the one defined above, which had to be used to avoid loosing the default | ||||||
|  | configuration options of the @code{extra-options} keyword. | ||||||
| 
 | 
 | ||||||
| This all sounds like it should be doable, but how does one even know which | This all sounds like it should be doable, but how does one even know which | ||||||
| modules are required for a particular system?  Two places that can be helpful | modules are required for a particular system?  Two places that can be helpful | ||||||
|  |  | ||||||
|  | @ -852,7 +852,7 @@ ARCH and optionally VARIANT, or #f if there is no such configuration." | ||||||
|          (config (search-auxiliary-file file))) |          (config (search-auxiliary-file file))) | ||||||
|     (and config (local-file config)))) |     (and config (local-file config)))) | ||||||
| 
 | 
 | ||||||
| (define %default-extra-linux-options | (define (default-extra-linux-options version) | ||||||
|   `(;; Make the kernel config available at /proc/config.gz |   `(;; Make the kernel config available at /proc/config.gz | ||||||
|     ("CONFIG_IKCONFIG" . #t) |     ("CONFIG_IKCONFIG" . #t) | ||||||
|     ("CONFIG_IKCONFIG_PROC" . #t) |     ("CONFIG_IKCONFIG_PROC" . #t) | ||||||
|  | @ -965,7 +965,7 @@ ARCH and optionally VARIANT, or #f if there is no such configuration." | ||||||
|                            ;; for an example. |                            ;; for an example. | ||||||
|                            (configuration-file #f) |                            (configuration-file #f) | ||||||
|                            (defconfig "defconfig") |                            (defconfig "defconfig") | ||||||
|                            (extra-options %default-extra-linux-options) |                            (extra-options (default-extra-linux-options version)) | ||||||
|                            (patches |                            (patches | ||||||
|                             `(,%boot-logo-patch |                             `(,%boot-logo-patch | ||||||
|                               ,@(if (apply-infodoc-patch? version) |                               ,@(if (apply-infodoc-patch? version) | ||||||
|  | @ -991,7 +991,7 @@ ARCH and optionally VARIANT, or #f if there is no such configuration." | ||||||
|                             ;; See kernel-config for an example. |                             ;; See kernel-config for an example. | ||||||
|                             (configuration-file #f) |                             (configuration-file #f) | ||||||
|                             (defconfig "defconfig") |                             (defconfig "defconfig") | ||||||
|                             (extra-options %default-extra-linux-options)) |                             (extra-options (default-extra-linux-options version))) | ||||||
|   (package |   (package | ||||||
|     (name (if extra-version |     (name (if extra-version | ||||||
|               (string-append "linux-libre-" extra-version) |               (string-append "linux-libre-" extra-version) | ||||||
|  | @ -1243,7 +1243,7 @@ Linux kernel.  It has been modified to remove all non-free binary blobs.") | ||||||
|                      (append |                      (append | ||||||
|                       `(;; needed to fix the RTC on rockchip platforms |                       `(;; needed to fix the RTC on rockchip platforms | ||||||
|                         ("CONFIG_RTC_DRV_RK808" . #t)) |                         ("CONFIG_RTC_DRV_RK808" . #t)) | ||||||
|                       %default-extra-linux-options))) |                       (default-extra-linux-options linux-libre-version)))) | ||||||
| 
 | 
 | ||||||
| (define-public linux-libre-arm-generic-5.10 | (define-public linux-libre-arm-generic-5.10 | ||||||
|   (make-linux-libre* linux-libre-5.10-version |   (make-linux-libre* linux-libre-5.10-version | ||||||
|  | @ -1256,7 +1256,7 @@ Linux kernel.  It has been modified to remove all non-free binary blobs.") | ||||||
|                      (append |                      (append | ||||||
|                       `(;; needed to fix the RTC on rockchip platforms |                       `(;; needed to fix the RTC on rockchip platforms | ||||||
|                         ("CONFIG_RTC_DRV_RK808" . #t)) |                         ("CONFIG_RTC_DRV_RK808" . #t)) | ||||||
|                       %default-extra-linux-options))) |                       (default-extra-linux-options linux-libre-5.10-version)))) | ||||||
| 
 | 
 | ||||||
| (define-public linux-libre-arm-generic-5.4 | (define-public linux-libre-arm-generic-5.4 | ||||||
|   (make-linux-libre* linux-libre-5.4-version |   (make-linux-libre* linux-libre-5.4-version | ||||||
|  | @ -1269,7 +1269,7 @@ Linux kernel.  It has been modified to remove all non-free binary blobs.") | ||||||
|                      (append |                      (append | ||||||
|                       `(;; needed to fix the RTC on rockchip platforms |                       `(;; needed to fix the RTC on rockchip platforms | ||||||
|                         ("CONFIG_RTC_DRV_RK808" . #t)) |                         ("CONFIG_RTC_DRV_RK808" . #t)) | ||||||
|                       %default-extra-linux-options))) |                       (default-extra-linux-options linux-libre-5.4-version)))) | ||||||
| 
 | 
 | ||||||
| (define-public linux-libre-arm-generic-4.19 | (define-public linux-libre-arm-generic-4.19 | ||||||
|   (make-linux-libre* linux-libre-4.19-version |   (make-linux-libre* linux-libre-4.19-version | ||||||
|  | @ -1321,7 +1321,7 @@ Linux kernel.  It has been modified to remove all non-free binary blobs.") | ||||||
|                         ("CONFIG_BATTERY_CW2015" . m) |                         ("CONFIG_BATTERY_CW2015" . m) | ||||||
|                         ("CONFIG_CHARGER_GPIO" . m) |                         ("CONFIG_CHARGER_GPIO" . m) | ||||||
|                         ("CONFIG_SND_SOC_ES8316" . m)) |                         ("CONFIG_SND_SOC_ES8316" . m)) | ||||||
|                       %default-extra-linux-options))) |                       (default-extra-linux-options linux-libre-version)))) | ||||||
| 
 | 
 | ||||||
| (define-public linux-libre-arm64-generic-5.10 | (define-public linux-libre-arm64-generic-5.10 | ||||||
|   (make-linux-libre* linux-libre-5.10-version |   (make-linux-libre* linux-libre-5.10-version | ||||||
|  | @ -1347,7 +1347,7 @@ Linux kernel.  It has been modified to remove all non-free binary blobs.") | ||||||
|                         ("CONFIG_BATTERY_CW2015" . m) |                         ("CONFIG_BATTERY_CW2015" . m) | ||||||
|                         ("CONFIG_CHARGER_GPIO" . m) |                         ("CONFIG_CHARGER_GPIO" . m) | ||||||
|                         ("CONFIG_SND_SOC_ES8316" . m)) |                         ("CONFIG_SND_SOC_ES8316" . m)) | ||||||
|                       %default-extra-linux-options))) |                       (default-extra-linux-options linux-libre-5.10-version)))) | ||||||
| 
 | 
 | ||||||
| (define-public linux-libre-arm64-generic-5.4 | (define-public linux-libre-arm64-generic-5.4 | ||||||
|   (make-linux-libre* linux-libre-5.4-version |   (make-linux-libre* linux-libre-5.4-version | ||||||
|  | @ -1360,7 +1360,7 @@ Linux kernel.  It has been modified to remove all non-free binary blobs.") | ||||||
|                      (append |                      (append | ||||||
|                       `(;; needed to fix the RTC on rockchip platforms |                       `(;; needed to fix the RTC on rockchip platforms | ||||||
|                         ("CONFIG_RTC_DRV_RK808" . #t)) |                         ("CONFIG_RTC_DRV_RK808" . #t)) | ||||||
|                       %default-extra-linux-options))) |                       (default-extra-linux-options linux-libre-5.4-version)))) | ||||||
| 
 | 
 | ||||||
| (define-public linux-libre-riscv64-generic | (define-public linux-libre-riscv64-generic | ||||||
|   (make-linux-libre* linux-libre-version |   (make-linux-libre* linux-libre-version | ||||||
|  | @ -1384,7 +1384,7 @@ Linux kernel.  It has been modified to remove all non-free binary blobs.") | ||||||
|                         ("CONFIG_HW_RANDOM_VIRTIO" . m) |                         ("CONFIG_HW_RANDOM_VIRTIO" . m) | ||||||
|                         ("CONFIG_VIRTIO_CONSOLE" . m) |                         ("CONFIG_VIRTIO_CONSOLE" . m) | ||||||
|                         ("CONFIG_CRYPTO_XTS" . m)) |                         ("CONFIG_CRYPTO_XTS" . m)) | ||||||
|                       %default-extra-linux-options))) |                       (default-extra-linux-options linux-libre-version)))) | ||||||
| 
 | 
 | ||||||
| (define-public linux-libre-mips64el-fuloong2e | (define-public linux-libre-mips64el-fuloong2e | ||||||
|   (make-linux-libre* linux-libre-version |   (make-linux-libre* linux-libre-version | ||||||
|  | @ -1396,7 +1396,7 @@ Linux kernel.  It has been modified to remove all non-free binary blobs.") | ||||||
|                      #:extra-options |                      #:extra-options | ||||||
|                      (append |                      (append | ||||||
|                       `(("CONFIG_OVERLAY_FS" . m)) |                       `(("CONFIG_OVERLAY_FS" . m)) | ||||||
|                       %default-extra-linux-options))) |                       (default-extra-linux-options linux-libre-version)))) | ||||||
| 
 | 
 | ||||||
| (define-public linux-libre-with-bpf | (define-public linux-libre-with-bpf | ||||||
|   (let ((base-linux-libre |   (let ((base-linux-libre | ||||||
|  | @ -1410,7 +1410,7 @@ Linux kernel.  It has been modified to remove all non-free binary blobs.") | ||||||
|           #:configuration-file kernel-config |           #:configuration-file kernel-config | ||||||
|           #:extra-options |           #:extra-options | ||||||
|           (append %bpf-extra-linux-options |           (append %bpf-extra-linux-options | ||||||
|                   %default-extra-linux-options)))) |                   (default-extra-linux-options linux-libre-6.8-version))))) | ||||||
|     (package |     (package | ||||||
|       (inherit base-linux-libre) |       (inherit base-linux-libre) | ||||||
|       (inputs (modify-inputs (package-inputs base-linux-libre) |       (inputs (modify-inputs (package-inputs base-linux-libre) | ||||||
|  |  | ||||||
		Reference in a new issue