nongnu: make-linux-xanmod: Adjust style.

* nongnu/packages/linux.scm (%default-extra-linux-options,config->string):
Move into make-linux-xanmod.
(make-linux-xanmod): Adjust comments.
Move the base kernel produced by customize-linux out of let form.
[native-inputs]: Use prepend instead of append.

Signed-off-by: Jonathan Brielmaier <jonathan.brielmaier@web.de>
This commit is contained in:
Hilton Chain 2023-12-09 15:58:47 +08:00 committed by Jonathan Brielmaier
parent 1eaa24df40
commit 0b4f1c3aff
No known key found for this signature in database
GPG key ID: ECFC83988B4E4B9F

View file

@ -46,12 +46,6 @@
#:use-module (srfi srfi-1) #:use-module (srfi srfi-1)
#:export (corrupt-linux)) #:export (corrupt-linux))
(define %default-extra-linux-options
(@@ (gnu packages linux) %default-extra-linux-options))
(define config->string
(@@ (gnu packages linux) config->string))
(define (linux-url version) (define (linux-url version)
"Return a URL for Linux VERSION." "Return a URL for Linux VERSION."
(string-append "mirror://kernel.org" (string-append "mirror://kernel.org"
@ -189,25 +183,37 @@ on hardware which requires nonfree software to function."))))
#:key #:key
(name "linux-xanmod") (name "linux-xanmod")
(xanmod-defconfig "config_x86-64-v1")) (xanmod-defconfig "config_x86-64-v1"))
(let ((defconfig xanmod-defconfig) ;to be used in phases.
(base (customize-linux #:name name (define %default-extra-linux-options
(@@ (gnu packages linux) %default-extra-linux-options))
(define config->string
(@@ (gnu packages linux) config->string))
(define base-kernel
(customize-linux
#:name name
#:source source #:source source
#:defconfig xanmod-defconfig #:defconfig xanmod-defconfig
;; EXTRAVERSION is used instead. ;; EXTRAVERSION is used instead.
#:configs (config->string #:configs (config->string
'(("CONFIG_LOCALVERSION" . ""))) '(("CONFIG_LOCALVERSION" . "")))
#:extra-version xanmod-revision))) #:extra-version xanmod-revision))
(package (package
(inherit base) (inherit base-kernel)
(version version) (version version)
(arguments (arguments
(substitute-keyword-arguments (package-arguments base) (substitute-keyword-arguments (package-arguments base-kernel)
((#:phases phases) ((#:phases phases)
#~(modify-phases #$phases #~(modify-phases #$phases
;; Since `customize-linux' replaces the configure phase, we add
;; XanMod defconfig beforehand to ensure compatibility of the
;; resulting package with `customize-linux'.
(add-before 'configure 'add-xanmod-defconfig (add-before 'configure 'add-xanmod-defconfig
(lambda _ (lambda _
(rename-file (rename-file
(string-append "CONFIGS/xanmod/gcc/" #$defconfig) (string-append "CONFIGS/xanmod/gcc/" #$xanmod-defconfig)
".config") ".config")
;; Adapted from `make-linux-libre*'. ;; Adapted from `make-linux-libre*'.
@ -215,30 +221,30 @@ on hardware which requires nonfree software to function."))))
(let ((port (open-file ".config" "a")) (let ((port (open-file ".config" "a"))
(extra-configuration (extra-configuration
#$(config->string #$(config->string
;; FIXME: There might be other support missing. (append %default-extra-linux-options
(append '(("CONFIG_BLK_DEV_NVME" . #t) ;; NOTE: These are configs expected by Guix
;; but missing from XanMod defconfig.
'(("CONFIG_BLK_DEV_NVME" . #t)
("CONFIG_CRYPTO_XTS" . m) ("CONFIG_CRYPTO_XTS" . m)
("CONFIG_VIRTIO_CONSOLE" . m)) ("CONFIG_VIRTIO_CONSOLE" . m))))))
%default-extra-linux-options))))
(display extra-configuration port) (display extra-configuration port)
(close-port port)) (close-port port))
(invoke "make" "oldconfig") (invoke "make" "oldconfig")
(rename-file (rename-file
".config" ".config"
(string-append "arch/x86/configs/" #$defconfig)))))))) (string-append "arch/x86/configs/" #$xanmod-defconfig))))))))
(native-inputs (native-inputs
(modify-inputs (package-native-inputs base) (modify-inputs (package-native-inputs base-kernel)
;; cpio is needed for CONFIG_IKHEADERS. ;; cpio is needed for CONFIG_IKHEADERS.
(append cpio zstd))) (prepend cpio zstd)))
(home-page "https://xanmod.org/") (home-page "https://xanmod.org/")
(supported-systems '("x86_64-linux")) (supported-systems '("x86_64-linux"))
(synopsis (synopsis "Linux kernel distribution with custom settings and new features")
"Linux kernel distribution with custom settings and new features")
(description (description
"This package provides XanMod kernel, a general-purpose Linux kernel "This package provides XanMod kernel, a general-purpose Linux kernel
distribution with custom settings and new features. It's built to provide a distribution with custom settings and new features. It's built to provide a
stable, responsive and smooth desktop experience.")))) stable, responsive and smooth desktop experience.")))
;; Linux-XanMod sources ;; Linux-XanMod sources
(define-public linux-xanmod-version "6.5.10") (define-public linux-xanmod-version "6.5.10")