summaryrefslogtreecommitdiff
path: root/gnu/packages/linux.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/linux.scm')
-rw-r--r--gnu/packages/linux.scm108
1 files changed, 76 insertions, 32 deletions
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index d6633631b8..0c41e3ed8b 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
@@ -158,45 +160,79 @@
`insmod', `lsmod', and more.")
(license gpl2+)))
+(define %boot-logo-patch
+ ;; Linux-Libre boot logo featuring Freedo and a gnu.
+ (origin
+ (method url-fetch)
+ (uri (string-append "http://www.fsfla.org/svn/fsfla/software/linux-libre/"
+ "lemote/gnewsense/branches/3.15/100gnu+freedo.patch"))
+ (sha256
+ (base32
+ "1hk9swxxc80bmn2zd2qr5ccrjrk28xkypwhl4z0qx4hbivj7qm06"))))
+
+(define (kernel-config system)
+ "Return the absolute file name of the Linux-Libre build configuration file
+for SYSTEM, or #f if there is no configuration 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"))
+ (_
+ #f)))
+
(define-public linux-libre
(let* ((version "3.15")
(build-phase
- '(lambda* (#:key system #:allow-other-keys #:rest args)
+ '(lambda* (#:key system inputs #:allow-other-keys #:rest args)
+ ;; Apply the neat patch.
+ (system* "patch" "-p1" "--batch"
+ "-i" (assoc-ref inputs "patch/freedo+gnu"))
+
(let ((arch (car (string-split system #\-))))
(setenv "ARCH"
(cond ((string=? arch "i686") "i386")
(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")))
+
+ ;; Use the architecture-specific config if available, and
+ ;; 'defconfig' otherwise.
+ (if config
+ (begin
+ (copy-file config ".config")
+ (chmod ".config" #o666))
+ (system* "make" "defconfig"))
+
+ ;; 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"))
@@ -213,6 +249,7 @@
(string-append "MODULE_DIR=" moddir)
(string-append "INSTALL_PATH=" out)
(string-append "INSTALL_MOD_PATH=" out)
+ "INSTALL_MOD_STRIP=1"
"modules_install"))))))
(package
(name "linux-libre")
@@ -226,7 +263,14 @@
(build-system gnu-build-system)
(native-inputs `(("perl" ,perl)
("bc" ,bc)
- ("module-init-tools" ,module-init-tools)))
+ ("module-init-tools" ,module-init-tools)
+ ("patch/freedo+gnu" ,%boot-logo-patch)
+
+ ,@(let ((conf (kernel-config (or (%current-target-system)
+ (%current-system)))))
+ (if conf
+ `(("kconfig" ,conf))
+ '()))))
(arguments
`(#:modules ((guix build gnu-build-system)
(guix build utils)