aboutsummaryrefslogtreecommitdiff
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2022 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu installer hardware)
  #:use-module (gnu build linux-modules)
  #:use-module (guix i18n)
  #:use-module (srfi srfi-1)
  #:use-module (srfi srfi-71)
  #:export (unsupported-pci-device?
            pci-device-description))

(define %unsupported-linux-modules
  ;; List of Linux modules that are useless without non-free firmware.
  ;;
  ;; Currently only drivers for PCI devices are listed.  USB devices such as
  ;; "btintel" would require support to list USB devices and read the USB
  ;; device ID database.  Punt for now as this is usually less critical.
  ;;
  ;; This list is currently manually maintained based on information on
  ;; non-free firmware available from
  ;; <https://packages.debian.org/search?keywords=firmware&searchon=names&suite=stable&section=all>.
  '(;; WiFi.
    "brcmfmac"
    "ipw2100"
    "ipw2200"
    "iwlwifi"
    "mwl8k"
    "rtl8188ee"
    "rtl818x_pci"
    "rtl8192ce"
    "rtl8192de"
    "rtl8192ee"

    ;; Ethernet.
    "bnx2"
    "bnx2x"
    "liquidio"

    ;; Graphics.
    "amdgpu"
    "radeon"

    ;; Multimedia.
    "ivtv"))

(define unsupported-pci-device?
  ;; Arrange to load the module alias database only once.
  (let ((aliases (delay (known-module-aliases))))
    (lambda (device)
      "Return true if DEVICE is known to not be supported by free software."
      (any (lambda (module)
             (member module %unsupported-linux-modules))
           (matching-modules (pci-device-module-alias device)
                             (force aliases))))))

(define (pci-device-description pci-database)
  "Return a procedure that, given a PCI device, returns a string describing
it."
  (define (with-fallback lookup)
    (lambda (vendor-id id)
      (let ((vendor name (lookup vendor-id id)))
        (values (or vendor (number->string vendor-id 16))
                (or name (number->string id 16))))))

  (define pci-lookup
    (with-fallback (load-pci-device-database pci-database)))

  (lambda (device)
    (let ((vendor name (pci-lookup (pci-device-vendor device)
                                   (pci-device-id device))))
      (if (network-pci-device? device)
          ;; TRANSLATORS: The two placeholders are the manufacturer
          ;; and name of a PCI device.
          (format #f (G_ "~a ~a (networking device)")
                  vendor name)
          (string-append vendor " " name)))))
mount> record type.Ludovic Courtès * guix/build/syscalls.scm (<mount>): New record type. (option-string->mount-flags, mount-flags) (octal-decode, mounts): New procedures. (mount-points): Rewrite in terms of 'mount'. * tests/syscalls.scm ("mounts"): New test. 2020-06-28tests: Do not fail when network interface aliases are present.Marius Bakke Fixes <https://bugs.gnu.org/42111>. * tests/syscalls.scm ("network-interface-names"): Filter interface names with a colon. 2020-06-05tests: syscall: Support file-systems without extended attributes.Mathieu Othacehe * tests/syscalls.scm (setxattr): Catch ENOTSUP that can be raised if the file-system does not support extended user attributes. 2020-06-02tests: Allow passing on systems without support for swap devices.Simon South * tests/syscalls.scm ("swapon", "swapoff"): Accept ENOSYS as a valid result. Signed-off-by: Mathieu Othacehe <othacehe@gnu.org> 2020-05-14syscalls: Add 'getxattr'.Jan (janneke) Nieuwenhuizen * guix/build/syscalls.scm (getxattr): New procedure. * tests/syscalls.scm ("getxattr, setxattr"): Test it, together with setxattr. 2020-02-11syscalls: Re-enable 'pivot-root' test.Ludovic Courtès Fixes <https://bugs.gnu.org/25476>. Reported by Paul Garlick <pgarlick@tourbillion-technology.com>. * tests/syscalls.scm ("pivot-root"): Skip only when PERFORM-CONTAINER-TESTS? is true. Rewrite to use a socket pair instead of a pipe. Synchronize parent and child so that the parent can initialize the child's UID and GID mappings before continuing. 2019-10-05syscalls: Add 'add-to-entropy-count'.Ludovic Courtès * guix/build/syscalls.scm (RNDADDTOENTCNT): New variable. (add-to-entropy-count): New procedure. * tests/syscalls.scm ("add-to-entropy-count"): New test. 2019-06-27syscalls: Add 'terminal-rows'.Ludovic Courtès * guix/build/syscalls.scm (terminal-dimension): New procedure. (terminal-columns): Rewrite in terms of 'terminal-dimension'. (terminal-rows): New procedure. * tests/syscalls.scm ("terminal-rows"): New test. 2018-07-03syscalls: Define AT_SYMLINK_NOFOLLOW et al.Ludovic Courtès * guix/build/syscalls.scm (AT_FDCWD, AT_SYMLINK_NOFOLLOW, AT_REMOVEDIR) (AT_SYMLINK_FOLLOW, AT_NO_AUTOMOUNT, AT_EMPTY_PATH): New variables. * tests/syscalls.scm ("utime with AT_SYMLINK_NOFOLLOW"): New test. 2018-04-08tests: Skip 'pivot-root' test on Ubuntu's 4.4 kernels.Ludovic Courtès Fixes <https://bugs.gnu.org/25476>. Reported by Paul Garlick <pgarlick@tourbillion-technology.com> and Maria Sidorova <hydromasha@gmail.com>. * tests/syscalls.scm ("pivot-root"): Skip on known-bad Ubuntu kernels. 2017-11-25syscalls: Adjust utmpx test.Ludovic Courtès Fixes <https://bugs.gnu.org/29426>. Reported by Adonay Felipe Nogueira <adfeno@hyperbola.info>. * tests/syscalls.scm ("utmpx-entries"): Check the value of (utmpx-entries entry) only for INIT_PROCESS, LOGIN_PROCESS, and USER_PROCESS entries.