[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
07/15: linux-initrd: Make platform-specific linux modules optional.
From: |
Mark H. Weaver |
Subject: |
07/15: linux-initrd: Make platform-specific linux modules optional. |
Date: |
Mon, 24 Aug 2015 03:16:32 +0000 |
mhw pushed a commit to branch wip-loongson2f
in repository guix.
commit d05a9d8a1d993f5445657142e52124509850edf7
Author: Mark H Weaver <address@hidden>
Date: Sun Aug 9 03:40:25 2015 -0400
linux-initrd: Make platform-specific linux modules optional.
* gnu/system/linux-initrd.scm (flat-linux-module-directory): Add
'optional-modules' argument. Add 'required?' argument to internal
'lookup'
procedure. Use it when producing the list of modules to copy.
(base-initrd): Add 'optional-linux-modules' internal variable. Pass it to
'flat-linux-module-directory'. Move 'pata_acpi', 'pata_atiixp' and 'isci'
from 'linux-modules' to 'optional-linux-modules'.
---
gnu/system/linux-initrd.scm | 33 ++++++++++++++++++++++++---------
1 files changed, 24 insertions(+), 9 deletions(-)
diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm
index 48b855b..b2d961b 100644
--- a/gnu/system/linux-initrd.scm
+++ b/gnu/system/linux-initrd.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <address@hidden>
+;;; Copyright © 2015 Mark H Weaver <address@hidden>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -85,13 +86,14 @@ MODULES is a list of Guile module names to be embedded in
the initrd."
(gnu build linux-initrd))
#:references-graphs `(("closure" ,init)))))
-(define (flat-linux-module-directory linux modules)
+(define (flat-linux-module-directory linux modules optional-modules)
"Return a flat directory containing the Linux kernel modules listed in
MODULES and taken from LINUX."
(define build-exp
#~(begin
(use-modules (ice-9 match) (ice-9 regex)
(srfi srfi-1)
+ (srfi srfi-26)
(guix build utils)
(gnu build linux-modules))
@@ -102,22 +104,29 @@ MODULES and taken from LINUX."
(define module-dir
(string-append #$linux "/lib/modules"))
- (define (lookup module)
+ (define (lookup module required?)
(let ((name (ensure-dot-ko module)))
(match (find-files module-dir (string->regexp name))
((file)
file)
(()
- (error "module not found" name module-dir))
+ (if required?
+ (error "module not found" name module-dir)
+ (begin
+ (format #t "warning: module not found: ~a~%" name)
+ #f)))
((_ ...)
(error "several modules by that name"
name module-dir)))))
(define modules
- (let ((modules (map lookup '#$modules)))
+ (let ((modules
+ (append (map (cut lookup <> #t) '#$modules)
+ (filter-map (cut lookup <> #f) '#$optional-modules))))
(append modules
(recursive-module-dependencies modules
- #:lookup-module lookup))))
+ #:lookup-module
+ (cut lookup <> #t)))))
(mkdir #$output)
(for-each (lambda (module)
@@ -178,8 +187,6 @@ loaded at boot time in the order in which they appear."
(define linux-modules
;; Modules added to the initrd and loaded from the initrd.
`("ahci" ;for SATA controllers
- "pata_acpi" "pata_atiixp" ;for ATA controllers
- "isci" ;for SAS controllers like Intel C602
"usb-storage" "uas" ;for the installation image etc.
"usbkbd" "usbhid" ;USB keyboards, for debugging
,@(if (or virtio? qemu-networking?)
@@ -196,6 +203,12 @@ loaded at boot time in the order in which they appear."
'())
,@extra-modules))
+ (define optional-linux-modules
+ ;; Like linux-modules (above), but if these modules are not available, a
+ ;; warning is issued instead of an error.
+ `("pata_acpi" "pata_atiixp" ;for ATA controllers
+ "isci")) ;for SAS controllers like Intel C602
+
(define helper-packages
;; Packages to be copied on the initrd.
`(,@(if (find (lambda (fs)
@@ -217,8 +230,10 @@ loaded at boot time in the order in which they appear."
(open source target)))
mapped-devices))
- (mlet %store-monad ((kodir (flat-linux-module-directory linux
- linux-modules)))
+ (mlet %store-monad ((kodir (flat-linux-module-directory
+ linux
+ linux-modules
+ optional-linux-modules)))
(expression->initrd
#~(begin
(use-modules (gnu build linux-boot)
- branch wip-loongson2f created (now e543ccc), Mark H. Weaver, 2015/08/24
- 01/15: gnu: gst-plugins-base: Disable tests on MIPS and ARM., Mark H. Weaver, 2015/08/24
- 02/15: gnu: qemu: Disable tests on MIPS., Mark H. Weaver, 2015/08/24
- 04/15: gnu: linux-libre: Add case for ARCH=mips., Mark H. Weaver, 2015/08/24
- 05/15: gnu: linux-libre: On MIPS, the linux image name is vmlinuz, not bzImage., Mark H. Weaver, 2015/08/24
- 03/15: gnu: linux-libre: Add 'supported-systems' field: Intel only for now., Mark H. Weaver, 2015/08/24
- 07/15: linux-initrd: Make platform-specific linux modules optional.,
Mark H. Weaver <=
- 10/15: system: grub: Adjust eye-candy to work on non-Intel systems., Mark H. Weaver, 2015/08/24
- 08/15: system: grub: Convert grub background using rsvg-convert, not inkscape., Mark H. Weaver, 2015/08/24
- 09/15: system: grub: On MIPS, the linux image name is vmlinuz, not bzImage., Mark H. Weaver, 2015/08/24
- 15/15: MIPS_ONLY: services: xorg: Remove several drivers (for Yeeloong)., Mark H. Weaver, 2015/08/24
- 12/15: gnu: grub: Install documentation., Mark H. Weaver, 2015/08/24
- 11/15: gnu: grub: Use modify-phases and other minor cleanups., Mark H. Weaver, 2015/08/24
- 14/15: gnu: grub: Add support for Loongson-based machines., Mark H. Weaver, 2015/08/24
- 06/15: gnu: Add linux-libre-loongson2f., Mark H. Weaver, 2015/08/24
- 13/15: gnu: grub: Update to 2.02-beta2-500-gba218c1., Mark H. Weaver, 2015/08/24