summaryrefslogtreecommitdiff
path: root/gnu/packages/linux.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-07-10 00:31:31 +0200
committerLudovic Courtès <ludo@gnu.org>2014-07-10 00:35:27 +0200
commita94546ecc46b15d68764a8d3c859315c18010bb4 (patch)
treeb414fc8633a40299316e68cfca18098024988747 /gnu/packages/linux.scm
parented09bb11cdd3454c00caf10615fac3cdd1791d55 (diff)
gnu: linux-libre: Add i686 and x86_64 full-blown configs.
Thanks to Jason Self <jself@gnu.org> for the kernel configs. * gnu/packages/linux.scm (kernel-config): New procedure. (linux-libre)[build-phase]: Copy it to .config. Reduce the list of things appended to .config. [native-inputs]: Add "kconfig" input. * gnu/packages/linux-libre-i686.conf, gnu/packages/linux-libre-x86_64.conf: New files, from <http://jxself.org/x86-32.txt> and <http://jxself.org/x86-64.txt>. * Makefile.am (KCONFIGS): New variable. (nobase_dist_guilemodule_DATA): Add it.
Diffstat (limited to 'gnu/packages/linux.scm')
-rw-r--r--gnu/packages/linux.scm80
1 files changed, 49 insertions, 31 deletions
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index a6a032cd2d..0be0f871b6 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -49,7 +49,9 @@
#:use-module (guix build-system gnu)
#:use-module (guix build-system cmake)
#:use-module (guix build-system python)
- #:use-module (guix build-system trivial))
+ #:use-module (guix build-system trivial)
+ #:use-module (srfi srfi-26)
+ #:use-module (ice-9 match))
(define-public (system->linux-architecture arch)
"Return the Linux architecture name for ARCH, a Guix system name such as
@@ -168,6 +170,21 @@
(base32
"1hk9swxxc80bmn2zd2qr5ccrjrk28xkypwhl4z0qx4hbivj7qm06"))))
+(define (kernel-config system)
+ "Return the absolute file name of the Linux-Libre build configuration file
+for SYSTEM."
+ (define (lookup file)
+ (let ((file (string-append "gnu/packages/" file)))
+ (search-path %load-path file)))
+
+ (match system
+ ("i686-linux"
+ (lookup "linux-libre-i686.conf"))
+ ("x86_64-linux"
+ (lookup "linux-libre-x86_64.conf"))
+ (_
+ (error "unsupported architecture" system))))
+
(define-public linux-libre
(let* ((version "3.15")
(build-phase
@@ -182,35 +199,34 @@
(else arch)))
(format #t "`ARCH' set to `~a'~%" (getenv "ARCH")))
- (let ((build (assoc-ref %standard-phases 'build)))
- (and (zero? (system* "make" "defconfig"))
- (begin
- ;; Appending works even when the option wasn't in the
- ;; file. The last one prevails if duplicated.
- (let ((port (open-file ".config" "a")))
- (display (string-append "CONFIG_NET_9P=m\n"
- "CONFIG_NET_9P_VIRTIO=m\n"
- "CONFIG_VIRTIO_BLK=m\n"
- "CONFIG_SATA_SIS=y\n"
- "CONFIG_VIRTIO_NET=m\n"
- "CONFIG_SIS190=y\n"
- ;; https://lists.gnu.org/archive/html/guix-devel/2014-04/msg00039.html
- "CONFIG_DEVPTS_MULTIPLE_INSTANCES=y\n"
- "CONFIG_VIRTIO_PCI=m\n"
- "CONFIG_VIRTIO_BALLOON=m\n"
- "CONFIG_VIRTIO_MMIO=m\n"
- "CONFIG_FUSE_FS=m\n"
- "CONFIG_CIFS=m\n"
- "CONFIG_9P_FS=m\n"
- "CONFIG_E1000E=m\n")
- port)
- (close-port port))
-
- (zero? (system* "make" "oldconfig")))
-
- ;; Call the default `build' phase so `-j' is correctly
- ;; passed.
- (apply build #:make-flags "all" args)))))
+ (let ((build (assoc-ref %standard-phases 'build))
+ (config (assoc-ref inputs "kconfig")))
+ (copy-file config ".config")
+ (chmod ".config" #o666)
+
+ ;; Appending works even when the option wasn't in the
+ ;; file. The last one prevails if duplicated.
+ (let ((port (open-file ".config" "a")))
+ (display (string-append "CONFIG_NET_9P=m\n"
+ "CONFIG_NET_9P_VIRTIO=m\n"
+ "CONFIG_VIRTIO_BLK=m\n"
+ "CONFIG_VIRTIO_NET=m\n"
+ ;; https://lists.gnu.org/archive/html/guix-devel/2014-04/msg00039.html
+ "CONFIG_DEVPTS_MULTIPLE_INSTANCES=y\n"
+ "CONFIG_VIRTIO_PCI=m\n"
+ "CONFIG_VIRTIO_BALLOON=m\n"
+ "CONFIG_VIRTIO_MMIO=m\n"
+ "CONFIG_FUSE_FS=m\n"
+ "CONFIG_CIFS=m\n"
+ "CONFIG_9P_FS=m\n")
+ port)
+ (close-port port))
+
+ (zero? (system* "make" "oldconfig"))
+
+ ;; Call the default `build' phase so `-j' is correctly
+ ;; passed.
+ (apply build #:make-flags "all" args))))
(install-phase
`(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
@@ -241,7 +257,9 @@
(native-inputs `(("perl" ,perl)
("bc" ,bc)
("module-init-tools" ,module-init-tools)
- ("patch/freedo+gnu" ,%boot-logo-patch)))
+ ("patch/freedo+gnu" ,%boot-logo-patch)
+ ("kconfig" ,(kernel-config (or (%current-target-system)
+ (%current-system))))))
(arguments
`(#:modules ((guix build gnu-build-system)
(guix build utils)