[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#30604] [PATCH v10 1/6] linux-modules: Add "modules.alias" writer.
From: |
Ludovic Courtès |
Subject: |
[bug#30604] [PATCH v10 1/6] linux-modules: Add "modules.alias" writer. |
Date: |
Mon, 12 Mar 2018 13:39:13 +0100 |
From: Danny Milosavljevic <address@hidden>
* gnu/build/linux-modules.scm (write-module-alias-database): New
procedure.
(%not-dash): New variable.
Co-authored-by: Ludovic Courtès <address@hidden>
---
gnu/build/linux-modules.scm | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/gnu/build/linux-modules.scm b/gnu/build/linux-modules.scm
index 4fe673cca..6101b8dc3 100644
--- a/gnu/build/linux-modules.scm
+++ b/gnu/build/linux-modules.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014, 2016, 2018 Ludovic Courtès <address@hidden>
;;; Copyright © 2017 Mathieu Othacehe <address@hidden>
+;;; Copyright © 2018 Danny Milosavljevic <address@hidden>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -21,6 +22,7 @@
#:use-module (guix elf)
#:use-module (guix glob)
#:use-module (guix build syscalls)
+ #:use-module ((guix build utils) #:select (find-files))
#:use-module (rnrs io ports)
#:use-module (rnrs bytevectors)
#:use-module (srfi srfi-1)
@@ -41,7 +43,8 @@
device-module-aliases
known-module-aliases
- matching-modules))
+ matching-modules
+ write-module-alias-database))
;;; Commentary:
;;;
@@ -380,4 +383,25 @@ ALIAS is a string like \"scsi:t-0x00\" as returned by
module)))
known-aliases))
+(define %not-dash
+ (char-set-complement (char-set #\-)))
+
+(define (write-module-alias-database directory)
+ "Traverse the '.ko' files in DIRECTORY and create the corresponding
+'modules.alias' file."
+ (define aliases
+ (map (lambda (file)
+ (cons (file-name->module-name file) (module-aliases file)))
+ (find-files directory "\\.ko$")))
+
+ (call-with-output-file (string-append directory "/modules.alias")
+ (lambda (port)
+ (display "# Aliases extracted from modules themselves.\n" port)
+ (for-each (match-lambda
+ ((module . aliases)
+ (for-each (lambda (alias)
+ (format port "alias ~a ~a\n" alias module))
+ aliases)))
+ aliases))))
+
;;; linux-modules.scm ends here
--
2.16.2
- [bug#30604] [PATCH v8 3/7] linux-boot: Load kernel modules only when the hardware is present., (continued)
- [bug#30604] [PATCH v8 3/7] linux-boot: Load kernel modules only when the hardware is present., Danny Milosavljevic, 2018/03/03
- [bug#30604] [PATCH v8 3/7] linux-boot: Load kernel modules only when the hardware is present., Ludovic Courtès, 2018/03/03
- [bug#30604] [PATCH v8 3/7] linux-boot: Load kernel modules only when the hardware is present., Danny Milosavljevic, 2018/03/03
- [bug#30604] [PATCH v8 3/7] linux-boot: Load kernel modules only when the hardware is present., Danny Milosavljevic, 2018/03/03
- [bug#30604] [PATCH v8 3/7] linux-boot: Load kernel modules only when the hardware is present., Danny Milosavljevic, 2018/03/04
- [bug#30604] [PATCH v8 3/7] linux-boot: Load kernel modules only when the hardware is present., Ludovic Courtès, 2018/03/09
- [bug#30604] [PATCH v8 3/7] linux-boot: Load kernel modules only when the hardware is present., Danny Milosavljevic, 2018/03/09
- [bug#30604] [PATCH v8 3/7] linux-boot: Load kernel modules only when the hardware is present., Danny Milosavljevic, 2018/03/09
- [bug#30604] [PATCH v8 3/7] linux-boot: Load kernel modules only when the hardware is present., Danny Milosavljevic, 2018/03/09
- [bug#30604] [PATCH v8 3/7] linux-boot: Load kernel modules only when the hardware is present., Ludovic Courtès, 2018/03/12
- [bug#30604] [PATCH v10 1/6] linux-modules: Add "modules.alias" writer.,
Ludovic Courtès <=
- [bug#30604] [PATCH v10 5/6] linux-initrd: Provide our own 'modprobe' program., Ludovic Courtès, 2018/03/12
- [bug#30604] [PATCH v10 5/6] linux-initrd: Provide our own 'modprobe' program., Danny Milosavljevic, 2018/03/12
- [bug#30604] [PATCH v10 5/6] linux-initrd: Provide our own 'modprobe' program., Danny Milosavljevic, 2018/03/12
- [bug#30604] [PATCH v10 5/6] linux-initrd: Provide our own 'modprobe' program., Ludovic Courtès, 2018/03/13
- [bug#30604] [PATCH v10 5/6] linux-initrd: Provide our own 'modprobe' program., Ludovic Courtès, 2018/03/12
- [bug#30604] [PATCH v11 1/6] linux-modules: Add "modules.alias" writer., Ludovic Courtès, 2018/03/12
- [bug#30604] [PATCH v11 6/6] linux-modules: Add "modules.devname" writer., Ludovic Courtès, 2018/03/12
- [bug#30604] [PATCH v11 6/6] linux-modules: Add "modules.devname" writer., Danny Milosavljevic, 2018/03/12
- [bug#30604] [PATCH v11 6/6] linux-modules: Add "modules.devname" writer., Ludovic Courtès, 2018/03/13
- [bug#30604] [PATCH v11 4/6] vm: Make the virtio-blk uniquely identifiable in /sys., Ludovic Courtès, 2018/03/12