From f6e5c1866ca281da9391413fe4b701944db842d5 Mon Sep 17 00:00:00 2001 From: Hilton Chain Date: Mon, 23 Jan 2023 20:11:06 +0800 Subject: [PATCH] rosenthal: linux-xanmod: Build with shipped kconfig. * rosenthal/packages/linux.scm (linux-xanmod)[arguments]<#:phases>: Build with shipped kconfig. [native-inputs]: Add cpio and zstd. (%default-extra-linux-options,config->string): New variables. --- rosenthal/packages/linux.scm | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/rosenthal/packages/linux.scm b/rosenthal/packages/linux.scm index e984b46..60f1b9d 100644 --- a/rosenthal/packages/linux.scm +++ b/rosenthal/packages/linux.scm @@ -17,6 +17,7 @@ #:use-module (gnu packages) #:use-module (gnu packages base) #:use-module (gnu packages compression) + #:use-module (gnu packages cpio) #:use-module (gnu packages gawk) #:use-module (gnu packages gcc) #:use-module (gnu packages glib) @@ -34,6 +35,12 @@ (define source-with-patches (@@ (gnu packages linux) source-with-patches)) +(define %default-extra-linux-options + (@@ (gnu packages linux) %default-extra-linux-options)) + +(define config->string + (@@ (gnu packages linux) config->string)) + (define %xanmod-version "6.1.7") (define %xanmod-revision "xanmod1") @@ -79,6 +86,7 @@ (define-public linux-xanmod (let ((base (customize-linux #:name "linux-xanmod" #:source linux-xanmod-source + #:defconfig "config_x86-64-v1" #:extra-version %xanmod-revision))) (package (inherit base) @@ -90,7 +98,31 @@ (add-after 'unpack 'remove-localversion (lambda _ (when (file-exists? "localversion") - (delete-file "localversion")))))))) + (delete-file "localversion")))) + (add-before 'configure 'add-defconfig + (lambda _ + (copy-file "CONFIGS/xanmod/gcc/config_x86-64-v1" ".config") + + ;; Adapted from `make-linux-libre*'. + (chmod ".config" #o666) + (let ((port (open-file ".config" "a")) + (extra-configuration #$(config->string + ;; Guix kernels have NVMe + ;; support built-in. + + ;; FIXME: There might be other + ;; support missing. + (cons* '("CONFIG_BLK_DEV_NVME" . #t) + %default-extra-linux-options)))) + (display extra-configuration port) + (close-port port)) + (invoke "make" "oldconfig") + + (rename-file ".config" "arch/x86/configs/config_x86-64-v1"))))))) + (native-inputs + (modify-inputs (package-native-inputs base) + ;; cpio is needed for CONFIG_IKHEADERS. + (append cpio zstd))) (home-page "https://xanmod.org/") (supported-systems '("x86_64-linux")) (synopsis