From 384344198dcaa97847e66d3dd82f279ede08d690 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 16 Jan 2017 22:33:46 +0100 Subject: file-systems: 'file-system-needed-for-boot?' is #t for parents of the store. Suggested by John Darrington . * gnu/system/file-systems.scm (%not-slash): New variable. (file-prefix?): New procedure. (file-system-needed-for-boot?): Use it to check whether FS holds the store. * tests/file-systems.scm ("file-system-needed-for-boot?"): New test. * gnu/tests/install.scm (%separate-store-os)[file-systems]: Remove 'needed-for-boot?' field for "/gnu". --- gnu/system/file-systems.scm | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) (limited to 'gnu/system') diff --git a/gnu/system/file-systems.scm b/gnu/system/file-systems.scm index 4cc1221eb8..fa56853fd1 100644 --- a/gnu/system/file-systems.scm +++ b/gnu/system/file-systems.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013, 2014, 2015, 2016 Ludovic Courtès +;;; Copyright © 2013, 2014, 2015, 2016, 2017 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -95,11 +95,39 @@ (dependencies file-system-dependencies ; list of (default '()))) ; or -(define-inlinable (file-system-needed-for-boot? fs) - "Return true if FS has the 'needed-for-boot?' flag set, or if it's the root -file system." +(define %not-slash + (char-set-complement (char-set #\/))) + +(define (file-prefix? file1 file2) + "Return #t if FILE1 denotes the name of a file that is a parent of FILE2, +where both FILE1 and FILE2 are absolute file name. For example: + + (file-prefix? \"/gnu\" \"/gnu/store\") + => #t + + (file-prefix? \"/gn\" \"/gnu/store\") + => #f +" + (and (string-prefix? "/" file1) + (string-prefix? "/" file2) + (let loop ((file1 (string-tokenize file1 %not-slash)) + (file2 (string-tokenize file2 %not-slash))) + (match file1 + (() + #t) + ((head1 tail1 ...) + (match file2 + ((head2 tail2 ...) + (and (string=? head1 head2) (loop tail1 tail2))) + (() + #f))))))) + +(define (file-system-needed-for-boot? fs) + "Return true if FS has the 'needed-for-boot?' flag set, or if it holds the +store--e.g., if FS is the root file system." (or (%file-system-needed-for-boot? fs) - (string=? "/" (file-system-mount-point fs)))) + (and (file-prefix? (file-system-mount-point fs) (%store-prefix)) + (not (memq 'bind-mount (file-system-flags fs)))))) (define (file-system->spec fs) "Return a list corresponding to file-system FS that can be passed to the -- cgit v1.2.3 From d6d1cea624ad6869e4099672092516d7383204dc Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 24 Jan 2017 22:43:14 +0100 Subject: mapped-devices: 'source' can be a list of strings. Reported by myglc2 . * gnu/system/mapped-devices.scm ()[source]: Update comment to note that this can be a list of strings. --- gnu/system/mapped-devices.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gnu/system') diff --git a/gnu/system/mapped-devices.scm b/gnu/system/mapped-devices.scm index 8ab861bf73..2959802c96 100644 --- a/gnu/system/mapped-devices.scm +++ b/gnu/system/mapped-devices.scm @@ -54,7 +54,7 @@ (define-record-type* mapped-device make-mapped-device mapped-device? - (source mapped-device-source) ;string + (source mapped-device-source) ;string | list of strings (target mapped-device-target) ;string (type mapped-device-type)) ; -- cgit v1.2.3 From ae763b5b0b7d5e7316a3d0efe991fe8ab2261031 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 1 Feb 2017 12:16:39 +0100 Subject: system: Create home directories once 'file-systems' is up. Fixes . Reported by Andy Patterson and Leo Famulari . * gnu/build/activation.scm (activate-users+groups)[activate-user]: Pass #:create-home? #t iff CREATE-HOME? and SYSTEM?. (activate-user-home): New procedure. * gnu/system/shadow.scm (account-shepherd-service): New procedure. (account-service-type)[extensions]: Add SHEPHERD-ROOT-SERVICE-TYPE extension. * gnu/tests/base.scm (run-basic-test)["home"] ["skeletons in home directories"]: New tests. * gnu/tests/install.scm (%separate-home-os, %separate-home-os-source) (%test-separate-home-os): New variables. --- gnu/build/activation.scm | 19 +++++++++++++-- gnu/system/shadow.scm | 34 +++++++++++++++++++++++++++ gnu/tests/base.scm | 37 +++++++++++++++++++++++++++++ gnu/tests/install.scm | 60 +++++++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 147 insertions(+), 3 deletions(-) (limited to 'gnu/system') diff --git a/gnu/build/activation.scm b/gnu/build/activation.scm index 1b31dc1538..cff176e82a 100644 --- a/gnu/build/activation.scm +++ b/gnu/build/activation.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013, 2014, 2015, 2016 Ludovic Courtès +;;; Copyright © 2013, 2014, 2015, 2016, 2017 Ludovic Courtès ;;; Copyright © 2015 Mark H Weaver ;;; ;;; This file is part of GNU Guix. @@ -25,6 +25,7 @@ #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #:export (activate-users+groups + activate-user-home activate-etc activate-setuid-programs activate-/bin/sh @@ -220,7 +221,7 @@ numeric gid or #f." #:supplementary-groups supplementary-groups #:comment comment #:home home - #:create-home? create-home? + #:create-home? (and create-home? system?) #:shell shell #:password password) @@ -268,6 +269,20 @@ numeric gid or #f." (((names . _) ...) names))))) +(define (activate-user-home users) + "Create and populate the home directory of USERS, a list of tuples, unless +they already exist." + (define ensure-user-home + (match-lambda + ((name uid group supplementary-groups comment home create-home? + shell password system?) + (unless (or (not home) (directory-exists? home)) + (mkdir-p home) + (unless system? + (copy-account-skeletons home)))))) + + (for-each ensure-user-home users)) + (define (activate-etc etc) "Install ETC, a directory in the store, as the source of static files for /etc." diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm index cfdcf5e136..ee9d55c157 100644 --- a/gnu/system/shadow.scm +++ b/gnu/system/shadow.scm @@ -21,9 +21,11 @@ #:use-module (guix records) #:use-module (guix gexp) #:use-module (guix store) + #:use-module (guix modules) #:use-module (guix sets) #:use-module (guix ui) #:use-module (gnu services) + #:use-module (gnu services shepherd) #:use-module ((gnu system file-systems) #:select (%tty-gid)) #:use-module ((gnu packages admin) @@ -43,6 +45,7 @@ user-account-supplementary-groups user-account-comment user-account-home-directory + user-account-create-home-directory? user-account-shell user-account-system? @@ -288,6 +291,35 @@ group." (activate-users+groups (list #$@user-specs) (list #$@group-specs)))) +(define (account-shepherd-service accounts+groups) + "Return a Shepherd service that creates the home directories for the user +accounts among ACCOUNTS+GROUPS." + (define accounts + (filter user-account? accounts+groups)) + + ;; Create home directories only once 'file-systems' is up. This makes sure + ;; they are created in the right place if /home lives on a separate + ;; partition. + ;; + ;; XXX: We arrange for this service to stop right after it's done its job so + ;; that 'guix system reconfigure' knows that it can reload it fearlessly + ;; (and thus create new home directories). The cost of this hack is that + ;; there's a small window during which first-time logins could happen before + ;; the home directory has been created. + (list (shepherd-service + (requirement '(file-systems)) + (provision '(user-homes)) + (modules '((gnu build activation))) + (start (with-imported-modules (source-module-closure + '((gnu build activation))) + #~(lambda () + (activate-user-home + (list #$@(map user-account->gexp accounts))) + #f))) ;stop + (stop #~(const #f)) + (respawn? #f) + (documentation "Create user home directories.")))) + (define (shells-file shells) "Return a file-like object that builds a shell list for use as /etc/shells based on SHELLS. /etc/shells is used by xterm, polkit, and other programs." @@ -327,6 +359,8 @@ the /etc/skel directory for those." (extensions (list (service-extension activation-service-type account-activation) + (service-extension shepherd-root-service-type + account-shepherd-service) (service-extension etc-service-type etc-files))))) diff --git a/gnu/tests/base.scm b/gnu/tests/base.scm index a725ca90f3..756d3df800 100644 --- a/gnu/tests/base.scm +++ b/gnu/tests/base.scm @@ -146,6 +146,43 @@ info --version") (pk 'services services) '(root #$@(operating-system-shepherd-service-names os))))) + (test-assert "homes" + (let ((homes + '#$(map user-account-home-directory + (filter user-account-create-home-directory? + (operating-system-user-accounts os))))) + (marionette-eval + `(begin + (use-modules (gnu services herd) (srfi srfi-1)) + + ;; Home directories are supposed to exist once 'user-homes' + ;; has been started. + (start-service 'user-homes) + + (every (lambda (home) + (and (file-exists? home) + (file-is-directory? home))) + ',homes)) + marionette))) + + (test-assert "skeletons in home directories" + (let ((homes + '#$(filter-map (lambda (account) + (and (user-account-create-home-directory? + account) + (not (user-account-system? account)) + (user-account-home-directory account))) + (operating-system-user-accounts os)))) + (marionette-eval + `(begin + (use-modules (srfi srfi-1) (ice-9 ftw)) + (every (lambda (home) + (null? (lset-difference string=? + (scandir "/etc/skel/") + (scandir home)))) + ',homes)) + marionette))) + (test-equal "login on tty1" "root\n" (begin diff --git a/gnu/tests/install.scm b/gnu/tests/install.scm index 4e8d594054..b104efcfd5 100644 --- a/gnu/tests/install.scm +++ b/gnu/tests/install.scm @@ -35,6 +35,7 @@ #:use-module (guix utils) #:export (%test-installed-os %test-separate-store-os + %test-separate-home-os %test-raid-root-os %test-encrypted-os %test-btrfs-root-os)) @@ -218,7 +219,6 @@ IMAGE, a disk image. The QEMU VM is has access to MEMORY-SIZE MiB of RAM." "-no-reboot" "-m" #$(number->string memory-size) "-drive" "file=disk.img,if=virtio"))))) - (define %test-installed-os (system-test (name "installed-os") @@ -232,6 +232,64 @@ build (current-guix) and then store a couple of full system images.") (run-basic-test %minimal-os command "installed-os"))))) + +;;; +;;; Separate /home. +;;; + +(define-os-with-source (%separate-home-os %separate-home-os-source) + ;; The OS we want to install. + (use-modules (gnu) (gnu tests) (srfi srfi-1)) + + (operating-system + (host-name "liberigilo") + (timezone "Europe/Paris") + (locale "en_US.utf8") + + (bootloader (grub-configuration (device "/dev/vdb"))) + (kernel-arguments '("console=ttyS0")) + (file-systems (cons* (file-system + (device "my-root") + (title 'label) + (mount-point "/") + (type "ext4")) + (file-system + (device "none") + (title 'device) + (type "tmpfs") + (mount-point "/home") + (type "tmpfs")) + %base-file-systems)) + (users (cons* (user-account + (name "alice") + (group "users") + (home-directory "/home/alice")) + (user-account + (name "charlie") + (group "users") + (home-directory "/home/charlie")) + %base-user-accounts)) + (services (cons (service marionette-service-type + (marionette-configuration + (imported-modules '((gnu services herd) + (guix combinators))))) + %base-services)))) + +(define %test-separate-home-os + (system-test + (name "separate-home-os") + (description + "Test basic functionality of an installed OS with a separate /home +partition. In particular, home directories must be correctly created (see +).") + (value + (mlet* %store-monad ((image (run-install %separate-home-os + %separate-home-os-source + #:script + %simple-installation-script)) + (command (qemu-command/writable-image image))) + (run-basic-test %separate-home-os command "separate-home-os"))))) + ;;; ;;; Separate /gnu/store partition. -- cgit v1.2.3 From 357db1f91de9b3eb14be52a98cc804cdfd284f6d Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 1 Feb 2017 12:30:56 +0100 Subject: system: More 'file-append' instead of #~(string-append #$thing …). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * gnu/system/shadow.scm ()[shell]: Use 'file-append'. (%base-user-accounts): Likewise. * gnu/system/grub.scm (%background-image): Likewise. --- gnu/system/grub.scm | 4 ++-- gnu/system/shadow.scm | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'gnu/system') diff --git a/gnu/system/grub.scm b/gnu/system/grub.scm index 067b291a5c..7df7d4615a 100644 --- a/gnu/system/grub.scm +++ b/gnu/system/grub.scm @@ -94,8 +94,8 @@ denoting a file name." (define %background-image (grub-image (aspect-ratio 4/3) - (file #~(string-append #$%artwork-repository - "/grub/GuixSD-fully-black-4-3.svg")))) + (file (file-append %artwork-repository + "/grub/GuixSD-fully-black-4-3.svg")))) (define %default-theme ;; Default theme contributed by Felipe López. diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm index ee9d55c157..1acfcc4866 100644 --- a/gnu/system/shadow.scm +++ b/gnu/system/shadow.scm @@ -84,7 +84,7 @@ (create-home-directory? user-account-create-home-directory? ;Boolean (default #t)) (shell user-account-shell ; gexp - (default #~(string-append #$bash "/bin/bash"))) + (default (file-append bash "/bin/bash"))) (system? user-account-system? ; Boolean (default #f))) @@ -131,7 +131,7 @@ (name "nobody") (uid 65534) (group "nogroup") - (shell #~(string-append #$shadow "/sbin/nologin")) + (shell (file-append shadow "/sbin/nologin")) (home-directory "/nonexistent") (create-home-directory? #f) (system? #t)))) -- cgit v1.2.3 From d2a5e6982ddcbe1e5479bda62a72b3a94570855a Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 3 Feb 2017 00:20:40 +0100 Subject: file-systems: Add 'file-system-mapping->bind-mount'. * gnu/system/file-systems.scm (file-system-mapping->bind-mount): New procedure. * gnu/system/linux-container.scm (mapping->file-system): Remove. (containerized-operating-system)[mapping->fs]: Use 'file-system-mapping->bind-mount' instead of 'mapping->file-system'. * guix/scripts/environment.scm (launch-environment/container): Likewise. --- gnu/system/file-systems.scm | 17 +++++++++++++++++ gnu/system/linux-container.scm | 21 +++------------------ guix/scripts/environment.scm | 3 ++- 3 files changed, 22 insertions(+), 19 deletions(-) (limited to 'gnu/system') diff --git a/gnu/system/file-systems.scm b/gnu/system/file-systems.scm index fa56853fd1..b2721f2389 100644 --- a/gnu/system/file-systems.scm +++ b/gnu/system/file-systems.scm @@ -63,6 +63,8 @@ file-system-mapping-target file-system-mapping-writable? + file-system-mapping->bind-mount + %store-mapping)) ;;; Commentary: @@ -352,6 +354,21 @@ TARGET in the other system." (writable? file-system-mapping-writable? ;Boolean (default #f))) +(define (file-system-mapping->bind-mount mapping) + "Return a file system that realizes MAPPING, a , using +a bind mount." + (match mapping + (($ source target writable?) + (file-system + (mount-point target) + (device source) + (type "none") + (flags (if writable? + '(bind-mount) + '(bind-mount read-only))) + (check? #f) + (create-mount-point? #t))))) + (define %store-mapping ;; Mapping of the host's store into the guest. (file-system-mapping diff --git a/gnu/system/linux-container.scm b/gnu/system/linux-container.scm index 24e61c3ead..bceea41332 100644 --- a/gnu/system/linux-container.scm +++ b/gnu/system/linux-container.scm @@ -1,6 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2015 David Thompson -;;; Copyright © 2016 Ludovic Courtès +;;; Copyright © 2016, 2017 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -30,25 +30,10 @@ #:use-module (gnu services) #:use-module (gnu system) #:use-module (gnu system file-systems) - #:export (mapping->file-system - system-container + #:export (system-container containerized-operating-system container-script)) -(define (mapping->file-system mapping) - "Return a file system that realizes MAPPING." - (match mapping - (($ source target writable?) - (file-system - (mount-point target) - (device source) - (type "none") - (flags (if writable? - '(bind-mount) - '(bind-mount read-only))) - (check? #f) - (create-mount-point? #t))))) - (define (containerized-operating-system os mappings) "Return an operating system based on OS for use in a Linux container environment. MAPPINGS is a list of to realize in the @@ -66,7 +51,7 @@ containerized OS." (operating-system-file-systems os))) (define (mapping->fs fs) - (file-system (inherit (mapping->file-system fs)) + (file-system (inherit (file-system-mapping->bind-mount fs)) (needed-for-boot? #t))) (operating-system (inherit os) diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm index 8a3a935a10..0a1205d087 100644 --- a/guix/scripts/environment.scm +++ b/guix/scripts/environment.scm @@ -433,7 +433,8 @@ host file systems to mount inside the container." (writable? #f))) reqs))) (file-systems (append %container-file-systems - (map mapping->file-system mappings)))) + (map file-system-mapping->bind-mount + mappings)))) (exit/status (call-with-container file-systems (lambda () -- cgit v1.2.3 From ad167d028e97dca1937ad6ae3d89d2c4de997754 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 3 Feb 2017 11:26:25 +0100 Subject: file-systems: Remove dependency on (guix store). (gnu system file-systems) is used on the "build" side since commit 5970e8e248f6327c41c83b86bb2c89be7c3b1b4e. * gnu/system/file-systems.scm: Remove dependency on (guix store). (%store-prefix): New procedure. * tests/file-systems.scm ("does not pull (guix config)"): New test. --- gnu/system/file-systems.scm | 15 ++++++++++++++- tests/file-systems.scm | 8 ++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) (limited to 'gnu/system') diff --git a/gnu/system/file-systems.scm b/gnu/system/file-systems.scm index b2721f2389..708d53d0a1 100644 --- a/gnu/system/file-systems.scm +++ b/gnu/system/file-systems.scm @@ -19,7 +19,6 @@ (define-module (gnu system file-systems) #:use-module (ice-9 match) #:use-module (guix records) - #:use-module (guix store) #:use-module ((gnu build file-systems) #:select (string->uuid uuid->string)) #:re-export (string->uuid @@ -97,6 +96,20 @@ (dependencies file-system-dependencies ; list of (default '()))) ; or +;; Note: This module is used both on the build side and on the host side. +;; Arrange not to pull (guix store) and (guix config) because the latter +;; differs from user to user. +(define (%store-prefix) + "Return the store prefix." + (cond ((resolve-module '(guix store) #:ensure #f) + => + (lambda (store) + ((module-ref store '%store-prefix)))) + ((getenv "NIX_STORE") + => identity) + (else + "/gnu/store"))) + (define %not-slash (char-set-complement (char-set #\/))) diff --git a/tests/file-systems.scm b/tests/file-systems.scm index fd1599e132..467ee8ca5d 100644 --- a/tests/file-systems.scm +++ b/tests/file-systems.scm @@ -18,6 +18,7 @@ (define-module (test-file-systems) #:use-module (guix store) + #:use-module (guix modules) #:use-module (gnu system file-systems) #:use-module (srfi srfi-64) #:use-module (rnrs bytevectors)) @@ -72,4 +73,11 @@ (device "/foo") (flags '(bind-mount read-only))))))))) +(test-assert "does not pull (guix config)" + ;; This module is meant both for the host side and "build side", so make + ;; sure it doesn't pull in (guix config), which depends on the user's + ;; config. + (not (member '(guix config) + (source-module-closure '((gnu system file-systems)))))) + (test-end) -- cgit v1.2.3 From 7597478e2e731c09890b25ff0b817d2d7c45d01f Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 6 Feb 2017 15:42:00 +0100 Subject: file-systems: Add '%network-configuration-files' and '%network-file-mappings'. * gnu/system/file-systems.scm (%network-configuration-files) (%network-file-mappings): New variables. * guix/scripts/environment.scm (%network-configuration-files): Remove. (launch-environment/container): Refer to '%network-file-mappings' instead of calling 'filter-map'. --- gnu/system/file-systems.scm | 24 +++++++++++++++++++++++- guix/scripts/environment.scm | 23 +---------------------- 2 files changed, 24 insertions(+), 23 deletions(-) (limited to 'gnu/system') diff --git a/gnu/system/file-systems.scm b/gnu/system/file-systems.scm index 708d53d0a1..7011a279d3 100644 --- a/gnu/system/file-systems.scm +++ b/gnu/system/file-systems.scm @@ -18,6 +18,7 @@ (define-module (gnu system file-systems) #:use-module (ice-9 match) + #:use-module (srfi srfi-1) #:use-module (guix records) #:use-module ((gnu build file-systems) #:select (string->uuid uuid->string)) @@ -64,7 +65,9 @@ file-system-mapping->bind-mount - %store-mapping)) + %store-mapping + %network-configuration-files + %network-file-mappings)) ;;; Commentary: ;;; @@ -389,4 +392,23 @@ a bind mount." (target (%store-prefix)) (writable? #f))) +(define %network-configuration-files + ;; List of essential network configuration files. + '("/etc/resolv.conf" + "/etc/nsswitch.conf" + "/etc/services" + "/etc/hosts")) + +(define %network-file-mappings + ;; List of file mappings for essential network files. + (filter-map (lambda (file) + (file-system-mapping + (source file) + (target file) + ;; XXX: On some GNU/Linux systems, /etc/resolv.conf is a + ;; symlink to a file in a tmpfs which, for an unknown reason, + ;; cannot be bind mounted read-only within the container. + (writable? (string=? file "/etc/resolv.conf")))) + %network-configuration-files)) + ;;; file-systems.scm ends here diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm index 0a1205d087..44f490043c 100644 --- a/guix/scripts/environment.scm +++ b/guix/scripts/environment.scm @@ -60,12 +60,6 @@ directories in PROFILE, the store path of a profile." (define %default-shell (or (getenv "SHELL") "/bin/sh")) -(define %network-configuration-files - '("/etc/resolv.conf" - "/etc/nsswitch.conf" - "/etc/services" - "/etc/hosts")) - (define (purify-environment) "Unset almost all environment variables. A small number of variables such as 'HOME' and 'USER' are left untouched." @@ -408,22 +402,7 @@ host file systems to mount inside the container." ;; When in Rome, do as Nix build.cc does: Automagically ;; map common network configuration files. (if network? - (filter-map (lambda (file) - (and (file-exists? file) - (file-system-mapping - (source file) - (target file) - ;; XXX: On some GNU/Linux - ;; systems, /etc/resolv.conf is a - ;; symlink to a file in a tmpfs - ;; which, for an unknown reason, - ;; cannot be bind mounted - ;; read-only within the - ;; container. - (writable? - (string=? file - "/etc/resolv.conf"))))) - %network-configuration-files) + %network-file-mappings '()) ;; Mappings for the union closure of all inputs. (map (lambda (dir) -- cgit v1.2.3 From 72524ae843170b7af006388ebd87fc1eb60792e5 Mon Sep 17 00:00:00 2001 From: David Craven Date: Mon, 30 Jan 2017 20:52:00 +0100 Subject: system: install: Add gptfdisk to installation os. * gnu/system/install.scm (installation-os)[packages]: Add gptfdisk. --- gnu/system/install.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gnu/system') diff --git a/gnu/system/install.scm b/gnu/system/install.scm index ad234fd9c1..944d9f7e72 100644 --- a/gnu/system/install.scm +++ b/gnu/system/install.scm @@ -388,7 +388,7 @@ Use Alt-F2 for documentation. (base-pam-services #:allow-empty-passwords? #t)) (packages (cons* (canonical-package glibc) ;for 'tzselect' & co. - parted ddrescue + parted gptfdisk ddrescue grub ;mostly so xrefs to its manual work cryptsetup mdadm -- cgit v1.2.3 From 862e38d551801426e2f4953d13588d504d21381b Mon Sep 17 00:00:00 2001 From: David Craven Date: Thu, 9 Feb 2017 19:46:47 +0100 Subject: gnu: Move (gnu packages grub) and (gnu packages u-boot) ... to (gnu packages bootloaders). * gnu/packages/grub.scm: Rename to bootloaders.scm. * gnu/packages/u-boot.scm: Move to bootloaders.scm. * gnu/local.mk (GNU_SYSTEM_MODULES): Add bootloaders.scm, remove grub.scm and u-boot.scm; * gnu/system/grub.scm: Import (gnu packages bootloaders). * gnu/system/install.scm: Import (gnu packages bootloaders). * gnu/system/vm.scm: Import (gnu packages bootloaders). --- gnu/local.mk | 3 +- gnu/packages/bootloaders.scm | 332 +++++++++++++++++++++++++++++++++++++++++++ gnu/packages/grub.scm | 215 ---------------------------- gnu/packages/u-boot.scm | 138 ------------------ gnu/system/grub.scm | 4 +- gnu/system/install.scm | 2 +- gnu/system/vm.scm | 2 +- 7 files changed, 337 insertions(+), 359 deletions(-) create mode 100644 gnu/packages/bootloaders.scm delete mode 100644 gnu/packages/grub.scm delete mode 100644 gnu/packages/u-boot.scm (limited to 'gnu/system') diff --git a/gnu/local.mk b/gnu/local.mk index 1fc49bbd61..4d6e4b05d4 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -64,6 +64,7 @@ GNU_SYSTEM_MODULES = \ %D%/packages/bittorrent.scm \ %D%/packages/bison.scm \ %D%/packages/boost.scm \ + %D%/packages/bootloaders.scm \ %D%/packages/bootstrap.scm \ %D%/packages/busybox.scm \ %D%/packages/c.scm \ @@ -170,7 +171,6 @@ GNU_SYSTEM_MODULES = \ %D%/packages/graphics.scm \ %D%/packages/graphviz.scm \ %D%/packages/groff.scm \ - %D%/packages/grub.scm \ %D%/packages/gsasl.scm \ %D%/packages/gstreamer.scm \ %D%/packages/gtk.scm \ @@ -373,7 +373,6 @@ GNU_SYSTEM_MODULES = \ %D%/packages/unrtf.scm \ %D%/packages/upnp.scm \ %D%/packages/uucp.scm \ - %D%/packages/u-boot.scm \ %D%/packages/valgrind.scm \ %D%/packages/version-control.scm \ %D%/packages/video.scm \ diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm new file mode 100644 index 0000000000..16cb7b4c0b --- /dev/null +++ b/gnu/packages/bootloaders.scm @@ -0,0 +1,332 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2013, 2014, 2015, 2016, 2017 Ludovic Courtès +;;; Copyright © 2015 Mark H Weaver +;;; Copyright © 2015 Leo Famulari +;;; Copyright © 2016 Jan Nieuwenhuizen +;;; Copyright © 2016, 2017 Marius Bakke +;;; Copyright © 2016, 2017 Danny Milosavljevic +;;; Copyright © 2016, 2017 David Craven +;;; +;;; 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 +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu packages bootloaders) + #:use-module (gnu packages) + #:use-module (gnu packages admin) + #:use-module ((gnu packages algebra) #:select (bc)) + #:use-module (gnu packages assembly) + #:use-module (gnu packages flex) + #:use-module (gnu packages disk) + #:use-module (gnu packages bison) + #:use-module (gnu packages cdrom) + #:use-module (gnu packages cross-base) + #:use-module (gnu packages disk) + #:use-module (gnu packages flex) + #:use-module (gnu packages fontutils) + #:use-module (gnu packages gettext) + #:use-module (gnu packages linux) + #:use-module (gnu packages man) + #:use-module (gnu packages ncurses) + #:use-module (gnu packages perl) + #:use-module (gnu packages python) + #:use-module (gnu packages qemu) + #:use-module (gnu packages texinfo) + #:use-module (guix build-system gnu) + #:use-module (guix download) + #:use-module (guix git-download) + #:use-module ((guix licenses) #:prefix license:) + #:use-module (guix packages) + #:use-module (guix utils)) + +(define unifont + ;; GNU Unifont, . + ;; GRUB needs it for its graphical terminal, gfxterm. + (origin + (method url-fetch) + (uri + "http://unifoundry.com/pub/unifont-7.0.06/font-builds/unifont-7.0.06.bdf.gz") + (sha256 + (base32 + "0p2vhnc18cnbmb39vq4m7hzv4mhnm2l0a2s7gx3ar277fwng3hys")))) + +(define-public grub + (package + (name "grub") + (version "2.02rc1") + (source (origin + (method url-fetch) + (uri (string-append + "ftp://alpha.gnu.org/gnu/grub/grub-" + "2.02~rc1" + ".tar.xz")) + (file-name (string-append name "-" version ".tar.xz")) + (sha256 + (base32 + "0y02v19x9sb5jvj740f604vvi5j1rx8pily1jk0l64bdp7lkjlj4")))) + (build-system gnu-build-system) + (arguments + '(#:phases (modify-phases %standard-phases + (add-after 'unpack 'patch-stuff + (lambda* (#:key inputs #:allow-other-keys) + (substitute* "grub-core/Makefile.in" + (("/bin/sh") (which "sh"))) + + ;; Give the absolute file name of 'mdadm', used to + ;; determine the root file system when it's a RAID + ;; device. Failing to do that, 'grub-probe' silently + ;; fails if 'mdadm' is not in $PATH. + (substitute* "grub-core/osdep/linux/getroot.c" + (("argv\\[0\\] = \"mdadm\"") + (string-append "argv[0] = \"" + (assoc-ref inputs "mdadm") + "/sbin/mdadm\""))) + + ;; Make the font visible. + (copy-file (assoc-ref inputs "unifont") "unifont.bdf.gz") + (system* "gunzip" "unifont.bdf.gz") + #t))))) + (inputs + `(("gettext" ,gettext-minimal) + + ;; Depend on LVM2 for libdevmapper, used by 'grub-probe' and + ;; 'grub-install' to recognize mapped devices (LUKS, etc.) + ("lvm2" ,lvm2) + + ;; Depend on mdadm, which is invoked by 'grub-probe' and 'grub-install' + ;; to determine whether the root file system is RAID. + ("mdadm" ,mdadm) + + ("freetype" ,freetype) + ;; ("libusb" ,libusb) + ;; ("fuse" ,fuse) + ("ncurses" ,ncurses))) + (native-inputs + `(("unifont" ,unifont) + ("bison" ,bison) + ("flex" ,flex) + ("texinfo" ,texinfo) + ("help2man" ,help2man) + + ;; Dependencies for the test suite. The "real" QEMU is needed here, + ;; because several targets are used. + ("parted" ,parted) + ("qemu" ,qemu-minimal) + ("xorriso" ,xorriso))) + (home-page "https://www.gnu.org/software/grub/") + (synopsis "GRand Unified Boot loader") + (description + "GRUB is a multiboot bootloader. It is used for initially loading the +kernel of an operating system and then transferring control to it. The kernel +then goes on to load the rest of the operating system. As a multiboot +bootloader, GRUB handles the presence of multiple operating systems installed +on the same computer; upon booting the computer, the user is presented with a +menu to select one of the installed operating systems.") + (license license:gpl3+) + (properties '((cpe-name . "grub2"))))) + +(define-public grub-efi + (package + (inherit grub) + (name "grub-efi") + (synopsis "GRand Unified Boot loader (UEFI version)") + (inputs + `(("efibootmgr" ,efibootmgr) + ,@(package-inputs grub))) + (arguments + `(;; TODO: Tests need a UEFI firmware for qemu. There is one at + ;; https://github.com/tianocore/edk2/tree/master/OvmfPkg . + ;; Search for 'OVMF' in "tests/util/grub-shell.in". + #:tests? #f + ,@(substitute-keyword-arguments (package-arguments grub) + ((#:configure-flags flags ''()) + `(cons "--with-platform=efi" ,flags)) + ((#:phases phases) + `(modify-phases ,phases + (add-after 'patch-stuff 'use-absolute-efibootmgr-path + (lambda* (#:key inputs #:allow-other-keys) + (substitute* "grub-core/osdep/unix/platform.c" + (("efibootmgr") + (string-append (assoc-ref inputs "efibootmgr") + "/sbin/efibootmgr"))) + #t))))))))) + +(define-public syslinux + (let ((commit "bb41e935cc83c6242de24d2271e067d76af3585c")) + (package + (name "syslinux") + (version (git-version "6.04-pre" "1" commit)) + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/geneC/syslinux") + (commit commit))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0k8dvafd6410kqxf3kyr4y8jzmpmrih6wbjqg6gklak7945yflrc")))) + (build-system gnu-build-system) + (native-inputs + `(("nasm" ,nasm) + ("perl" ,perl) + ("python-2" ,python-2))) + (inputs + `(("libuuid" ,util-linux))) + (arguments + `(#:parallel-build? #f + #:make-flags + (list (string-append "BINDIR=" %output "/bin") + (string-append "SBINDIR=" %output "/sbin") + (string-append "LIBDIR=" %output "/lib") + (string-append "INCDIR=" %output "/include") + (string-append "DATADIR=" %output "/share") + (string-append "MANDIR=" %output "/share/man") + "PERL=perl" + "bios") + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'patch-files + (lambda _ + (substitute* (find-files "." "Makefile.*|ppmtolss16") + (("/bin/pwd") (which "pwd")) + (("/bin/echo") (which "echo")) + (("/usr/bin/perl") (which "perl"))) + #t)) + (delete 'configure) + (add-before 'build 'set-permissions + (lambda _ + (zero? (system* "chmod" "a+w" "utils/isohybrid.in")))) + (replace 'check + (lambda _ + (setenv "CC" "gcc") + (substitute* "tests/unittest/include/unittest/unittest.h" + ;; Don't look up headers under /usr. + (("/usr/include/") "")) + (zero? (system* "make" "unittest"))))))) + (home-page "http://www.syslinux.org") + (synopsis "Lightweight Linux bootloader") + (description "Syslinux is a lightweight Linux bootloader.") + (license (list license:gpl2+ + license:bsd-3 ; gnu-efi/* + license:bsd-4 ; gnu-efi/inc/* gnu-efi/lib/* + ;; Also contains: + license:expat license:isc license:zlib))))) + +(define-public dtc + (package + (name "dtc") + (version "1.4.2") + (source (origin + (method url-fetch) + (uri (string-append + "https://www.kernel.org/pub/software/utils/dtc/" + "dtc-" version ".tar.xz")) + (sha256 + (base32 + "1b7si8niyca4wxbfah3qw4p4wli81mc1qwfhaswvrfqahklnwi8k")))) + (build-system gnu-build-system) + (native-inputs + `(("bison" ,bison) + ("flex" ,flex))) + (arguments + `(#:make-flags + (list "CC=gcc" + (string-append "PREFIX=" (assoc-ref %outputs "out")) + "INSTALL=install") + #:phases + (modify-phases %standard-phases + (delete 'configure)))) + (home-page "https://www.devicetree.org") + (synopsis "Compiles device tree source files") + (description "@command{dtc} compiles +@uref{http://elinux.org/Device_Tree_Usage, device tree source files} to device +tree binary files. These are board description files used by Linux and BSD.") + (license license:gpl2+))) + +(define u-boot + (package + (name "u-boot") + (version "2017.01") + (source (origin + (method url-fetch) + (uri (string-append + "ftp://ftp.denx.de/pub/u-boot/" + "u-boot-" version ".tar.bz2")) + (sha256 + (base32 + "1wpc51jm3zyibgcr78jng2yksqvrya76bxgsr4pcyjrsz5sm2hkc")))) + (native-inputs + `(("bc" ,bc) + ("dtc" ,dtc) + ("python-2" ,python-2))) + (build-system gnu-build-system) + (home-page "http://www.denx.de/wiki/U-Boot/") + (synopsis "ARM bootloader") + (description "U-Boot is a bootloader used mostly for ARM boards. It +also initializes the boards (RAM etc).") + (license license:gpl2+))) + +(define (make-u-boot-package board triplet) + "Returns a u-boot package for BOARD cross-compiled for TRIPLET." + (package + (inherit u-boot) + (name (string-append "u-boot-" (string-downcase board))) + (native-inputs + `(("cross-gcc" ,(cross-gcc triplet)) + ("cross-binutils" ,(cross-binutils triplet)) + ,@(package-native-inputs u-boot))) + (arguments + `(#:modules ((ice-9 ftw) (guix build utils) (guix build gnu-build-system)) + #:test-target "test" + #:make-flags + (list "HOSTCC=gcc" (string-append "CROSS_COMPILE=" ,triplet "-")) + #:phases + (modify-phases %standard-phases + (replace 'configure + (lambda* (#:key outputs make-flags #:allow-other-keys) + (let ((config-name (string-append ,board "_defconfig"))) + (if (file-exists? (string-append "configs/" config-name)) + (zero? (apply system* "make" `(,@make-flags ,config-name))) + (begin + (display "Invalid board name. Valid board names are:") + (let ((suffix-len (string-length "_defconfig"))) + (scandir "configs" + (lambda (file-name) + (when (string-suffix? "_defconfig" file-name) + (format #t + "- ~A\n" + (string-drop-right file-name + suffix-len)))))) + #f))))) + (replace 'install + (lambda* (#:key outputs make-flags #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (libexec (string-append out "/libexec")) + (uboot-files (find-files "." ".*\\.(bin|efi|spl)$"))) + (mkdir-p libexec) + (for-each + (lambda (file) + (let ((target-file (string-append libexec "/" file))) + (mkdir-p (dirname target-file)) + (copy-file file target-file))) + uboot-files))))))))) + +(define-public u-boot-vexpress + (make-u-boot-package "vexpress_ca9x4" "arm-linux-gnueabihf")) + +(define-public u-boot-malta + (make-u-boot-package "malta" "mips64el-linux-gnuabi64")) + +(define-public u-boot-beagle-bone-black + (make-u-boot-package "am335x_boneblack" "arm-linux-gnueabihf")) diff --git a/gnu/packages/grub.scm b/gnu/packages/grub.scm deleted file mode 100644 index 4d9dc819b7..0000000000 --- a/gnu/packages/grub.scm +++ /dev/null @@ -1,215 +0,0 @@ -;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013, 2014, 2015, 2016, 2017 Ludovic Courtès -;;; Copyright © 2015 Mark H Weaver -;;; Copyright © 2015 Leo Famulari -;;; Copyright © 2016 Jan Nieuwenhuizen -;;; Copyright © 2016, 2017 Marius Bakke -;;; -;;; 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 -;;; GNU General Public License for more details. -;;; -;;; You should have received a copy of the GNU General Public License -;;; along with GNU Guix. If not, see . - -(define-module (gnu packages grub) - #:use-module (guix download) - #:use-module (guix packages) - #:use-module (guix utils) - #:use-module ((guix licenses) #:prefix license:) - #:use-module (guix build-system gnu) - #:use-module (gnu packages) - #:use-module (gnu packages flex) - #:use-module (gnu packages disk) - #:use-module (gnu packages bison) - #:use-module (gnu packages gettext) - #:use-module (gnu packages fontutils) - #:use-module (gnu packages linux) - #:use-module (gnu packages perl) - #:use-module (gnu packages python) - #:use-module (gnu packages qemu) - #:use-module (gnu packages man) - #:use-module (gnu packages texinfo) - #:use-module (gnu packages ncurses) - #:use-module (gnu packages cdrom)) - -(define unifont - ;; GNU Unifont, . - ;; GRUB needs it for its graphical terminal, gfxterm. - (origin - (method url-fetch) - (uri - "http://unifoundry.com/pub/unifont-7.0.06/font-builds/unifont-7.0.06.bdf.gz") - (sha256 - (base32 - "0p2vhnc18cnbmb39vq4m7hzv4mhnm2l0a2s7gx3ar277fwng3hys")))) - -(define-public grub - (package - (name "grub") - (version "2.02rc1") - (source (origin - (method url-fetch) - (uri (string-append - "ftp://alpha.gnu.org/gnu/grub/grub-" - "2.02~rc1" - ".tar.xz")) - (file-name (string-append name "-" version ".tar.xz")) - (sha256 - (base32 - "0y02v19x9sb5jvj740f604vvi5j1rx8pily1jk0l64bdp7lkjlj4")))) - (build-system gnu-build-system) - (arguments - '(#:phases (modify-phases %standard-phases - (add-after 'unpack 'patch-stuff - (lambda* (#:key inputs #:allow-other-keys) - (substitute* "grub-core/Makefile.in" - (("/bin/sh") (which "sh"))) - - ;; Give the absolute file name of 'mdadm', used to - ;; determine the root file system when it's a RAID - ;; device. Failing to do that, 'grub-probe' silently - ;; fails if 'mdadm' is not in $PATH. - (substitute* "grub-core/osdep/linux/getroot.c" - (("argv\\[0\\] = \"mdadm\"") - (string-append "argv[0] = \"" - (assoc-ref inputs "mdadm") - "/sbin/mdadm\""))) - - ;; Make the font visible. - (copy-file (assoc-ref inputs "unifont") "unifont.bdf.gz") - (system* "gunzip" "unifont.bdf.gz") - #t))))) - (inputs - `(("gettext" ,gettext-minimal) - - ;; Depend on LVM2 for libdevmapper, used by 'grub-probe' and - ;; 'grub-install' to recognize mapped devices (LUKS, etc.) - ("lvm2" ,lvm2) - - ;; Depend on mdadm, which is invoked by 'grub-probe' and 'grub-install' - ;; to determine whether the root file system is RAID. - ("mdadm" ,mdadm) - - ("freetype" ,freetype) - ;; ("libusb" ,libusb) - ;; ("fuse" ,fuse) - ("ncurses" ,ncurses))) - (native-inputs - `(("unifont" ,unifont) - ("bison" ,bison) - ("flex" ,flex) - ("texinfo" ,texinfo) - ("help2man" ,help2man) - - ;; Dependencies for the test suite. The "real" QEMU is needed here, - ;; because several targets are used. - ("parted" ,parted) - ("qemu" ,qemu-minimal) - ("xorriso" ,xorriso))) - (home-page "https://www.gnu.org/software/grub/") - (synopsis "GRand Unified Boot loader") - (description - "GRUB is a multiboot bootloader. It is used for initially loading the -kernel of an operating system and then transferring control to it. The kernel -then goes on to load the rest of the operating system. As a multiboot -bootloader, GRUB handles the presence of multiple operating systems installed -on the same computer; upon booting the computer, the user is presented with a -menu to select one of the installed operating systems.") - (license license:gpl3+) - (properties '((cpe-name . "grub2"))))) - -(define-public grub-efi - (package - (inherit grub) - (name "grub-efi") - (synopsis "GRand Unified Boot loader (UEFI version)") - (inputs - `(("efibootmgr" ,efibootmgr) - ,@(package-inputs grub))) - (arguments - `(;; TODO: Tests need a UEFI firmware for qemu. There is one at - ;; https://github.com/tianocore/edk2/tree/master/OvmfPkg . - ;; Search for 'OVMF' in "tests/util/grub-shell.in". - #:tests? #f - ,@(substitute-keyword-arguments (package-arguments grub) - ((#:configure-flags flags ''()) - `(cons "--with-platform=efi" ,flags)) - ((#:phases phases) - `(modify-phases ,phases - (add-after 'patch-stuff 'use-absolute-efibootmgr-path - (lambda* (#:key inputs #:allow-other-keys) - (substitute* "grub-core/osdep/unix/platform.c" - (("efibootmgr") - (string-append (assoc-ref inputs "efibootmgr") - "/sbin/efibootmgr"))) - #t))))))))) - -(define-public syslinux - (let ((commit "bb41e935cc83c6242de24d2271e067d76af3585c")) - (package - (name "syslinux") - (version (git-version "6.04-pre" "1" commit)) - (source (origin - (method git-fetch) - (uri (git-reference - (url "https://github.com/geneC/syslinux") - (commit commit))) - (file-name (git-file-name name version)) - (sha256 - (base32 - "0k8dvafd6410kqxf3kyr4y8jzmpmrih6wbjqg6gklak7945yflrc")))) - (build-system gnu-build-system) - (native-inputs - `(("nasm" ,nasm) - ("perl" ,perl) - ("python-2" ,python-2))) - (inputs - `(("libuuid" ,util-linux))) - (arguments - `(#:parallel-build? #f - #:make-flags - (list (string-append "BINDIR=" %output "/bin") - (string-append "SBINDIR=" %output "/sbin") - (string-append "LIBDIR=" %output "/lib") - (string-append "INCDIR=" %output "/include") - (string-append "DATADIR=" %output "/share") - (string-append "MANDIR=" %output "/share/man") - "PERL=perl" - "bios") - #:phases - (modify-phases %standard-phases - (add-after 'unpack 'patch-files - (lambda _ - (substitute* (find-files "." "Makefile.*|ppmtolss16") - (("/bin/pwd") (which "pwd")) - (("/bin/echo") (which "echo")) - (("/usr/bin/perl") (which "perl"))) - #t)) - (delete 'configure) - (add-before 'build 'set-permissions - (lambda _ - (zero? (system* "chmod" "a+w" "utils/isohybrid.in")))) - (replace 'check - (lambda _ - (setenv "CC" "gcc") - (substitute* "tests/unittest/include/unittest/unittest.h" - ;; Don't look up headers under /usr. - (("/usr/include/") "")) - (zero? (system* "make" "unittest"))))))) - (home-page "http://www.syslinux.org") - (synopsis "Lightweight Linux bootloader") - (description "Syslinux is a lightweight Linux bootloader.") - (license (list license:gpl2+ - license:bsd-3 ; gnu-efi/* - license:bsd-4 ; gnu-efi/inc/* gnu-efi/lib/* - ;; Also contains: - license:expat license:isc license:zlib))))) diff --git a/gnu/packages/u-boot.scm b/gnu/packages/u-boot.scm deleted file mode 100644 index bcfe059ee1..0000000000 --- a/gnu/packages/u-boot.scm +++ /dev/null @@ -1,138 +0,0 @@ -;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2016 Danny Milosavljevic -;;; Copyright © 2016 David Craven -;;; -;;; 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 -;;; GNU General Public License for more details. -;;; -;;; You should have received a copy of the GNU General Public License -;;; along with GNU Guix. If not, see . - -(define-module (gnu packages u-boot) - #:use-module (guix build-system gnu) - #:use-module (guix download) - #:use-module (guix packages) - #:use-module ((guix licenses) #:prefix license:) - #:use-module (gnu packages) - #:use-module ((gnu packages algebra) #:select (bc)) - #:use-module (gnu packages bison) - #:use-module (gnu packages cross-base) - #:use-module (gnu packages flex) - #:use-module (gnu packages python)) - -(define-public dtc - (package - (name "dtc") - (version "1.4.2") - (source (origin - (method url-fetch) - (uri (string-append - "https://www.kernel.org/pub/software/utils/dtc/" - "dtc-" version ".tar.xz")) - (sha256 - (base32 - "1b7si8niyca4wxbfah3qw4p4wli81mc1qwfhaswvrfqahklnwi8k")))) - (build-system gnu-build-system) - (native-inputs - `(("bison" ,bison) - ("flex" ,flex))) - (arguments - `(#:make-flags - (list "CC=gcc" - (string-append "PREFIX=" (assoc-ref %outputs "out")) - "INSTALL=install") - #:phases - (modify-phases %standard-phases - (delete 'configure)))) - (home-page "https://www.devicetree.org") - (synopsis "Compiles device tree source files") - (description "@command{dtc} compiles -@uref{http://elinux.org/Device_Tree_Usage, device tree source files} to device -tree binary files. These are board description files used by Linux and BSD.") - (license license:gpl2+))) - -(define u-boot - (package - (name "u-boot") - (version "2017.01") - (source (origin - (method url-fetch) - (uri (string-append - "ftp://ftp.denx.de/pub/u-boot/" - "u-boot-" version ".tar.bz2")) - (sha256 - (base32 - "1wpc51jm3zyibgcr78jng2yksqvrya76bxgsr4pcyjrsz5sm2hkc")))) - (native-inputs - `(("bc" ,bc) - ("dtc" ,dtc) - ("python-2" ,python-2))) - (build-system gnu-build-system) - (home-page "http://www.denx.de/wiki/U-Boot/") - (synopsis "ARM bootloader") - (description "U-Boot is a bootloader used mostly for ARM boards. It -also initializes the boards (RAM etc).") - (license license:gpl2+))) - -(define (make-u-boot-package board triplet) - "Returns a u-boot package for BOARD cross-compiled for TRIPLET." - (package - (inherit u-boot) - (name (string-append "u-boot-" (string-downcase board))) - (native-inputs - `(("cross-gcc" ,(cross-gcc triplet)) - ("cross-binutils" ,(cross-binutils triplet)) - ,@(package-native-inputs u-boot))) - (arguments - `(#:modules ((ice-9 ftw) (guix build utils) (guix build gnu-build-system)) - #:test-target "test" - #:make-flags - (list "HOSTCC=gcc" (string-append "CROSS_COMPILE=" ,triplet "-")) - #:phases - (modify-phases %standard-phases - (replace 'configure - (lambda* (#:key outputs make-flags #:allow-other-keys) - (let ((config-name (string-append ,board "_defconfig"))) - (if (file-exists? (string-append "configs/" config-name)) - (zero? (apply system* "make" `(,@make-flags ,config-name))) - (begin - (display "Invalid board name. Valid board names are:") - (let ((suffix-len (string-length "_defconfig"))) - (scandir "configs" - (lambda (file-name) - (when (string-suffix? "_defconfig" file-name) - (format #t - "- ~A\n" - (string-drop-right file-name - suffix-len)))))) - #f))))) - (replace 'install - (lambda* (#:key outputs make-flags #:allow-other-keys) - (let* ((out (assoc-ref outputs "out")) - (libexec (string-append out "/libexec")) - (uboot-files (find-files "." ".*\\.(bin|efi|spl)$"))) - (mkdir-p libexec) - (for-each - (lambda (file) - (let ((target-file (string-append libexec "/" file))) - (mkdir-p (dirname target-file)) - (copy-file file target-file))) - uboot-files))))))))) - -(define-public u-boot-vexpress - (make-u-boot-package "vexpress_ca9x4" "arm-linux-gnueabihf")) - -(define-public u-boot-malta - (make-u-boot-package "malta" "mips64el-linux-gnuabi64")) - -(define-public u-boot-beagle-bone-black - (make-u-boot-package "am335x_boneblack" "arm-linux-gnueabihf")) diff --git a/gnu/system/grub.scm b/gnu/system/grub.scm index 7df7d4615a..b18b8be6d7 100644 --- a/gnu/system/grub.scm +++ b/gnu/system/grub.scm @@ -27,7 +27,7 @@ #:use-module (guix download) #:use-module (gnu artwork) #:use-module (gnu system file-systems) - #:autoload (gnu packages grub) (grub) + #:autoload (gnu packages bootloaders) (grub) #:autoload (gnu packages compression) (gzip) #:autoload (gnu packages gtk) (guile-cairo guile-rsvg) #:use-module (ice-9 match) @@ -108,7 +108,7 @@ denoting a file name." grub-configuration make-grub-configuration grub-configuration? (grub grub-configuration-grub ; package - (default (@ (gnu packages grub) grub))) + (default (@ (gnu packages bootloaders) grub))) (device grub-configuration-device) ; string (menu-entries grub-configuration-menu-entries ; list (default '())) diff --git a/gnu/system/install.scm b/gnu/system/install.scm index 944d9f7e72..3ec343570a 100644 --- a/gnu/system/install.scm +++ b/gnu/system/install.scm @@ -28,11 +28,11 @@ #:use-module (gnu services shepherd) #:use-module (gnu packages admin) #:use-module (gnu packages bash) + #:use-module (gnu packages bootloaders) #:use-module (gnu packages linux) #:use-module (gnu packages cryptsetup) #:use-module (gnu packages package-management) #:use-module (gnu packages disk) - #:use-module (gnu packages grub) #:use-module (gnu packages texinfo) #:use-module (gnu packages compression) #:use-module (gnu packages nvi) diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm index 1e680b85a2..8a35f7fbc5 100644 --- a/gnu/system/vm.scm +++ b/gnu/system/vm.scm @@ -31,6 +31,7 @@ #:use-module ((gnu build vm) #:select (qemu-command)) #:use-module (gnu packages base) + #:use-module (gnu packages bootloaders) #:use-module (gnu packages guile) #:use-module (gnu packages gawk) #:use-module (gnu packages bash) @@ -38,7 +39,6 @@ #:use-module (gnu packages qemu) #:use-module (gnu packages disk) #:use-module (gnu packages zile) - #:use-module (gnu packages grub) #:use-module (gnu packages linux) #:use-module (gnu packages package-management) #:use-module ((gnu packages make-bootstrap) -- cgit v1.2.3 From d2986552d17058ce532c7f2377185e1b2323adf2 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 13 Feb 2017 09:57:01 +0100 Subject: system: Use the normalized codeset for the locale name in the examples. * gnu/system/examples/bare-bones.tmpl : Change to "en_US.utf8". * gnu/system/examples/desktop.tmpl : Likewise. * gnu/system/examples/lightweight-desktop.tmpl : Likewise. --- gnu/system/examples/bare-bones.tmpl | 2 +- gnu/system/examples/desktop.tmpl | 2 +- gnu/system/examples/lightweight-desktop.tmpl | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'gnu/system') diff --git a/gnu/system/examples/bare-bones.tmpl b/gnu/system/examples/bare-bones.tmpl index 87e8d1e93c..222ddda579 100644 --- a/gnu/system/examples/bare-bones.tmpl +++ b/gnu/system/examples/bare-bones.tmpl @@ -8,7 +8,7 @@ (operating-system (host-name "komputilo") (timezone "Europe/Berlin") - (locale "en_US.UTF-8") + (locale "en_US.utf8") ;; Assuming /dev/sdX is the target hard disk, and "my-root" is ;; the label of the target root file system. diff --git a/gnu/system/examples/desktop.tmpl b/gnu/system/examples/desktop.tmpl index 21b4563b53..8b02659478 100644 --- a/gnu/system/examples/desktop.tmpl +++ b/gnu/system/examples/desktop.tmpl @@ -9,7 +9,7 @@ (operating-system (host-name "antelope") (timezone "Europe/Paris") - (locale "en_US.UTF-8") + (locale "en_US.utf8") ;; Assuming /dev/sdX is the target hard disk, and "my-root" ;; is the label of the target root file system. diff --git a/gnu/system/examples/lightweight-desktop.tmpl b/gnu/system/examples/lightweight-desktop.tmpl index 91e7d0b562..131c43af77 100644 --- a/gnu/system/examples/lightweight-desktop.tmpl +++ b/gnu/system/examples/lightweight-desktop.tmpl @@ -9,7 +9,7 @@ (operating-system (host-name "antelope") (timezone "Europe/Paris") - (locale "en_US.UTF-8") + (locale "en_US.utf8") ;; Assuming /dev/sdX is the target hard disk, and "my-root" ;; is the label of the target root file system. -- cgit v1.2.3